Bash.tv → GitHub → itch.io

Real-time strategy games for the browser. Unit selection (click, drag box, groups), commands (move, attack, attack-move, gather, build), group movement with flow fields and separation, formations, resource gathering and economy, buildings and production queues, fog of war, simple enemy AI with build orders and attack waves, minimap, camera panning and zoom, performance with hundreds of units, t...

Download skill (.zip) Files on GitHub

RTS development

Core: gather, build, command armies, outmaneuver the enemy in real time. Keep the first version small: 2 resources at most, 3–4 unit types, 3–4 buildings, one map.

Starter template

A playable starter for the game-scaffolding template is in assets/starter/. Workers gather crystals, a base trains workers and soldiers, plus tap or drag-box selection, move, attack and attack-move orders, separation so units don’t stack, auto-engage, and an AI that builds and attacks in growing waves.

python3 <game-scaffolding>/scripts/scaffold.py my-game --title "My Game" --starter <this skill>/assets/starter

Controls: Drag to select, tap ground to move, tap red to attack, tap crystals to gather. Keys: Q worker, W soldier, A select army. Esc pauses. All numbers to tune are in src/config.js; the gameplay is in src/scenes/play.js. Gathering, training, box select and attacks were tested over 30+ seconds of play.

Structure

Systems over entities (game-architecture light ECS fits): selection, commands, movement, combat, gathering, production, fog, AI player. All rules in data (data/units.json).

Growing the starter (tested modules)

  1. Selection: click, drag box (screen → world via camera-system toWorld), shift-add, control groups (1–9).
  2. Movement: one flowField per move target, shared by the group (pathfinding); steer.separate so units spread (enemy-ai); arrival: units stop in a loose blob around the target (offset targets per unit).
  3. Combat: attack-move = move but engage enemies in range (spatial grid queries); dealDamage with armor (combat-system).
  4. Economy: workers loop gather → return → deposit; Wallet (game-economy); production queues with build times.
  5. Fog of war: a low-res visibility grid updated from unit sight radii every 0.2 s; draw as a dark overlay; enemies hidden in fog.
  6. AI: a scripted build order + attack waves at timed intervals, scaled by difficulty; scout and retarget when attacked.

Performance

Hundreds of units: spatial grid for neighbors and targets, staggered AI and targeting (every 0.1–0.3 s per unit), pooled projectiles, instanced rendering (Pixi / Phaser / three.js InstancedMesh), and a fixed simulation step.

Controls

Desktop: left-click select, right-click command, drag box, edge/WASD pan, wheel zoom, hotkeys. Touch: tap select, drag on empty ground = box select (or a “select” mode button), tap ground = move, tap enemy = attack, two-finger drag pan, pinch zoom.

Pitfalls

Scope explosion, units jamming in chokepoints (separation + flow fields), unreadable selection (outline + health bars), micro that phones can’t do (simplify commands), and AI that can see through fog (play fair or be obvious about it).