On every tick in the server, the server will send many messages about unit moves, spawning bullet/npc or destroying tank/bullet/wall.
Type of message is field status
with value "data"
To determine action of object (destroy/move/change/spawn) you can use action
field.
Sends only basic information about movement
{
"status": "data",
"action": "move",
"id": HEX,
"position": {"x": X, "y": Y}
}
When unit is spawned or changed (direction, speed or sth) then server sends all info about object.
{
"status": "data",
"action": "change"|"spawn"|"freeze"|"unfreeze",
"id": HEX,
"type": TYPE,
"speed": SPEED, // int
"position": {"x": X, "y": Y},
"direction": "up"|"down"|"left"|"right",
"parent": null|PARENT_HEX, // used to detect friendly/own/enemy bullet
"is_freeze": true|false // tank can be freeze max to 15 ticks of game.
}
change
- when object is changed - like another speed or direction.spawn
- when object is created - shot bullet or new NPC in the areafreeze
- when player was shot by another player. This player can't move.unfreeze
- when is player is not freezed and can move.
{
"status": "data",
"action": "destroy",
"id": HEX
}