1. Serialization order
Let's say I've fields: myVal1, myVal2 in EditObj, and fields: myFirst, mySecond in RuntimeObj. How should I do serialization stuff in code (serialization.cpp). Is this solution correct (treating 'ar' as stack):
// RUNTIME serialization
void ExtObject::Serialize(bin& ar)
ar >> mySecond;
ar >> myFirst;
ar << myFirst;
ar << mySecond;
// EDITTIME serialization
void EditExt::Serialize(bin& ar)
int Version = 1;
ar >> myVal2;
ar >> myVal1;
ar << myVal1;
ar << myVal2;
If you save myVal1 first, then you should load it first, instead of loading myVal2 first. That'd mix up the data.
2. Passing values from EditObj to RuntimeObj
Created RuntimeObj stores handle to EditObj to have access to its data and stuff. Let's say I've two values in EditObj: myVal1 and myVal2. I want to make use of them during Runtime as well (by ACE Methods). Do I need to make fields "myVal1, myVal2" in RuntimeObj as well and duplicate data from EditObj in method "void ExtObject::OnCreate()", or maybe I can access EditObj fields from ACE Methods and not worry about making fields at RunTime Object?
Data which is serialized at edittime can then be loaded similarly in OnCreate, like this:
// Load settings
int Version = 0;
ar >> Version;
ar >> tile_width >> tile_height >> speed >> play_if_stopped;
Two important things to note: you must load a blank version number (as the edittime saves one), and you must call ar.detach() after you've loaded your data. It's up to you whether you store the loaded variables (as above) or just define them locally in the function for using when creating the object.
3. Serialization in runtime
This question is somehow related to #2. Surely serializing object in Runtime is used for QuickSave/QuickLoad its state. When making QuickSave in runtime, does corresponding EditObj data serialize as well?
The runtime serializing is used for quicksave/load, yes. The edittime data is gone by this point, so if you need it, get it in OnCreate and keep it in your run object.