Both titles utilize a shared C++ architecture. Unit behaviors and game logic are managed by a centralized AI() function.
This algorithm calculates a straight-line path and only recalculates when an impassable obstacle is encountered.
It's like driving straight until you hit a wall, then finding a new path.
Units, buildings, and players are categorized into 'Houses' to determine available actions and rules.
These missions range from resource harvesting to tactical ambushes. Units can also override missions to destroy path-blocking obstacles.
It governs base management and strategy. Prioritization is based on economic viability, power consumption, and cash reserves.
These 'fear states' cause units to become unresponsive or flee. This behavior is based on health loss and unit class thresholds.
This analysis examines the artificial intelligence architecture of the original Command & Conquer (Tiberian Dawn) and Red Alert by reviewing the source code released alongside the 2020 Command & Conquer Remastered Collection. The primary objective is to demystify the foundational AI systems that defined the real-time strategy (RTS) genre, focusing on how these titles balanced unit-level micro-management with high-level strategic decision-making.
The AI architecture is built on C++ and utilizes an object-oriented approach where units and buildings execute an update function every frame. Pathfinding is handled via a lightweight "Crash and Turn" algorithm, which avoids the high CPU costs of traditional A pathfinding by calculating straight-line paths and adjusting only when encountering obstacles. Strategic coordination is managed through a "House" system, where computer-controlled players operate within five distinct states—Build Up, Broke, Threatened, Attacked, and Endgame—to prioritize resource management and base construction. While the AI bypasses the fog of war to maintain competitive pressure, it generally adheres to the same economic rules as human players, scaling its army size based on the average strength of its opponents.
Red Alert introduced refinements to this core framework, most notably through an "IQ" system that gates access to advanced units and superweapons based on performance thresholds. It also expanded infantry behavior by incorporating "fear states," which cause units to become unresponsive or erratic under duress, and introduced a "QMOVE" command to allow for queued movement orders. These findings highlight how early RTS developers utilized state-driven logic and clever performance optimizations to create challenging, reactive opponents within the technical constraints of the mid-1990s.