Skip to content

Protocol

Ben edited this page Jan 24, 2021 · 4 revisions

The protocol between the modules in Caia is explained here. Every command (except for the player moves) begins with a single character indicating the final destination of the command.

Character Name Extra
<number> Player <number> is a placeholder for the 1 and 2 (and 3 and 4 if you have a 4 player game)
I Caia The whole name of the program is CaiaIO. The I comes from the IO.
M Manager
R Referee

Between Caia (I) and Player

Command Source Destination Description Response
R <name> Player Caia (I) -> Referee (R) The player asks Caia to send it's real name to referee. (STDERR) None
<message> Referee (R) -> Caia (I) Player The incoming message for the player. None
<message> Player Caia (I) -> Referee (R) The outgoing message of the player. None

Between Caia (I) and Manager (M)

Command Source Destination Description Response
I lock Manager (M) Caia (I) The manager asks Caia to lock. lock_ok
I unlock Manager (M) Caia (I) The manager asks Caia to unlock. None
I cpu_speed <gamepc> [<mypc>] Manager (M) Caia (I) The manager tells Caia about some CPU info. None
I number_players <number> Manager (M) Caia (I) The manager tells Caia how many players there in a game. None
I player <number> <name> <time> [<log>] Manager (M) Caia (I) The manager tells Caia the name of the player executable. None
I start <number> [<err_time>] Manager (M) Caia (I) The manager tells Caia to start the game. ...
I referee <name> [<log>] Manager (M) Caia (I) The manager tells Caia the name of the referee executable. ...
I kill <number> Manager (M) Caia (I) The manager tells Caia to kill a player. None
I kill_referee Manager (M) Caia (I) The manager tells Caia to kill the referee. None
I stop_caiaio Manager (M) Caia (I) The manager tells Caia to stop itself. None

Between Caia (I) and Referee (R)

Command Source Destination Description Response
I lock Referee (R) Caia (I) The referee asks Caia to lock. lock_ok
I unlock Referee (R) Caia (I) The referee asks Caia to unlock. None
<number> <message> Referee (R) Caia (I) -> Player The referee tells Caia to send a message to a certain player. None
I listen <number> Referee (R) Caia (I) The referee tells Caia to listen for a response from the player. ...
I request_time <number> Referee (R) Caia (I) The referee asks the what the playing time of a certain player is. time <actual> <estimate>
M <report> Referee (R) Caia (I) -> Manager (M) The referee tells Caia to send a message to the manager. None
Clone this wiki locally