Class: GameSettings

GameSettings()

Data store for game settings. This is intended as a helper to create the settings object for a game. This object is referred to as: - g_InitAttributes in the GUI session context - InitAttributes in the JS simulation context - Either InitAttributes or MapSettings in the C++ simulation. Settings can depend on each other, and the map provides many. This class's job is thus to provide a simpler interface around that.

Constructor

new GameSettings()

Source:

Methods

fromInitAttributes()

Deserialize from a the InitAttributes format (i.e. parsed JSON). TODO: this could/should maybe support partial deserialization, which means MP might actually send only the bits that change.
Source:

launchGame(playerAssignments)

Start the game & switch to the loading page. This is here because there's limited value in having a separate folder/file for it, since you'll need a GameSettings object anyways.
Parameters:
Name Type Description
playerAssignments A dict of 'local'/GUID per player and their name/slot.
Source:

pickRandomItems()

Change "random" settings into their proper settings.
Source:

toInitAttributes()

'Serialize' the settings into the InitAttributes format, which can then be saved as JSON. Used to set the InitAttributes, for network synching, for hotloading & for persistence. TODO: it would probably be better to have different paths for at least a few of these.
Source: