Architecture Design and Practice for Empire Civilization Evolution Strategy Games
This article breaks down the architecture of civilization-evolution strategy games, covering the mapping between eras and capability unlocks, the coupling between the city-building loop and the army combat loop, a graph-based formalization of unit counters, a two-layer battle simulation and settlement pipeline, storage and backend design, and repeatable balance validation through large-scale automated simulation.
1. From Civilization Evolution Narrative to a Computable Model
The core difficulty of civilization-evolution war strategy gameplay is not visual presentation, but compressing the grand narrative of “a civilization advancing from ignorance to maturity” into a state model that a program can evaluate repeatedly. The original design goal of “reproducing the resource accumulation journey of a civilization’s evolution” is essentially a staged unlock problem: players do not receive all capabilities at once, but gradually gain access to new buildings, unit types, and tactical options as accumulated reserves cross successive thresholds.
The first design step is therefore to establish the mapping between civilization eras and capability unlocks. The common industry approach abstracts stages into a finite state machine, where each stage defines its entry conditions, available capability set, and upgrade cost curve.
Entry condition(stage i) = previous stage completed && cumulative core resource >= threshold(i)Available capabilities(i) = building set ∪ unit set ∪ tactic setUpgrade cost(i) = base cost × growth factor^i
The key point is that the cost curve must be monotonically increasing with a controllable growth rate. If the growth factor is too small, players clear all stages within hours and the sense of progression disappears; if it is too large, the mid-to-late game hits a hard wall and churn spikes. In practice, cost grows exponentially while output grows linearly or in segments, and the gap between the two creates pressure that “requires management” rather than despair that “cannot continue.”
2. Dual Core Loops: Coupling Progression and Combat
The skeleton of this gameplay consists of two loops that must serve as each other’s input and output; otherwise they degrade into two disconnected modules.
The first layer is the city-building progression loop: gather resources → construct and upgrade buildings → increase output and unlock caps → support higher-tier buildings. This layer answers “how many cards do I hold.”
The second layer is the legion warfare combat loop: recruit units → organize legions → simulate the battlefield → settle losses and gains → feed resources and population back. This layer answers “how do I play those cards.”
The coupling point is that the progression layer determines the available strategy space of the combat layer, while combat losses and spoils in turn reset the resource curve of the progression layer. If spoils consistently outperform self-produced income, players abandon management and simply raid, and the economy collapses; conversely, combat loses meaning. A sound approach is to make raid income slightly higher than self-produced income over the same period, but attach troop losses and recovery costs, so raiding becomes a “high-risk, high-efficiency” option rather than the only solution.
3. Formalizing Unit Design and Counter Relationships
A multi-unit system is essentially a directed graph, not a simple numeric table. Let the unit set be U and the counter relations be the edge set E; each edge carries a modifier coefficient matrix that applies to both attack and defense during combat settlement.
# Illustrative implementation: counter coefficient lookupCOUNTER = {("Heavy Infantry", "Light Cavalry"): 1.35,("Light Cavalry", "Ranged Archer"): 1.30,("Ranged Archer", "Heavy Infantry"): 1.25,}def damage(attacker, defender, base_atk, base_def):k = COUNTER.get((attacker, defender), 1.0)return max(1.0, base_atk * k - base_def * 0.5)
Three points need attention in the design. First, counters must form a closed loop so no absolutely dominant unit exists. Second, the modifier range should stay between 1.2 and 1.4; values that are too high turn matches into rock-paper-scissors. Third, counter relations should expand dynamically with civilization stages: when higher stages introduce new units, the corresponding new edges must be added at the same time so old units do not exit the game entirely.
4. Engineering the Battle Simulation and Settlement
If a grand battlefield must simulate a large number of units on screen at once, per-frame full computation is unacceptable. The general solution has two layers: the tactical layer performs discrete turn-based simulation, and the presentation layer performs interpolated rendering. The tactical layer only cares about formation, position ranges, and unit types, settling in batches per turn; the presentation layer generates the visuals of advance, collision, and rout from the settlement results and does not participate in win/loss determination.
for round in range(max_rounds):for squad in alive_squads:target = select_target(squad, enemy_squads) # based on aggro and distancesquad.hp -= damage(squad.type, target.type, ...)if formation_integrity(one side) < collapse_threshold:return rout_settlement
The collapse threshold mechanism is closer to real warfare logic than “fighting to the last unit,” and it also significantly shortens match duration. Morale or formation integrity should be introduced as an independent variable, so that a player with numerical superiority can still lose if the formation is cut apart, giving tactical choices real weight.
5. Data Structures and Backend Support
The dual progression and combat loops generate high-frequency, small-payload writes with strong consistency requirements. Typical entities include player civilization profiles, city building matrices, legion compositions, and battle report streams. A combination is recommended: relational storage for strongly consistent core data, a cache layer for hot reads, and object storage for battle reports and replay files. Asynchronous delivery of tasks and rewards can be handled by a message queue to smooth out write spikes during launch and event peaks. On the operations side, logging services and monitoring alerts continuously track metrics such as matchmaking duration, settlement failure rate, and resource output deviation.
If the simulation service is hosted on the container platform provided by Baidu AI Cloud, compute instances can scale elastically with match volume, pushing resource costs during idle periods to a low level, while general monitoring and alerting capabilities help locate settlement anomalies promptly.
6. Balance Validation and Iteration
Balance is not tuned by feel, but by repeatable experiments. It is recommended to build a headless batch simulator that uses scripts to generate virtual players with different strategy profiles, then run hundreds of thousands of matches and collect statistics on win rate distribution, stage dwell time, and unit usage rate.
Output metrics:- Correlation between unit appearance rate and win rate- Average dwell time per civilization stage- Resource curve gap between the raiding and management playstyles- Collapse threshold trigger ratio
When a unit’s win rate deviates significantly from 50% while its appearance rate rises at the same time, a design flaw exists; when dwell time in a stage shows a cliff, there is a break in the cost curve. Wiring these metrics into a continuous integration pipeline so every numeric adjustment triggers automatic regression is what keeps a long-cycle gameplay like civilization evolution stable across repeated version iterations.
