Today is a major milestone for A Space Story. I am incredibly excited to announce that the very first steps in building a fully fledged Campaign Mode have been taken! While we are still laying the foundational columns of progression, state serialization, and custom narrative nodes, the underpinnings of our galactic narrative are officially in place.
To support this next era of development, I also bumped our game engine version to v0.1.1n, marking the beginning of our quest to bring a structured, engaging narrative campaign to life in high-performance WebAssembly.
Intelligent, Coordinated Squad AI in Raid Mode
A great campaign requires formidable opposition. To ensure combat feels like an engaging tactical challenge rather than a repetitive chore, I have completely overhauled the opposing enemy AI in Raid Mode. Previously, units wandered individually and suffered from a target-chase conflict that caused them to oscillate in place. Today, that has been completely eliminated in favour of a state-driven, cooperative AI system.
Key Enhancements to Our Enemy AI:
- State-Driven Behaviour Commitment: Units are now governed by a clean, robust AI state machine (
idle,patrolling,returning_to_anchor,chasing,capturing_tower, andguarding_area). By forcing commitment to a returning state when dragged away, the frame-by-frame target oscillation bug is fully resolved. - Cohesive Squad Formations: Enemies now spawn as structured, assigned squads. Squad grunts, marksmen, and medics maintain tight formations close to their squad leader (within 1.5 to 2.5 tiles) when patrolling or guarding, rather than dispersing individually.
- Dynamic Leadership Promotion: If a squad leader falls in battle, a surviving teammate is dynamically promoted to leader to ensure the squad retains full offensive and tactical coordination.
- Information-Sharing Radio Alarms: Spotted a player or attacked an enemy? A squad-wide and local Radio Alarm is instantly triggered, broadcasting the player's last known visual coordinates to all squad members and nearby allies within a 25-tile radius.
- Active Tower Contestation: Squad leaders will now actively target player-controlled and neutral Defence and Relay Towers for capture and recapture, followed by coordinated guarding patterns to secure the perimeter.
Robust WASM Compilation
All of these complex spatial behaviours, steering blends, and information-sharing networks have been written in pure, idiomatic Zig. By avoiding heap allocations and using stable static buffers, the new AI runs with near-zero runtime overhead. The compiled WASM binary is featherlight, and the test suite reports absolute success across all modules.
The groundwork is laid, the AI is ready for combat, and the path to a grand space campaign is finally opening up. Stay tuned, Commanders!