Add real-time multiplayer support#52
Open
victorgalvez56 wants to merge 1 commit intobrunosimon:masterfrom
Open
Add real-time multiplayer support#52victorgalvez56 wants to merge 1 commit intobrunosimon:masterfrom
victorgalvez56 wants to merge 1 commit intobrunosimon:masterfrom
Conversation
Transform the single-player folio into a multiplayer racing game using Socket.IO and a lightweight Node.js server. Multiple visitors can see and interact with each other's cars in the same scene. Architecture: - client/ ← Original folio restructured as Vite project - server/ ← Node.js + Socket.IO + CANNON.js physics - shared/ ← Constants for physics, network, spawn grid, colors Features: - Lobby UI: name, car color (8 matcap options), car type (default/cybertruck) - Remote car rendering with GLTF template cloning and per-player colors - Client-authoritative physics snapshots at 20Hz with interpolation - Bumper-car collisions with impulse relay and camera shake - In-game chat with Enter/Escape shortcuts and unread badge - Minimap showing all player positions and track outline - Race track with CatmullRom curves, matcap barriers, asphalt surface - World-space checkered floor shader - Grid spawn positions on the start straight - Player name labels above each car
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 real-time multiplayer to the folio using Socket.IO and a Node.js server. Multiple visitors can see and interact with each other's cars in the same scene.
Architecture
The original single-player code is preserved in
client/with multiplayer additions layered on top.Live demo
https://racing.victorgalvez.dev
Test plan
npm installat root +cd server && npm installnode server/src/index.jsnpm run dev --prefix client