X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=TODO;h=79d0f4bdb422d14540ff3e98d330e3368dac82ce;hb=a92cdbfcb9a66691bf6b73d28401b091e10178cf;hp=67d898deb7ae0f39209a0d5d32cb7f14d94e2d86;hpb=98cb0c7a47ca5ef8cd8f77010d86851866738c1b;p=lmno-todo diff --git a/TODO b/TODO index 67d898d..79d0f4b 100644 --- a/TODO +++ b/TODO @@ -77,12 +77,73 @@ Bring client up to latest Empires API approach [ ] Add UI to generate a new game ID, (allow flempires to work on its own) Example: - curl -X POST https://lmno.games/new/empires + curl -X POST https://lmno.games/new/empires Returns: "WLJG" [ ] Implement player registration by POSTing to /register (without cookie) + Example: + curl -X POST \ + -H 'Content-Type: application/json' \ + -d '{"name": "Carl", "character": "Elvis"}' \ + https://lmno.games/empires/QRST/register + Returns: 1 (Or some other player ID value) + + [ ] Implement registration with /profile and then /register + + Note: This approach requires obtaining a cookie from the + /profile request and then providing that cookie on the + subsequent /register request. The -c and -b command-line options + of curl can be used to demonstrate this: + + Example: + curl -c cookie-file \ + -X PUT \ + -H 'Content-Type: application/json' \ + -d '{"nickname": "Cookie"}' \ + https://lmno.games/profile + curl -b cookie-file \ + -X POST \ + -H 'Content-Type: application/json' \ + -d '{"character": "Cookie Monster"}' + https://lmno.games/empires/QRST/register + Returns: 2 (Or some other player ID value) + + [ ] Listen to the /events stream for the game + + This will require an asynchronous mechanism that is continually + listening for events to come in. Events will be of the form + "event: " followed by the data of the event "data: + " followed by a blank line. There will also + be periodic keep-alive non-events sent which are just a line + with only a ":". + + This mechanism is called "Server-sent events" so you may find + code that supports the parsing of this. Or you may not. It + doesn't seem like this mechanism ever became all that popular + (before websockets came along and became popular). + + Example: + + curl https://lmno.games/empires/QRST/events + Returns: + + event: game-info + data: {"id":"QRST","url":"http://lmno.games/QRST"} + + event: player-info + data: {"id":5,"active":true,"name":"Cookie","team":""} + + event: player-enter + data: {"id":2,"active":true,"name":"Web","team":""} + + event: game-state + data: {"team_to_play":{"name":""}} + + event: players + data: [{"id":1,"name":"Carl"},{"id":2,"name":"Cookie"}] - [ ] Implement registration with /profile and then /register (requires cookie) + event: game-phase + data: {"old_phase":"none","new_phase":"join"} Scribe ======