Geoguessr Self-Hosted Reimplementation
Back End
Pages/Form Endpoints
GET / -> Page with 3 forms for set name, new game, and join game
POST /name -> Receive name (and secret?) from form
POST /newGame -> Receive time limit from form
POST /joinGame -> Receive ID from form
GET /summary/{ID} -> Return page summarizing game
GET /play/{ID} -> returns Front End w/ ID and name set
API Endpoints
GET /game/{ID}
{
"timer": number,
"coords": {
"1": {
"lat": number,
"lon": number,
}, ...
}
}
GET /game/{ID}/guesses/{name}
{
"currentRound": string || null,
"guesses": {
"1": {
"lat": number,
"lon": number,
"score": number,
}, ...
}
}
POST /game/{ID}/guesses/{name}/{round}
Accepts {
"lat": number,
"lon": number,
}
400 vs 201
Front End
- Render streetview pano
- Render map for guessing
- On click, place and track marker for guess
- Render control pane
- Submit button
- Timer
- Round counter
- Current scores
- Fetch /game/{ID}, extract coords and timer length
- Main Loop
- Fetch /game/{ID}/guesses/{name}, update scores and round
- if round comes back null, redirect to /summary/{ID}
- Extract current coord
- Clear map markers
- Zoom out map
- Change pano to coord
- Reset timer
- On timeout or submit -> POST to /game/{ID}/guesses/{name}/{round}