-
Notifications
You must be signed in to change notification settings - Fork 0
Simulations and Socket.IO
Morris Raycroft edited this page Dec 16, 2021
·
10 revisions
When a facilitator enters the administration panel or a player joins the game page for a simulation, they will initially be connected to the server's Socket.IO instance. Socket.IO is a library that is used to handle real-time bi-directional communication, which we use to provide the interactive experience for players and administrators.
{
roomStatus {
running // boolean value; when false, game is paused
level // integer that represents which page simulation is currently on
// only used when
startTime // unix timestamp, represents when game has started/last unpaused
timeElapsed // represents how much time has passed since last paused
settings {
advanceMode // "student", "teacher", or an integer value (timed mode in minutes)
// determines who has the privilege to advance the simulation
// student by default
roleMode // "student", "teacher", "random", or "randomByLevel"
// determines how roles are assigned in the simulation
// student by default
}
variables // object that stores game variables (key is variable name)
// which can be manipulated by gamepieces
gamepieces // object that stores status of gamepieces (key is gamepiece id)
// values are also objects and vary depending on the gamepiece
}
messages [{
sender {
name // string values; name and role player entered when joining game
role
id // player's current socket.io connection id, subject to change
dbid // unique id stored in player's localstorage which stays consistent
// used to determine who they are if regular id changes
// if the player was registered before joining, this is their
// primary key from their database record
invited // boolean value; whether or not player was registered before joining
}
room // room code id (similar to the one in the game room url)
message // message content string value
timeSent // unix timestamp
}]
interactions {
gamepieceId // id of the gamepiece
}
}You can view a real example of a game status object by downloading the JSON of a previous run: