Opened 12 years ago
Closed 12 years ago
#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 Taylor | Patch: |
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 (1)
Change History (4)
by , 12 years ago
Attachment: | oos_log.7z added |
---|
comment:1 by , 12 years ago
Cc: | added |
---|
comment:2 by , 12 years ago
Note:
See TracTickets
for help on using tickets.
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 toFSM
that is a reference to a function assigned byUnitAI.prototype.OnCreate
, which is broken since theFSM
object is a global object - firstly each newly created unit will overwrite the values any previous units stored in that property of the globalUnitFsm
, 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 onobj
(like the currentobj.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 likeobj.FsmStateNameChanged(obj.fsmStateName)
directly, which is simpler.