A realistic multiplayer flight simulator built with Next.js 16, Babylon.js 7, and Socket.io.
- Realistic A320 Physics: Lift, drag, thrust, and aerodynamic calculations
- Procedural 3D Models: Detailed A320 aircraft and airport built with code
- Interactive Controls: Full flight controls (throttle, elevator, rudder, aileron, flaps, gear)
- Multiplayer Lobby: Create/join rooms, chat with players, real-time updates
- Real-time Multiplayer: See other players' planes flying in the same world
- Modern UI: HUD with speed, altitude, heading, fuel, and more
- Node.js v22+
- pnpm
pnpm installYou need to run both the server and client:
Terminal 1 - Server:
pnpm run dev:serverTerminal 2 - Client:
pnpm devOpen http://localhost:3000 in your browser.
The game features a full multiplayer lobby system:
- Create Room: Start your own room with optional password
- Join Room: Enter room ID to join existing rooms
- Real-time Chat: Chat with other players in the room
- Player Ready System: Mark yourself as ready to start
- Auto-refresh: Room list updates automatically
The game includes real-time position and rotation synchronization:
- Position Sync: See other players' planes in real-time
- Interpolation: Smooth movement between updates (50ms rate)
- Color Coding: Each player has a unique color
- Player Names: Display player nicknames in-game
This project uses procedural 3D models - no external downloads needed!
- Airbus A320: Detailed aircraft with fuselage, wings, engines, landing gear, cockpit windows
- Airport: Runway (4km), taxiways, apron, terminal buildings, control tower, lights, and signs
You can still add custom .glb models to public/models/ if you want:
a320.glb- Custom aircraft modelrunway.glb- Custom airport model
| Key | Action |
|---|---|
| W/S | Throttle (Increase/Decrease) |
| ↑/↓ | Elevator (Pitch Up/Down) |
| ←/→ | Rudder (Yaw Left/Right) |
| A/D | Aileron (Roll Left/Right) |
| F | Flaps (Toggle) |
| G | Landing Gear (Toggle) |
| Space | Brake |
flight-sim/
├── app/
│ ├── page.tsx # Landing page
│ ├── game/
│ │ └── page.tsx # Game canvas
│ └── lobby/
│ └── page.tsx # Multiplayer lobby
├── components/
│ ├── BabylonScene.tsx # 3D scene wrapper + multiplayer sync
│ └── UI/
│ └── HUD.tsx # Heads-up display
├── lib/
│ ├── babylon/
│ │ ├── engine.ts # Babylon.js setup
│ │ ├── physics.ts # A320 flight physics
│ │ ├── plane.ts # Procedural A320 model
│ │ ├── airport.ts # Procedural airport
│ │ └── multiplayer.ts # Multiplayer plane meshes + sync
│ └── socket.ts # Socket.io client hook
├── server/
│ └── src/
│ ├── index.ts # Express + Socket.io server
│ ├── game/
│ │ └── GameManager.ts # Game state management
│ └── socket/
│ └── handlers.ts # Socket event handlers
└── public/
└── models/ # Custom .glb models (optional)
The A320 physics simulation includes:
- Aerodynamics: Lift coefficient based on angle of attack, drag from flaps and gear
- Engine: Thrust calculation with fuel consumption
- Flight Dynamics: Pitch, roll, and yaw rates
- Ground Interaction: Collision detection with ground
| Parameter | Value |
|---|---|
| Mass | 78,000 kg |
| Wing Area | 122.4 m² |
| Max Thrust | 2 × 120 kN |
| Takeoff Speed | ~250 km/h |
| Landing Speed | ~220 km/h |
- A320 procedural model
- Airport procedural model
- Realistic physics
- Socket.io multiplayer
- Lobby system
- Game state synchronization
- Player profiles & statistics
- Custom model support
- Voice chat
MIT