Serialization

AngelScript is capable of some serialization, however not everything will be saved to save file, and there are some limitations to be wary of.

Unsafe

Unsafe

The following points below will cause the serialization process to be aborted, or in worst case scenario cause the game to crash.
It will only happen if current script module doesn't match with the saved script module's content.

  • Changing variable order in script classes
  • Adding new/removing variables in script classes
  • Adding new/removing script classes
  • Changing the order of how script classes (or variables) are loaded

Safe

Safe

The following points below are OKAY to do, and it will not cause any problems when loading a save file.

  • Adding new functions
  • Modifying functions or how they behave

Serialization List

When the cached object is being prepared to be serialized, the game will go through each datatype/object and check if they could be saved.
If the Datatype/Object cannot be serialized, the game will just ignore it.

It's highly recommended to do manual restoration for certain objects like CSoundPatch@ which cannot be serialized.

Typically objects that derive from CBaseEntity@ can be serialized, other objects may or may not be serializable.

Warning

Const datatypes or objects will not be serialized, they will be ignored.

Paused contexts/executions (via Wait function) will not be serialized.

Datatype/Object Is Serialized Note(s)
bool YES n/a
int YES n/a
float YES n/a
double PARTIALLY Automatically converted to float type on compilation
uint YES n/a
array PARTIALLY (?) Multi-dimension arrays have not been tested, single arrays work fine
any NO n/a
int8 NO Use int instead
int16 NO Use int instead
int32 NO Use int instead
int64 NO Use int instead
uint8 NO Use uint instead
uint16 NO Use uint instead
uint32 NO Use uint instead
uint64 NO Use uint instead
dictionary NO Use arrays instead
ref NO n/a
weakref NO n/a
string YES n/a
string_t YES n/a
Vector YES n/a
QAngle YES n/a
AngularImpulse YES n/a
CBaseEntity@ YES n/a
EHANDLE YES n/a
CP3SObj@ YES Serializes P3S Obj via Base Entity pointer
ConVar@ PARTIALLY Serializes only the value, other values (like help text and callback) are lost
CP3Weapon@ YES Serializes via Base Entity pointer
CP3Player@ YES Serializes via Base Entity pointer
CParticleSystem@ YES Serializes via Base Entity pointer
CPhysObj@ YES Iterates via entity list to match with pointer
CCutsceneCamera@ YES Serializes via Base Entity pointer
CSoundPatch@ NO Sounds cannot be serialized, requires manual restoration
IGameEvent@ NO Game events cannot be stored
CTakeDamageInfo@ NO Currently no way to properly store
CWPNData@ NO Data might change between saves
Ammo_t@ NO Data might change between saves
KeyValues@ NO n/a
CAINetworkManager@ NO There is a global var for this type
IGameEventManager@ NO There is a global var for this type
CGlobalVars@ NO There is a global var for this type
CAI_Hint@ YES n/a