A procedural open world multiplayer game built with Three.js, PeerPigeon and PigeonMatch.
PigeonWorld is a browser-based, peer-to-peer multiplayer 3D open world game featuring:
- ๐ 3D Procedural World - Infinite terrain with height variation and biomes (water, grass, forest, mountains, etc.)
- ๐จ Three.js Rendering - WebGL-powered 3D graphics with lighting and shadows
- ๐ฎ P2P Multiplayer - Connect with other players through WebRTC mesh networking
- ๐ Decentralized - No central game server required, powered by PeerPigeon
- ๐ฏ Matchmaking - Find and join other players using PigeonMatch
- โก Real-time Sync - Player positions synchronized across the peer network
- WebGL rendering via Three.js
- PerspectiveCamera with third-person view
- Dynamic lighting with shadows
- PBR materials (Physically Based Rendering)
- Sky dome with atmospheric fog
- Procedural 3D terrain using fractal noise algorithms
- Multiple biomes with height variation: Water, Sand, Grass, Forest, Mountain, Snow
- Chunk-based rendering for optimal performance
- 3D entities (trees as cones, rocks as boxes)
- Vertex-colored terrain meshes
- True peer-to-peer networking with PeerPigeon mesh
- Automatic peer discovery and connection management
- Player state synchronization in 3D space
- Support for up to 100 players per world instance
Remote peers use the RobotExpressive model (CC0 1.0).
- Source: https://github.com/mrdoob/three.js/tree/master/examples/models/gltf/RobotExpressive
- Credits (per upstream README): Model by Tomรกs Laulhรฉ (Quaternius), modifications by Don McCurdy
You can override the peer model by adding a binary glTF file at public/models/peer.glb.
- Explore an infinite procedural 3D world
- See other players in real-time as 3D avatars
- Smooth third-person camera following
- Terrain collision detection with height adaptation
- Node.js (v18 or higher)
- A modern web browser with WebRTC support
- Clone the repository:
git clone https://github.com/PeerPigeon/PigeonWorld.git
cd PigeonWorld- Install dependencies:
npm install- Start the development server:
npm run dev- Open your browser to the URL shown (typically
http://localhost:5173)
npm run buildThe built files will be in the dist directory.
- W/A/S/D or Arrow Keys - Move player
- Space - Jump/Interact (future feature)
- E - Gather resources (future feature)
- Tab - Show/Hide players (future feature)
-
WorldGenerator (
src/world/WorldGenerator.js)- Generates procedural terrain using noise algorithms
- Creates biomes and places entities
- Manages chunk generation
-
NetworkManager (
src/network/NetworkManager.js)- Handles PeerPigeon mesh network initialization
- Manages PigeonMatch matchmaking
- Synchronizes player state across peers
-
GameEngine (
src/game/GameEngine.js)- Main game loop and rendering
- Player movement and physics
- Camera management
- UI updates
- Three.js - 3D WebGL rendering engine
- PeerPigeon - WebRTC-based P2P mesh networking
- PigeonMatch - Matchmaking and collaboration engine
- Vite - Build tool and dev server
PigeonWorld uses a decentralized architecture:
- Players connect to a signaling server (
wss://pigeonhub.fly.dev) for initial peer discovery - WebRTC connections are established directly between peers
- PeerPigeon manages the mesh network topology
- PigeonMatch handles matchmaking and session management
- Player state is synchronized via gossip protocol
If network connection fails, the game continues in offline mode where you can still explore the procedural world.
PigeonWorld/
โโโ src/
โ โโโ game/
โ โ โโโ GameEngine.js # Main game engine
โ โโโ network/
โ โ โโโ NetworkManager.js # P2P networking
โ โโโ world/
โ โ โโโ WorldGenerator.js # Procedural generation
โ โโโ index.js # Application entry point
โโโ index.html # Main HTML file
โโโ package.json
โโโ README.md
To add new features:
- New Game Mechanics - Extend
GameEngine.js - World Features - Modify
WorldGenerator.js - Network Events - Add handlers in
NetworkManager.js
To test multiplayer locally:
- Start the dev server
- Open multiple browser windows/tabs
- Each instance will connect as a separate peer
- Players should see each other in the world
- Check browser console for errors
- Ensure WebRTC is supported in your browser
- Try a different browser (Chrome/Firefox recommended)
- Check if firewall is blocking WebRTC connections
- Reduce view distance in
GameEngine.js - Clear chunk cache if memory usage is high
- Close unnecessary browser tabs
- Inventory system
- Resource gathering
- Building mechanics
- Chat system
- Minimap
- Day/night cycle
- Mob AI
- Crafting system
- Persistent world state
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details
- PeerPigeon - For providing the P2P mesh networking foundation
- PigeonMatch - For matchmaking capabilities
- PigeonHub - For signaling server infrastructure