-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmessaging.toml
90 lines (74 loc) Β· 3.6 KB
/
messaging.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
[meta]
namespace = "WasmBots"
list_size_type = "uint16"
string_size_type = "byte"
# used internally for handling host <-> module mishaps
[[messages]]
_name = "_Error"
description = "string"
# initial setup message that you can either accept or reject
[[messages]]
_name = "InitialParameters"
paramsVersion = "uint16" # version of this very message, so you know if you can parse the rest
engineVersionMajor = "uint16" # major version of engine
engineVersionMinor = "uint16" # minor version of engine
engineVersionPatch = "uint16" # patch version of engine
diagonalMovement = "bool" # if false, any attempted diagonal move will be Invalid
playerStride = "byte" # how far you can move on a given turn
playerOpenReach = "byte" # the distance at which you can open things (doors, chests)
[[structs]]
_name = "Point"
x = "int16"
y = "int16"
[[enums]]
_name = "MoveResult"
_values = [
"Succeeded", # your move worked (ex: attack hit, moved successfully)
"Failed", # your move did not work (ex: attack missed, moved into wall)
"Invalid", # your move was not allowed by the system (ex: tried diagonal movement when not allowed, targeted something out of range)
"Error", # your move was not understood (ex: malformed message, missing data)
]
[[enums]]
_name = "TileType"
_values = [
"Void", # you don't know what's there; might be off the edge of the map, or maybe just behind a wall
"Floor", # an open space you can move to
"OpenDoor", # a door space that you can pass through or take a turn to target with Close
"ClosedDoor", # an impassable door space that you can take a turn to target with Open
"Wall", # an impassable space
]
[[enums]]
_name = "Direction"
_values = [
"North",
"Northeast",
"East",
"Southeast",
"South",
"Southwest",
"West",
"Northwest",
]
# player receives every tick
[[messages]]
_name = "PresentCircumstances" # describes your immediate situation and surroundings at the start of this turn
lastTickDuration = "uint32" # how long, in milliseconds, you took on the last tick (will be 0 on initial turn)
lastMoveResult = "MoveResult" # the result of your last turn (will be Succeeded on initial turn)
currentHitPoints = "uint16" # how many hit points you have
surroundings = "[TileType]" # array of tiles representing your immediate surroundings as a square with you in the middle
surroundingsRadius = "byte" # radius (from you) of the surroundings, so the side of a square is (this * 2) + 1
### moves that the player submits
[[messages]]
_name = "Wait" # no-op; don't do anything and wait for the next tick
[[messages]]
_name = "Resign" # give up the game; you will receive no more tick calls after submitting this move
[[messages]]
_name = "MoveTo" # move to a new tile
direction = "Direction" # which way to move
distance = "byte" # how far to move (can usually just be 1, but might be modified); if you put a number that is beyond your max range, the move will be Invalid
[[messages]]
_name = "Open" # open (a door, a chest, etc.) at a specific tile
target = "Point" # the position *relative to you* that you want to try to open; can usually only be one square away (manhattan distance); if already opened, move will fail; if target is not openable, move will be Invalid
[[messages]]
_name = "Close" # close (a door, a chest, etc.) at a specific tile
target = "Point" # the position *relative to you* that you want to try to close; can usually only be one square away (manhattan distance); if already closed, move will fail; if target is not closable, move will be Invalid