API
Server
Empirica.onGameStart(callback)
Empirica.onGameStart(callback)Example
Empirica.gameInit(game => {
game.players.forEach((player, i) => {
player.set("score", 0);
});
const round1 = game.addRound();
round1.addStage({
duration: 120
name: "Response",
});
if (game.treatment.playerCount > 1) {
round1.addStage({
duration: 120
name: "Result",
});
}
const round2 = game.addRound();
round1.addStage({
duration: 300
name: "Response",
someotherfield: "mydata"
});
if (game.treatment.playerCount > 1) {
round1.addStage({
duration: 120
name: "Result",
});
}
});Game Callbacks
Empirica.onRoundStart(callback)
Empirica.onRoundStart(callback)Example
Empirica.onStageStart(callback)
Empirica.onStageStart(callback)Example
Empirica.onStageEnded(callback)
Empirica.onStageEnded(callback)Example
Empirica.onRoundEnded(callback)
Empirica.onRoundEnded(callback)Example
Empirica.onGameEnded(callback)
Empirica.onGameEnded(callback)Example
Empirica.on(model, callback)
Empirica.on(model, attributeName, callback)
Empirica.flush()
Server Objects
Game object
Game objectProperty
Type
Description
Round object
Round objectProperty
Type
Description
Stage object
Stage objectProperty
Type
Description
Player object
Player objectProperty
Type
Description
Client
Last updated
Was this helpful?