|
3 years ago | |
---|---|---|
client | 3 years ago | |
server | 3 years ago | |
.gitignore | 3 years ago | |
README.md | 3 years ago |
All operations on a game will cause the server to distribute tokens if needed
/games
Return list of current games
{
games: [{
id: "string",
name: "string",
}],
}
/game
Create a new game with a given name
{
name: "string",
width: 0,
height: 0,
}
Returns ID
{
id: "string",
name: "string",
}
/game/{id}
Get a game with a given id
{
name: "string", // display name of the game
state: "LOBBY" || "PLAYING" || "FINISHED",
width: 0, // board dimensions
height: 0,
distribute: "string", // next time points will be distributed
players: {
[code]: { // keyed by a player code string
name: "string", // user-defined
tank: null || { // null if jury
x: 0,
y: 0,
points: 1,
health: 3,
range: 1,
},
vote: null || "string", // code of current jury vote
}
}
}
/game/{id}/join
Join a game
{
name: "string",
}
Returns player code
{
code: "string",
}
/game/{id}/start
Start a game, game must be in LOBBY
state
/game/{id}/{fire,move,give}/{code}
Fire on, move to, or give to a target, game must be in PLAYING
state
{
x: 0,
y: 0,
}
Returns
{
result: true,
reason: "string" || null, // reason for failure if applicable
}
/game/{id}/upgrade/{code}
Upgrade the range of a tank, game must be in PLAYING
state
Returns
{
result: true,
reason: "string" || null, // reason for failure if applicable
}
/game/{id}/vote/{code}
Set a jury vote, game must be in PLAYING
state
{
vote: "string" || null,
}