X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=api.text;h=250ed107c86aad50698332b5185a5402c85debf2;hb=748f60bb7e13cc3422d8d628268d6ee55f1fae83;hp=48a2eb6b072c499795d0d81a9451ce59ff37ee01;hpb=39b74cde47375adaeacc33507a2173b63e3de10c;p=empires-api diff --git a/api.text b/api.text index 48a2eb6..250ed10 100644 --- a/api.text +++ b/api.text @@ -1,5 +1,11 @@ -Gameplay API endpoints (within a current game) -============================================== +Empires Game Protocol +===================== +Version: 0.4 + +For a specific game the following API endpoints are defined. +(Note: Only the trailing portion of the API URI is provided here. + The preceding portions of the path must be determined externally.) + /events This is a server-sent events stream that allows the server to push @@ -43,6 +49,30 @@ Gameplay API endpoints (within a current game) event: player-leave data: {"id":3} + TYPE: game-state + + WHEN: When client first connects and whenever game state changes + + VALUES: Game state will be one of the following: + + 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 + + EXAMPLE: + + event: game-state + data: {"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 @@ -66,6 +96,22 @@ Gameplay API endpoints (within a current game) 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