Game Event Structures
Events are the JSON objects returned from the RGS play/ API and make up the vast majority of data with a game's library. Events contain all information required by the front-end to display the current state of the game. Anything not contained within or implied by the events cannot be shown to the player. For a typical game this includes, but is not limited to
- Active gameboard symbols
- Freespin counters
- Win counters
- Symbol win information
- Multipliers
- Special symbol actions
- ....
The events are crucial as all events need to be handled by the front-end. The user is free to determine their event structure, though to follow the example games, all events have the format,
"index" keeps track of the current number of events in a simulation, "type" is a unique keyword used to identify an event and is generally a one-word description. "fields" are strings who's corresponding value can have any data-type, as required. Once constructed, the event is appended to the book, "events" field":
Events are handled separately in the gamestate to game calculations or executables. They are imported explicitly and not attached to the gamestate object. Once the math-engine has made the appropriate board transformation or action, the event should be emitted immediately, as it will provide a snapshot of the current state of the game. For example:
These events should be sent anytime new information needs to be communicated to the player.