Each Game is made a succession of events, from an Admin creating a Batch to players going through Rounds and Stages. Some of those events trigger callbacks that can be implemented by the Game designer. This document attemps to clarify the ordering and timing of these events.
Once enough players have completed the intro steps to start a game, Empirica will call the
gameInit callback to setup the Game parameters (rounds, stages, any initial setup).
Once the Game has been created and saved into the database,
onGameStart is called, allowing the Game developer to make the final preparations before the game. Any pre-game preparations can be done in either
onGameStart interchangeably. It might make sense to the Game designer to split the overall mandatory Game configuration (Rounds and Stages) in
gameInit, from data initialization (using
set on Game, Players, Rounds and Stages objects) in
onGameStart, but it is not required.
For subsequent Rounds and Stages, the Rounds and Stages callbacks are called as expected in a similar fashion.
Finally, when the last Round ends, after the end of Stage and Round callbacks are triggered, the
onGameEnd callback is called.
After which, the player goes through the exit steps.
The list of callbacks goes as follows in order:
onRoundStart Repeated for each Round
onStageStart Repeated for each Stage
onStageEnd Repeated for each Stage
onRoundEnd Repeated for each Round