X-Git-Url: https://git.cworth.org/git?p=lmno-api;a=blobdiff_plain;f=api.text;h=26f0a4d92f4e40ecf330b1832a5932208434a197;hp=41e365c65e3df41a6151cda5d057e956c1bb52f3;hb=07dc9ba69e0edba9cbae6b71ded6f2b8ca17f14a;hpb=7c9ed4f7f7428da79eaa06376991b4ed0965fa47 diff --git a/api.text b/api.text index 41e365c..26f0a4d 100644 --- a/api.text +++ b/api.text @@ -1,6 +1,6 @@ Empires Game Protocol ===================== -Version: 0.3 +Version: 0.6 For a specific game the following API endpoints are defined. (Note: Only the trailing portion of the API URI is provided here. @@ -49,6 +49,41 @@ For a specific game the following API endpoints are defined. event: player-leave data: {"id":3} + TYPE: game-state + + WHEN: When client first connects and whenever game state changes + + VALUES: Event gives both the old and new state. + Each will be one of the following: + + none: Pseudo-state used as old_state when game is started + join: Players are choosing characters and joining the game + reveal: Character names are being revealed to players + capture: Players are guessing characters in capture attempts + + NOTE: When a client first connects, it may see multiple + game-state transitions, to transition step-by-step from + the initial state to the state of the current game. See + the example below which would be presented to a client + joining a game that is already in the "reveal state. + + EXAMPLES: + + event: game-state + data: {"old_state":"none","new_state":"join"} + + event: game-state + data: {"old_state":"join","new_state":"reveal"} + + TYPE: character-reveal + + WHEN: Periodically during the "reveal" state of the game + + EXAMPLE: + + event: character-reveal + data: {"character":"Albert Einstein"} + TYPE: capture WHEN: When one player captures another @@ -72,6 +107,22 @@ For a specific game the following API endpoints are defined. Behavior: Removes an existing player with the given ID +/reveal + + Method: POST + + When: Only valid when in game state of JOIN + + Behavior: Change state to REVEAL; reveal character names to all clienta + +/start + + Method: POST + + When: Only valid when in game state of REVEAL + + Behavior: Change game state to CAPTURE + /reset Method: POST