-
Notifications
You must be signed in to change notification settings - Fork 1
Game State Format
The game state is a JSON object in the following format:
{
"sent": "2012-04-23T18:25:43.511Z",
"status": "ongoing",
"t": 2.3,
"players": {
"0": {
"position": [x, y],
"velocity": [vx, vy],
"acceleration": [ax, ay],
"orientation": angle,
"cooldown": s
},
"1": {
"position": [x, y],
"velocity": [vx, vy],
"acceleration": [ax, ay],
"orientation": angle,
"cooldown": s
},
...
}
"bullets": {
"0":[{
"position": [x, y],
"velocity": [vx, vy]]
},...]
"1":[{
"position": [x, y],
"velocity": [vx, vy]]
}, ...]
...
}
}-
sentdescribes the time at which the game state was sent to the frontend -
statusdescribes whether the game is ongoing and, if not, who won -
tis the current game time -
playersis a dictionary mapping player IDs to game agents. -
bulletsis a dictionary mapping player IDs to lists of the bullets currently on screen fired by that player.
The types of the individual fields is described below.
Individual matches will define a playing field (width, height), with both width and height some positive real number. Coordinates are (x, y), with 0 <= x <= width and 0 <= y <= height, in Cartesian coordinates: (0, 0) is the lower-right corner of the playing field. The correspondence between playing field and viewport is unspecified.
These are also in Cartesian coordinates, in the same system as x and y, but unlike those these are signed. vx = -1 means the object is traveling 1 unit per game second to the left. ay = 1 implies that the object is accelerating upwards, not accounting for gravity, at 1 unit per game second per game second.
Angles are in radians.
s is in game seconds, which is not specifically correlated to real-world seconds. This is the unit of time in the physics engine.
This describes the time the server sent the game state. It is in ISO 8601 format.
This is right now just "ongoing" or "over", although in the future more detailed information might be included.
This describes the moment in time that the state represents, in game seconds.