Lightweight co-op Survivors-style slice with Phaser 3 in the browser and a tiny Socket.IO server. Gameplay knobs live in commented config files so non-technical teammates can tune balance without touching engine code.
- Install deps (root):
bun install - Start both client (Vite) and server:
bun run dev- Client dev server: http://localhost:5173
- Game server: http://localhost:3000
- In the browser, create a room or join an existing room code. Open the page in multiple tabs to test co-op.
client/– Phaser front-endsrc/config/– All balance knobs (players, enemies, weapons, waves, game settings, assets).src/entities/– Simple render wrappers for players/enemies/projectiles.src/systems/– Movement input, spawn sync, combat visuals, network helper.src/scenes/– Boot, Lobby, Game, UI overlay.src/net/– Socket.IO client glue.
server/– Socket.IO + game loop (authoritative simulation).shared/– Message types shared by client and server.
client/src/config/players.ts– Player HP, speed, damage, attack rate, starting weapon. Example: increasemoveSpeedto make players kite faster.client/src/config/enemies.ts– Enemy HP, damage, speed, spawn weight, XP value, color. Example: to make zombies faster, raisemoveSpeedonzombiefrom 70 to 90.client/src/config/weapons.ts– Cooldowns, projectile speed, lifetime, spread, and burst count. Example: lowercooldownonstraightShotfor faster firing.client/src/config/waves.ts– When waves start, how many enemies spawn, which enemy pool to use, and difficulty multipliers.client/src/config/gameSettings.ts– Arena size, FPS, max players/enemies, state broadcast frequency, auto-attack toggle.client/src/config/assets.ts– Placeholder colors/sizes if designers want a quick reskin.
Each config field has a plain-English comment with typical value ranges. These files are the safe place for non-technical edits; no code changes needed for basic balance tweaks.
- WASD/arrow keys to move.
- Auto-attacks fire using the current weapon definition.
- Enemies spawn at arena edges based on wave timing and chase the nearest player.
- Projectiles damage enemies; enemies damage players on contact.
- Server is authoritative: clients send inputs, server simulates movement/combat, then broadcasts snapshots.
- Client connects via
socket.io-client(seeclient/src/net/socketClient.ts). - Server manages rooms and simulation ticks (
server/src/server.ts,server/src/net/gameLoop.ts). - Messages are typed in
shared/net/messageTypes.tsfor both client and server.
- Add new enemies: duplicate an entry in
config/enemies.ts, then reference itsidinsideconfig/waves.ts. - Add weapons: create a new entry in
config/weapons.ts, then setweaponIdinconfig/players.ts. - Adjust pacing: tweak
spawnIntervalSecondsandspawnCountper wave; bumphpMultiplier/speedMultiplierfor ramping difficulty. - Change arena feel: edit
arenaWidth/arenaHeightingameSettings.tsand the UI will adapt.
- Assets are procedurally generated circles; designers can swap to images later by adjusting
assets.tsandBootScene. - The server runs a 30 TPS loop and broadcasts snapshots ~10 times/sec; tune
gameSettings.stateBroadcastIntervalfor bandwidth vs. smoothness.