A lightweight realtime 2D multiplayer shooter built using vanilla JavaScript, Node.js, and WebSockets.
- Clone the repo:
git clone <repo-url>
cd Shooter.io- Start the server:
cd server
npm install
nodemon index.js- Start the client:
- Open the
clientfolder in VS Code - Right‑click
index.html→ Open with Live Server
Your game is ready.
- Multiplayer support using WebSockets
- CPU bot with A tracking* and obstacle-aware pathfinding
- Custom collision detection (players, bullets, obstacles)
- Lightweight OOP architecture for players, bullets, AI, and map
- Low-latency updates with a server‑authoritative game loop
- JavaScript (Vanilla)
- Node.js + ws
- HTML5 Canvas
- It's a client side authorative game
- All validation happens on client-side ( in future it would be migrated to server-side authorization)
- server manages socket connection and brodcasting updated events to other clients
- Map is converted into a grid.
- Bot computes shortest path to the player.
- Recalculates when obstacles or player movement change.
- Moves smoothly along generated path.
-
Open multiple browser tabs
-
Each tab becomes a new player connected to the server
-
CPU bot tracks closest human player dynamically
-
Sample Video of how the 2d shooter game looks
-
screen-capture.1.webm
MIT