System Architecture
Playing StarCraft II well requires managing two fundamentally different types of decisions simultaneously. At the strategic level, players must read their opponent, choose appropriate tactics, decide when to attack or defend, and adapt their overall approach as the game evolves. At the execution level, they must manage build orders, coordinate unit production, handle resource allocation, and ensure precise timing of all game actions.
These two aspects of gameplay operate at different scales and require different types of thinking. Strategic decisions happen over minutes and are based on understanding game flow, opponent tendencies, and situational opportunities. Execution decisions happen over seconds and are based on resource availability, build dependencies, and mechanical precision.
We want to build a system that masters both.
A Two-Layer System
Rather than creating a monolithic system that attempts to handle strategy and execution together, AlfredStar uses a two-layer system where each layer handles a distinct aspect of gameplay:
- Strategic Planning Layer - High-level decision making, opponent analysis, and strategic adaptation
- Game Execution Layer - Dependency resolution, build order optimization, and mechanical coordination
Each layer operates with its own abstractions, timeframes, and optimization criteria, enabling focused excellence in each domain.
Strategic components think in terms of goals and opponent models. They don't need to know that building a Stalker requires specific build timings—they express intent and receive feedback about feasibility and progress. This abstraction allows them to focus on strategic reasoning without mechanical distractions.
Execution components think in terms of dependencies and resource flows. They don't need strategic context to optimize build orders—they take target specifications and generate efficient execution plans. This focus allows them to achieve mechanical precision without strategic complexity.
The interface between layers is intentionally minimal: strategic intents flow down, execution feedback flows up. This separation enables independent development, testing, and optimization of each layer.
Strategic Planning Layer
Strategic agents operate at the conceptual level, focusing on game understanding rather than mechanical constraints. They analyze patterns, identify opportunities, and make high-level decisions: Is the opponent playing economically or aggressively? Should I pressure now or develop my economy? How should I respond to their unit composition? These agents work with abstractions that match human strategic thinking—considering economic development rather than individual Probe timings, relative military strength rather than exact supply counts.
This strategic reasoning is inherently adaptive. As games evolve and new information becomes available, strategic agents adjust their approach—shifting from aggression to defense, economy to military, or ground to air units based on opponent behavior. The strategic layer's learning extends across multiple games, but at a scale far beyond human capability.
The strategic layer is designed to improve continuously through long-term memory across multiple games. Each game contributes to a growing library of strategic knowledge that becomes increasingly sophisticated with experience. It learns various types of strategic patterns: opponent tendencies (certain players always build defensive structures when expanding early), map-specific insights (on Goldenaura's open spaces, mobile harassment units excel, while Inside and Out's narrow passages favor choke point control), and timing relationships (specific opening moves lead to predictable attack windows). Over many games, it develops sophisticated pattern recognition that informs all aspects of strategic decision-making.
This learning capability is critical for leveraging self-play training effectively. When AlfredStar plays thousands of games against itself, each strategic experiment builds upon accumulated knowledge. The system explores different approaches, learns which strategies work against which opponent behaviors, and continuously refines its strategic understanding through massive experience—creating a feedback loop where strategic intelligence grows exponentially with training.
Game Execution Layer
The execution layer transforms strategic intents into precise game actions through its routine-based system. When a strategic agent decides to "build two Stalkers," the execution layer determines that this requires Gateways, a Cybernetics Core, Pylons for power, and an Assimilator for gas. It calculates optimal timing: start the Pylon at T+0s, Gateway at T+18s, Assimilator at T+43s for just-in-time gas availability.
This layer operates with mechanical precision, tracking resource accumulation rates, monitoring build completion times, and ensuring all dependencies are satisfied before attempting production. It handles complex coordination—managing multiple build queues, parallel resource gathering, and synchronized unit production—while optimizing for efficiency.
The execution layer adapts to disruptions while maintaining strategic goals. If buildings are destroyed, it recalculates dependencies and adjusts timing. If resources are diverted to defense, it prioritizes critical operations. These mechanical adaptations happen without requiring strategic replanning.
Unlike the strategic layer, the execution layer is stateless between games. Each game starts with the same mechanical precision and optimization capabilities. This layer doesn't need to learn or remember—its value lies in consistent, optimal execution of whatever strategic goals are provided. Whether executing an economic build, an aggressive rush, or a defensive strategy, the execution layer delivers the same mechanical precision and optimal timing, agnostic to the strategic content it implements.
With these distinct but complementary layers established, the critical question becomes how they coordinate during gameplay.
Communication Between Layers
The interface between strategic planning and execution is deliberately simple. Strategic agents communicate through desired states rather than specific commands—they express what they want to achieve rather than how to achieve it. The execution layer determines how to achieve these goals given current constraints and provides continuous feedback about progress.
Feedback flows continuously between layers. Strategic agents receive information about execution progress, resource availability, and unit readiness. The execution layer receives updated goals and priorities as strategic thinking evolves. This dialogue enables responsive gameplay that adapts to changing conditions while maintaining both strategic coherence and mechanical precision.
For example, when the strategic layer decides "prepare for an aggressive push," it might submit: "Build 6 Stalkers, 2 Sentries, 1 Warp Prism by T+300s." The execution layer begins production with current capacity and reports progress: "Starting Stalker production, estimated completion T+380s with current single Gateway." The strategic layer, seeing the timeline, decides: "Too slow for the timing attack—build additional Gateway." The execution layer then updates: "Second Gateway under construction, revised unit completion T+320s."
Foundation for Intelligent Gameplay
This architecture enables the kind of gameplay described in our design principles—strategic depth that observers can appreciate, combined with mechanical precision that achieves optimal performance. The strategic layer focuses on making intelligent decisions that human observers can understand and learn from, while the execution layer ensures these decisions are implemented with superhuman efficiency.