Build an online multiplayer game like State.io – Conquer the World (Web)Prompt (English, for best results):Build a clean, minimal online multiplayer version of the popular mobile game “State.io – Conquer the World”, for web browsers.The game should work on desktop and mobile.Core requirements:The gameplay must closely match the real State.io game: players each control regions on a map, can send units (troops) from their regions to attack or reinforce other regions, and conquer neutral or enemy territory by reducing their units to zero.Online multiplayer: Players can join the same game room via a link or lobby. Multiple human players must be able to play against each other in real time, not just against bots.Regions produce units over time (e.g., +1 unit per second, capped to 50 per region). Units are shown as numbers inside each region.When a player selects their region and then an adjacent region, all (or a chosen number) of units are sent as separate animated projectiles ("dots" or "balls") from source to target. Each unit projectile decreases the target’s count by one on arrival.If the target’s unit count reaches zero, it is captured and switches to the attacker’s color, starting at 1 unit.Each region is colored according to its owner (player, bot, neutral).The map can be simple (e.g., 4-16 rectangles or states), but regions should be adjacent and connections respected.Players should see each other's moves in real time (state synchronized).Game should be fully playable with mouse (desktop) or touch (mobile), no keyboard required.A minimal lobby or “join by code” feature to start new games with friends.Technical preferences:Use React (or Next.js) for the frontend.Use a simple Node.js backend (e.g., with Socket.io or websockets) to synchronize game state between players.Do not add any extra features, ads, logins, coins, upgrades, or powerups – just core online multiplayer gameplay as described.UI can be minimal and functional; focus on multiplayer mechanics and clean code.Bonus (optional):Allow spectators to watch ongoing games.Support bots if there are not enough players.Keep code modular and well-commented.
I'll build a clean, minimal online multiplayer version of State.io for web browsers. This will include real-time multiplayer gameplay, territory conquest mechanics, and animated unit movement.
I've built a complete online multiplayer State.io game with the following features:
To run the multiplayer functionality, you'll need to start the WebSocket server by running the Node.js script in the /scripts folder. The game includes proper error handling for when the server isn't running.
To configure the generation, complete these steps:
I see the issue! The WebSocket server script needs to be properly set up and running. Let me fix this by creating a proper server setup and providing clear instructions.
Now you have two ways to play the game:
Click "Play Offline (Practice)" to play immediately against a bot opponent. This works without any server setup and lets you test the core gameplay mechanics.
To enable full multiplayer functionality:
ws WebSocket libraryThe offline mode includes:
The server setup is now more robust with better error handling, connection management, and graceful shutdown. Once you get the WebSocket server running, you'll have full real-time multiplayer functionality!
To configure the generation, complete these steps: