A cooperative multiplayer survival game where players work together to survive in a harsh urban environment. Built with Node.js, Socket.IO, React (Vite), and Three.js.
- Lobby-based Multiplayer: Create or join game lobbies with up to 4 players
- Real-time Synchronization: All game state is synchronized across players
- Cooperative Gameplay: Work together to survive and progress through levels
- 6 Progressive Levels: From Skid Row to The Depths, each more challenging
- Survival Mechanics: Manage health, hunger, warmth, and energy
- Procedurally Generated World: Buildings, shelters, and debris generated from seed
- Multiple Enemy Types: 6 different homeless character models
- Node.js 18+
- npm 9+
-
Install all dependencies:
npm run install-all
-
Start the server and client together (development):
npm run dev
Or start them separately:
# Terminal 1 - Server (port 3001) npm run server # Terminal 2 - Client (port 3000) npm run client
-
Open your browser:
The server binds to 0.0.0.0, allowing connections from other devices on your local network.
-
Find your local IP address:
- Windows:
ipconfig - Mac/Linux:
ifconfigorip addr
- Windows:
-
Share your IP with other players:
http://YOUR_LOCAL_IP:3000 -
Make sure your firewall allows connections on ports 3000 and 3001
-
Build the client:
npm run build
-
Start the server (will serve the built client):
npm start
-
Access at http://localhost:3001
- WASD - Move
- Mouse - Look around
- Left Click - Shoot (also locks cursor)
- Right Click + Drag - Alternative look (when pointer lock doesn't work)
- Shift - Sprint (uses energy)
- Left side of screen - Virtual joystick for movement
- Right side of screen - Swipe to look, tap to shoot
- Health: Take damage from enemies, restored by medicine
- Hunger: Decreases over time, restored by food/water
- Warmth: Decreases over time, restored by blankets
- Energy: Used for sprinting, recovers when standing still
- 🟤 Food - Restores hunger
- 🟢 Medicine - Restores health
- 🟡 Ammo - Adds ammunition
- 🟣 Blanket - Restores warmth
- 🔵 Water - Restores hunger and energy
- Skid Row - 10 kills to advance
- The Tunnels - 20 kills to advance
- Industrial Wasteland - 35 kills to advance
- The Camps - 55 kills to advance
- Downtown Ruins - 80 kills to advance
- The Depths - Final level
urban-survival-multiplayer/
├── package.json # Root package with scripts
├── server/
│ ├── index.js # Express + Socket.IO server
│ ├── lobby/
│ │ └── LobbyManager.js
│ └── game/
│ └── GameState.js # Server-side game logic
└── client/
├── package.json # Vite + React dependencies
├── vite.config.js # Vite configuration
├── index.html # Entry HTML
└── src/
├── index.jsx
├── App.jsx # Main app with socket connection
├── components/
│ ├── MainMenu.jsx
│ ├── Lobby.jsx
│ ├── Game.jsx # Three.js game renderer
│ ├── HUD.jsx
│ ├── Crosshair.jsx
│ └── GameOver.jsx
└── styles/
└── main.css
Some browsers or environments (like iframes) restrict pointer lock. The game includes a fallback: right-click and drag to look around.
- Check your firewall settings
- Ensure you're using the correct local IP
- Make sure all devices are on the same network
The game uses client-side prediction for smooth movement. If you experience issues:
- Check your network connection
- Reduce the number of players
- Close other bandwidth-intensive applications
MIT