diff options
| author | Loic Guegan <manzerberdes@gmx.com> | 2019-05-08 12:40:12 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerberdes@gmx.com> | 2019-05-08 12:40:12 +0200 |
| commit | 117933db2efcfbf94f2ce19b7babbf9730afd065 (patch) | |
| tree | b6c95667e57bfd569c122b42a6f27d9df640db88 | |
| parent | 7bf9f3470a2cf64a7ecc3c4c89f3d273119f3bd2 (diff) | |
Update API
| -rw-r--r-- | doc/api.org | 10 | ||||
| -rw-r--r-- | doc/api.pdf | bin | 118905 -> 119891 bytes |
2 files changed, 9 insertions, 1 deletions
diff --git a/doc/api.org b/doc/api.org index daa6e5b..cd7dec3 100644 --- a/doc/api.org +++ b/doc/api.org @@ -19,18 +19,22 @@ #+BEGIN_SRC json { "type": "state", + "syn": 1, "game-id": 1, "game-over": false, "snake": [(1,2),(1,3)], "food": [(6,7)] } #+END_SRC + Note that, syn entry is used to keep packet ordering consistent and detecting packet inversion on the network. Thus, + syn entry indicate the expected syn that the client should send on the next UDP packet. ** Gameplay *** Change Direction 1. When client is playing a game it can ask to the server to change snake direction: #+BEGIN_SRC json { "type": "update", + "syn": 1, "game-id": 1, "direction": "left", } @@ -39,6 +43,7 @@ #+BEGIN_SRC json { "type": "state", + "syn": 2, "game-id": 1, "game-over": false, "snake": [(0,2),(1,2)], @@ -50,6 +55,7 @@ #+BEGIN_SRC json { "type": "update", + "syn": 2, "game-id": 1, "direction": null } @@ -58,6 +64,7 @@ #+BEGIN_SRC json { "type": "state", + "syn": 3, "game-id": 1, "game-over": false, "snake": [(1,2),(0,2)], @@ -69,10 +76,11 @@ #+BEGIN_SRC json { "type": "state", + "syn": null, "game-id": 1, "game-over": true, "snake": [(0,2),(1,2)], "food": [(6,7)] } #+END_SRC - - No reply is expected from the client and server will be in charge to free local memory + - No reply is expected from the client and server will be in charge to free local memory. Note that syn=null. diff --git a/doc/api.pdf b/doc/api.pdf Binary files differindex a1f94e5..a02a350 100644 --- a/doc/api.pdf +++ b/doc/api.pdf |
