HomeWildfire Games

MP: don't enforce game init attributes synchronization in PREGAME.


MP: don't enforce game init attributes synchronization in PREGAME.

The NetServer stored a complete copy of the game Init Attributes, which it sent to new clients on updates from the controller. This worked well, but prevents incremental updates and other unrelated messages from being sent.

This changes the system so that:

  • in PREGAME state, the server does not update its copy of the game init attributes
  • the server forwards game setup messages from the controller to all clients
  • Joining clients get a full copy of the Settings, when joining, from the controller (this is a js-driven behaviour - other situations might not need do it).
  • Make the StartNetworkGame message take a copy of the final init attributes, to ensure synchronization (and simplify some logic).

In practice, this:

  • makes it possible to send different types of gamesetup messages (this introduces two: a regular update and the full 'initial-update' for new clients).
  • moves some C++ hardcoding into JS - here in essence the PREGAME server state is now init-attributes-agnostic.
  • does not change much for readiness control - the server already needed to force a change at game start to set random elements.

Note that the loading page is currently still receiving the 'local' game attributes, which assumes that all clients are correctly synchronized (they should be).

Refs #3806, #3049

Differential Revision: https://code.wildfiregames.com/D3714