-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Milestone
Description
Format of messages
Message type and JSON data with a well-defined structure.
emit("type", {"key": "value"})Client Join
Client -> Server
"join", {
"nick": "Player nickname",
"color": "#rrggbb",
"armaturae": "mirmillo"
}
Server -> Client
(actor:spawn|Error)Client input
Client -> Server
"input:press", {
"type": "up"
}Client -> Server
"input:release", {
"type": "primary"
}Available types:
up,down,left,rightprimary,secondary,ternarytauntdashlockDirection
Actor events
Server -> Client
"actor:update", {
"id": "UUID",
"changes": {
"x": 10,
"y": 0,
"direction": "east"
}
}Available types:
createremoveupdate
Examples
# An arrow is shot and hits a player
"actor:create", {
"id": "arrow_id",
"x": 0,
"y": 0
}
"actor:update", {
"id": "arrow_id",
"x": 0,
"y": 10
}
// ...
"actor:update", {
"id": "player_id",
"reason": "hit",
"health": 20,
"armor": 10
}
"actor:remove", {
"id": "arrow_id"
}World state
Server -> Client
"worldstate", {
"actors": [
{
"id": "UUID",
"type": "player",
"nick": "Nickname",
"x": 0,
"y": 0,
"direction": "north",
"armaturae": "mirmillo"
// ...
}
{
"type": "wall",
"x": 32,
"y": 64,
}
]
}Errors
Server -> Client
"error", {
"type": "InvalidNickname",
"message": "Nickname is already in use"
}Reactions are currently unavailable