Ticket #1394 (closed defect: fixed)

Opened 13 months ago

Last modified 13 months ago

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

oos_log.7z (142.2 KB) - added by historic_bruno 13 months ago.

Change History

Changed 13 months ago by historic_bruno

comment:1 Changed 13 months ago by historic_bruno

  • Cc Philip added

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.

comment:3 Changed 13 months ago by philip

  • Owner set to philip
  • Status changed from new to closed
  • Resolution set to fixed

In 11802:

Fix #1394 (UnitAI FSM serialization error).
Replace evil eval/uneval with deepcopy.

Note: See TracTickets for help on using tickets.