Jelajahi Sumber

Initial commit

Kirk Trombley 5 tahun lalu
melakukan
6f3340796b
5 mengubah file dengan 76 tambahan dan 0 penghapusan
  1. 10 0
      .gitignore
  2. 65 0
      README.md
  3. 1 0
      server/app.py
  4. 0 0
      server/requirements.txt
  5. 0 0
      ui/.gitkeep

+ 10 - 0
.gitignore

@@ -0,0 +1,10 @@
+.vscode/
+
+.venv/
+*.pyc
+__pycache__/
+
+dist/
+node_modules/
+
+secrets.toml

+ 65 - 0
README.md

@@ -0,0 +1,65 @@
+# 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}
+```

+ 1 - 0
server/app.py

@@ -0,0 +1 @@
+print("Hello, world!")

+ 0 - 0
server/requirements.txt


+ 0 - 0
ui/.gitkeep