Add shared-link multiplayer mode - #10
Open
Copilot wants to merge 1 commit into
Open
Conversation
Players can now start a shared game and invite friends via a room link; everyone in the room sees the same secret word and guesses update live. - server/: small Node + ws WebSocket server that owns room state (secret word, shared guess list, connected players) in-memory - src/multiplayer/: client WebSocket helper + React hook for room state - src/components/Multiplayer/: Lobby (create room), JoinPrompt (enter name), MultiplayerGame (shared board + player list + share link), PlayerList - App.js reads a ?room= query param to switch between single-player and multiplayer views - README updated with instructions to run the multiplayer server Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a shared-link multiplayer mode: a player can start a game, share a room link, and friends who open it join the same room and play the same secret word together, with guesses syncing live for everyone.
Changes
server/: small Node +wsWebSocket server that owns room state (secret word, shared guess list, connected players) in-memory. Rooms are created lazily on first join and cleaned up 5 minutes after everyone leaves.src/multiplayer/:socketClient.js(WebSocket connection helper) anduseRoomConnection.js(React hook exposing room state + guess/reset actions).src/components/Multiplayer/:Lobby(create room button),JoinPrompt(enter display name),MultiplayerGame(shared board + player list + share link, reuses existingGuessForm/GuessResults/ResultsBanner),PlayerList.App.js: reads a?room=query param to switch between the existing single-player view and the new multiplayer view (no routing library needed, avoids SPA-fallback concerns with the Parcel dev/build setup).Design notes
GuessCellsalready computes results client-side from ananswerprop that's already visible in React state/console (console.info({ answer })in the originalGame.js), so the server is the source of truth for keeping room state in sync across clients rather than a security boundary / anti-cheat layer./is untouched; multiplayer lives behind?room=<id>.Testing
npx eslint src/— no errors.npx parcel build public/index.html— builds successfully.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com