Overview
A lightweight multiplayer-like prototype experimenting with real-time synchronization.
A lightweight multiplayer-like prototype experimenting with concurrency, real-time synchronization, and persistence. Players explore a map, discover wild Pokecats, and catch them before they disappear.
The project was designed to explore the challenges of real-time game state management in a web environment.
The problem
Real-time games need to handle concurrent actions and race conditions.
Real-time games need to handle concurrent player actions, race conditions, and state synchronization without duplicating caught Pokecats.
- Multiple players attempting to catch the same Pokecat simultaneously creates race conditions.
- State synchronization must be fast enough to feel responsive while remaining consistent.
- Pokecats must disappear for all players once caught, requiring real-time broadcast.
Approach
Monorepo architecture with lock/queue mechanisms for concurrent catches.
Built a monorepo with separate backend (Express + Socket.IO), frontend (React + Leaflet), and data service (Go + MongoDB). Introduced lock/queue mechanisms to handle concurrent catches.
Each service was designed to handle a specific concern, allowing independent scaling and development.
Solution
Three-app architecture separating spawning, data, and rendering concerns.
Separated concerns across three apps. Backend handles spawning and real-time broadcasts. Go service provides Pokecat data via REST. Frontend renders the map and catches via React Leaflet.
Lock mechanisms ensure only one player can catch each Pokecat, with immediate broadcast to all connected clients.
Implementation
Technical implementation.
The monorepo structure allowed each service to use the best tool for its specific responsibility while maintaining a unified development experience.
Frontend
React 19 + Vite + TypeScript + SCSS, React Leaflet for map rendering.
Backend
Express + Socket.IO for real-time communication and Pokecat spawning logic.
Data Service
Go + MongoDB for Pokecat data persistence and REST API.
Results
What changed.
The project successfully demonstrated real-time game mechanics with proper concurrency handling and a playable demo.
Links