A browser-accessible matchmaking system powered by a C++ DSA engine.
Open in browser: https://your-app.onrender.com
Multiple users can join simultaneously and get matched in real-time!
Browser ─────WebSocket────▶ Node.js Bridge ────stdin/stdout────▶ C++ Engine
(HTML/JS) (server.js) (matchmaking_engine.cpp)
│ │ │
│ Send: JOIN, QUEUE │ Spawn & manage │ AVL Tree
│ Recv: MATCHED, QUEUED │ Route messages │ Hash Table
│ │ │ Queue
▼ ▼ ▼
Key Points:
- All matchmaking logic runs in C++ (preserved DSA)
- Node.js only routes messages (no game logic)
- Browser connects via WebSocket
- Single container deployment on Render.com
cd backend-cpp
g++ -std=c++11 -O2 -o engine matchmaking_engine.cppcd bridge
npm installnode server.jsGo to: http://localhost:3000
- Push code to GitHub
- Go to render.com → New → Blueprint
- Connect your repository
- Render auto-detects
render.yamland deploys
- Go to Render → New → Web Service
- Connect GitHub repo
- Settings:
- Runtime: Docker
- Dockerfile Path:
./Dockerfile
- Deploy
Your public URL will be: https://matchmaking-arena.onrender.com
/backend-cpp/
matchmaking_engine.cpp # C++ stdin/stdout server
/ds/ # Data structures (AVL, Hash, Queue, List)
/models/ # Player, Match models
/services/ # Matchmaker, Ranking, History
/bridge/
server.js # Node.js WebSocket bridge
package.json # Node dependencies
/public/
index.html # Browser UI
Dockerfile # Container build
render.yaml # Render.com config
{"cmd":"JOIN","username":"Ahmed","elo":1200}
{"cmd":"QUEUE","playerId":1,"game":"pingpong"}
{"cmd":"LEAVE","playerId":1}
{"cmd":"STATUS","playerId":1}{"type":"CONNECTED","clientId":"ws-1-1234567890"}
{"type":"OK","playerId":1}
{"type":"QUEUED","position":2}
{"type":"MATCHED","matchId":5,"opponent":"BOT_3","opponentElo":1150}| Data Structure | Purpose | Complexity |
|---|---|---|
| AVL Tree | ELO-based closest opponent matching | O(log n) |
| Hash Table | Player storage by ID | O(1) average |
| Queue | FIFO matchmaking lobby per game | O(1) |
| LinkedList | Match history, hash collision chains | O(1) append |
- 🏓 Ping Pong
- 🐍 Snake Battle
- 🎯 Tank Wars
Academic project for educational purposes.