GUI ↔ Server¶
After the GUI handshake, the viewer can query the server and
continuously receives events describing the world's evolution. All
identifiers are #-prefixed; directions and resources follow the encodings from
the Overview.
Sources: server/srcs/core/GuiCommandHandler.cpp (incoming requests),
server/srcs/protocol/GUIProtocol.cpp (outgoing events),
gui/src/network/MessageParser.cpp (GUI-side reception).
GUI → Server requests¶
| Request | Format | Effect |
|---|---|---|
| Map size | msz |
Replies msz X Y. |
| Time unit | sgt |
Replies sgt T. |
| Whole map | mct |
Replies with the content of every tile (series of bct). |
| Team names | tna |
Replies one tna per team. |
| Tile content | bct X Y |
Replies bct X Y q0..q6. |
| Player position | ppo #n |
Replies ppo #n X Y O. |
| Player level | plv #n |
Replies plv #n L. |
| Player inventory | pin #n |
Replies pin #n X Y q0..q6. |
| Change time unit | sst T |
Changes the frequency and replies sst T. |
Error replies¶
| Reply | Cause |
|---|---|
suc |
Unknown command. |
sbp |
Bad parameters on a known command. |
(GuiCommandHandler.cpp:22-147.)
Server → GUI events¶
| Event | Format | Meaning |
|---|---|---|
msz |
msz X Y |
Map size. |
sgt |
sgt T |
Frequency / time unit. |
tna |
tna N |
A team name (repeated per team). |
pnw |
pnw #id X Y O L N |
New player: position, orientation O (1N/2E/3S/4W), level L, team N. |
ppo |
ppo #id X Y O |
Player position and orientation. |
pdi |
pdi #id |
Player death. |
bct |
bct X Y q0 q1 q2 q3 q4 q5 q6 |
Tile content (food, linemate, deraumere, sibur, mendiane, phiras, thystame). |
mct |
series of bct |
Whole-map content (see warning). |
plv |
plv #id L |
Player level. |
pin |
pin #id X Y q0..q6 |
Player inventory (food as a raw count). |
pgt |
pgt #id i |
A player picks up resource index i (0..6). |
pdr |
pdr #id i |
A player drops resource index i. |
pic |
pic X Y L #id ... |
Incantation start at (X,Y) level L, with the participant list. |
pie |
pie X Y R |
Incantation end: R = 1 (success) or 0 (failure). |
pbc |
pbc #id M |
A player broadcasts message M. |
pfk |
pfk #id |
A player lays an egg (fork). |
pex |
pex #id |
A player ejects others (eject). |
enw |
enw #egg #player X Y |
New egg laid by player #player. |
ebo |
ebo #egg |
An egg hatches (an AI connects). |
edi |
edi #egg |
An egg dies. |
seg |
seg N |
End of game: team N won. |
smg |
smg M |
Server message. |
sst |
sst T |
Confirmation of a time-unit change. |
(GUIProtocol.cpp.)
Encodings
Orientation O: 1 North, 2 East, 3 South, 4 West. Resource index
i: 0 food, 1 linemate, 2 deraumere, 3 sibur, 4 mendiane,
5 phiras, 6 thystame. Details in Overview.
Wire examples¶
Tile(3,4) holds 1 food and no stones.
Player #1 appeared at (4,5), oriented East (2), level 1, team team1.
Player #1 is now at (5,5), oriented South (3).
Incantation started at (4,5) for level 2 with players #1 and #2, then
ended successfully (pie ... 1).
GUI-side limits¶
Ignored events / mct expanded into bct
The current GUI has no handler for sst, suc, or sbp (it only sends
GRAPHIC at startup and therefore never produces these replies). Moreover,
the server never emits an aggregated mct: it "explodes" it into a series of
bct, and the GUI's onMct handler is a deliberate no-op. The smg event
is defined server-side but has no call site (unused). See
Known limitations and GUI.