Skip to content

Scribble lab#98

Open
Dhana-Dikonda wants to merge 7 commits into
everest-engineering:mainfrom
Dhana-Dikonda:scribble-lab
Open

Scribble lab#98
Dhana-Dikonda wants to merge 7 commits into
everest-engineering:mainfrom
Dhana-Dikonda:scribble-lab

Conversation

@Dhana-Dikonda
Copy link
Copy Markdown

@Dhana-Dikonda Dhana-Dikonda commented Jun 4, 2026

Summary

Implement the core game loop, coordination logic, and UI components for the multiplayer drawing game ("Scribble"), covering Scenarios 1 through 4. All synchronization is handled via HTTP polling (no WebSockets) and state is maintained strictly in-memory.

Key Changes

  1. Room Setup & Lobby (Scenario 1):
    • Added host tracking (room.hostId) on room creation.
    • Enforced non-empty, trimmed name validation using Zod on both backend and frontend.
    • Implemented automatic lobby state polling (~2s interval) with transition redirects.
    • Restricted start game action to the host and enforced a 2-player minimum.
    • Fixed the frontend API base URL fallback (removed /bug).
  2. Game Start & Drawer Flow (Scenario 2):
    • Assigned the host as the "drawer" and all other players as "guesser".
    • Implemented deterministic secret word selection from starter data on game start.
    • Isolated the secret word in room snapshots so that only the drawer client can see it.
  3. Gameplay Interaction (Scenario 3):
    • Created the interactive <DrawingCanvas> supporting touch/mouse coordinate tracking scaled to a reference 800x500 viewport, with real-time local drawing, redraw polling, and canvas clearing.
    • Added Zod-validated POST /rooms/:code/guesses endpoint checking correctness case-insensitively.
    • Wired up a descending scoreboard list, guess submit form, and scrolled activity logs (highlighting correct guesses in green and autoscrolling on new guess entries).
  4. Results & Restart Flow (Scenario 4):
    • Added a "Round Completed!" banner in results status showing the correct word and guesser to all.
    • Implemented POST /rooms/:code/restart for the host to reset status back to "lobby", zero scores, clear drawings/guesses, and redirect everyone back to the lobby page while preserving the player list.

Contributor

- Extend RoomStatus to lobby | game | results (T002)
- Add hostId to Room and RoomSnapshot models (T003, T004)
- Fix frontend API base URL /bug suffix (T001, T005)
- Tighten Zod name validation — reject empty/whitespace (T006, T012)
- Add startRoomSchema for /start endpoint (T021)
- Set hostId on room creation in createRoom() (T007)
- Expose hostId in toRoomSnapshot() (T008)
- Annotate displayName() fallback as dead code (T011a)
- Add startRoom() with double-start guard (T022, FR-111)
- Add POST /rooms/:code/start route handler (T024)
- Add api.startGame() method (T025)
- Add RoomStore.startGame() method (T026)
- Add in-flight fetch guard to fetchRoom() (T020)
- Rewrite LobbyPage: immediate mount fetch + silent polling (T017)
- Auto-navigate on status === game (T018)
- Poll error non-blocking display (T018a)
- Host detection and Start Game button (T027)
- Client-side blank name/code validation (T011, T015)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant