Building a Browser FPS with Socket.io and Three.js
After spending weeks trying to fix a broken WebSocket foundation in arena-shooter-v2, I gave up and forked Forge_FPS instead. Best decision I've made this month.
The Problem
The original project used raw WebSocket + geckos.io for WebRTC data channels. The RSV1 fix for noServer + perMessageDeflate was brittle, reconnection logic kept breaking, and position sync had drift issues that I couldn't nail down.
The Fork
Forge_FPS uses Socket.io with its built-in room system and fallback transports. The migration was straightforward:
- Clone →
npm install→node src/server/index.js - Swap the map to a custom GLB (chicken_gun_fruzer_-_encampment.glb)
- Deploy behind a Cloudflare Tunnel
Security Setup
The game runs on port 8050 locally. No ports are opened on the firewall — everything routes through Cloudflare Tunnel (outbound-only connection from the server). CF handles:
- HTTPS termination
- DDoS protection
- WebSocket proxying (Socket.io needs this to work through the tunnel)
The tunnel config looks like:
ingress:
- hostname: gaming.kamalrajnaidu.com
path: /socket*
service: http://localhost:8081
- hostname: gaming.kamalrajnaidu.com
service: http://localhost:8050
What's Next
- Map voting system
- Better spawn logic
- Scoreboard persistence