← all games
goblin-stampede-gpt-6-unknown — GAME.md
# Goblin Stampede — game architecture
Status: autonomous implementation complete. Five missions have driven victories; captain defeat is reachable.
## Scenes and transitions
TitleScene owns an animated camp and Continue, New Raid, Almanac and Settings. New Raid resets campaign
progress and enters CampaignScene. Continue restores the available missions and loadout.
CampaignScene owns mission selection, a separate equipment page and Fizz's optional dialogue request.
PlayScene assembles one mission and pushes PauseScene. PlayFlow replaces play with ResultScene after
victory or defeat. ResultScene counts score, kills, rescues and demolitions, grants equipment after a
win, and returns to camp or replays the mission. Completing mission five displays the campaign ending.
PauseScene pauses play below it and supports resume, restart, settings, almanac and camp.
SettingsScene and AlmanacScene are paused overlays. Explicit erase clears campaign and discovery and
returns to a fresh title. BaseMenuScene hides and restores its DOM panel around nested overlays.
## Entities and components
| Owner | Responsibility |
| --- | --- |
| ArmyEntity | Pure BattleModel, ProcessComponent, Abilities and BattleController |
| BattleController | Fixed-step simulation, typed CombatEvent emission, Inspector `battle` getter |
| ArmyInput | Convert input into movement, aim, commands and pause |
| MissionProgress | QuestLog counters for two rescues and two demolitions |
| PlayFlow | Observe win/loss events and perform the delayed result transition |
| ActorEntity / ActorView | Transform, kinematic sensor, sprite animation, ground shadow and ruins for one unit |
| BattleView | Reconcile actors/projectiles; draw warnings; respond to combat events with sound and effects |
| BombVisual / Explosion / Rubble / Burst / FloatingWord | One short-lived projectile or feedback effect, with owned cleanup |
| WorldEntity | Bake terrain into a render target and populate animated scenery |
| Camp | Animate the title/menu crowd around a goblin hut |
| CameraEntity | Smoothed, bounded captain follow at 0.92 zoom |
| Hud / HudView | Engine UI title plus DOM health, objective, cooldown, minimap and pause controls |
| MenuEntity / MenuPanel | Shared pointer, keyboard and gamepad focus; screen layout and action dispatch |
| VirtualControls | Floating touch movement stick; DOM buttons invoke the same abilities |
Feature folders separate army integration, pure combat, campaign data, menus, presentation, audio and
world dressing. Scene classes assemble those features. Direct references issue commands; typed entity
events report facts. BattleModel has no renderer dependency and uses the headless steering API for
arrival and separation. Its ally and enemy methods are kept together because they share unit state;
actors never decide damage or victory.
## Combat and engine coverage
The captain moves directly. Followers attack nearby targets, return toward Grub and respond to charge
and rally. Torches fight in melee, bombers throw dynamite, and barrel riders explode during charges.
Rally heals followers and shields allied health. Rescues add three visible fighters and restore health.
Enemy attack windups and bomb landing circles give the player time to dodge. Powder chains once,
buildings become ruins and stop blocking movement, and enemy reinforcements discourage idling.
Abilities schedules captain commands; the pure model owns their cooldowns and troop attacks.
Physics provides kinematic sensor representations and radius queries for production blasts. The pure
model owns movement, knockback and building separation; debris is visual. Inventory validates owned
items and equipment slots. DialogueRunner drives Fizz's conversation and QuestLog tracks the request.
Interaction provides rescue-hut range checks alongside automatic proximity recruitment.
Renderer, particles, lighting, scoped bloom, feel hitstop, audio and synth provide feedback.
Menus use DOM layout; @yagejs/ui supplies the small screen-space title. Optional pathfinding is unused.
## Controls and rendering
Move with WASD/arrows/left stick; charge Space/A/left click; rally Q/X; demolish E/B/right click;
pause Escape/Start. Mouse aiming is available with auto aim disabled; right-stick aiming overrides it.
Touch movement and action buttons are visible automatically on coarse-pointer devices.
Menus use directional input, confirm, cancel and mouse hover through one focus index.
Virtual view: 1280 by 720, letterboxed. Layers: ground -20, shadows -10, world 0 with y-sort,
projectiles 10, effects 20, UI 1000. Night raids use ambient dimming and local lights.
Bloom is limited to explosion sprites. Camera shake, hitstop and flashes respect settings.
Menus animate their entrance; the camp stays alive behind title and result panels.
## Assets and saves
Tiny Swords by Pixel Frog supplies troops, buildings, terrain and explosions. Kenney supplies particles
and sound effects; HydroGene supplies music; Not Jam supplies the 16px pixel fonts. Text is ASCII, with
font sizes at integer multiples of 16 in virtual coordinates. Asset paths start with `assets/` and work
beneath a URL subpath. Asset credits accompany the copied files. Almanac portraits crop existing art.
At boot, @yagejs/save restores and binds three documents in namespace `goblin-stampede-v1`:
- campaign: started, unlocked mission, completed IDs, owned/equipped item IDs, best scores, optional request.
- settings: music/SFX/UI volume, shake, hitstop, flashes, damage assist, auto aim and touch preference.
- discovery: seen IDs, encounter counts, kills, rescued crews, wins, losses, best score and elapsed seconds.
New Raid preserves discovery and settings. Explicit erase resets campaign and discovery.
## Scope choices
Raids favor quick action. The automated driver completes them in 33-75 simulated seconds; the original
3-5 minute pacing target is not a verified human duration. Spoils are score and post-raid equipment
rewards, without a separate ground-pickup economy. Powder Run contributes arcing explosives, fuses,
barrel charges and chain demolition. There is no separately aimed rolling-barrel weapon, pathfinding,
unit selection, procedural campaign, voiced dialogue or physics-driven debris.