Constructor
new GameSettingsController()
Members
Timeout
Wait (at most) this many milliseconds before sending network messages.
Methods
getSettings()
Returns the InitAttributes, augmented by GUI-specific data.
launchGame()
Cheat prevention:
1. Ensure that the host cannot start the game unless all clients agreed on the game settings using the ready system.
TODO:
2. Ensure that the host cannot start the game with InitAttributes different from the agreed ones.
This may be achieved by:
- Determining the seed collectively.
- passing the agreed game settings to the engine when starting the game instance
- rejecting new game settings from the server after the game launch event
parseSettings()
Parse the following settings.
registerLoadingChangeHandler(handler)
Parameters:
Name | Type | Description |
---|---|---|
handler |
will be called when the 'loading' state change. |
registerSettingsChangeHandler(handler)
Parameters:
Name | Type | Description |
---|---|---|
handler |
will be called when any setting change. (this isn't exactly what happens but the behaviour should be similar). |
registerSettingsLoadedHandler(handler)
Parameters:
Name | Type | Description |
---|---|---|
handler |
will be called when the initial settings have been loaded. |
registerUpdateLayoutHandler(handler)
Parameters:
Name | Type | Description |
---|---|---|
handler |
will be called when the layout needs to be updated. |
setNetworkInitAttributes()
This function is to be called when a GUI control has initiated a value change.
To avoid an infinite loop, do not call this function when a game setup message was
received and the data had only been modified deterministically.
This is run on a timer to avoid flooding the network with messages,
e.g. when modifying a slider.
updateLayout()
This should be called whenever the GUI layout needs to be updated.
Triggers on the next GUI tick to avoid un-necessary layout.