Ticket #1394 (closed defect: fixed)
Instant serialization test failure
| Reported by: | historic_bruno | Owned by: | philip |
|---|---|---|---|
| Priority: | Release Blocker | Milestone: | Alpha 10 |
| Component: | Core engine | Keywords: | |
| Cc: | Philip |
Description
Must enable CSimulation2Impl::m_EnableSerializationTest, then you will get an instant serialization test failure. This is in single player mode, any map, with or without AI. Attaching contents of oos_log.
Attachments
Change History
comment:2 Changed 13 months ago by Philip
Serialization test mode is incompatible with AI (since we don't serialize AI properly yet), so that's not a relevant case.
The problem occurs on an empty map with a single unit, when you give a command to that unit. AIProxy.changes.unitAIState doesn't get set in the deserialized instance of the game. That's because r11429 added a property to FSM that is a reference to a function assigned by UnitAI.prototype.OnCreate, which is broken since the FSM object is a global object - firstly each newly created unit will overwrite the values any previous units stored in that property of the global UnitFsm, and secondly (since globals aren't serialized) the property will be undefined if no new units were created (e.g. if the game state was recently deserialized).
If FSM.prototype.Init is to store any persistent state, it needs to be per-entity state on obj (like the current obj.fsmStateName). Also the value can't be a function, it'd need to be a string naming the function.
But I don't see any value in having this be a configurable property anyway - FSM can just call something like obj.FsmStateNameChanged(obj.fsmStateName) directly, which is simpler.
