Technology Stack
C/C++, File I/O, Data Structures, Game Systems Design
Overview
Duration: 3/2021
A turn-based arena battle engine running entirely in a console. Two teams of three heroes fight; the engine resolves the match and reports the outcome with the full end-state of every combatant.
What makes it an engineering problem rather than a scripting exercise is the modifier system. A hero's effective statistics are never their base statistics — they are recomputed from three interacting sources: elemental relationships with teammates, elemental relationships with opponents, and the randomly-selected battle environment. Getting that resolution order right, and keeping it consistent, is the whole design.
The Roster
Heroes load at startup from a plain text file, one per line:
<name>;<element>;<health>;<attack>;<defense>;<attack speed>
Sniper;Fire;454;36;2;29
Troll;Earth;620;48;2.5;15
Treant Protector;Wood;700;62;1.5;38
Lanaya;Water;492;53;4;29
Naga Siren;Water;549;56;6;32The roster is editable from within the program and written back to file, so content is data rather than code — new heroes require no rebuild.
Statistics: health (zero means dead), attack (damage dealt), defense (damage resisted), and attack speed, which is the interval of one attack cycle — lower is faster. An attack resolves as attack − defense against the target, with the attacker's next action scheduled by their attack speed.
The Five-Element System
Every hero belongs to one of the five classical elements — Metal, Wood, Water, Fire, Earth — which sit in the traditional generating and overcoming cycles.

Within a team:
- A countered hero suffers a 10% increase to their attack interval — they act more slowly
- A supported hero gains 15% additional health
Against an opponent:
- A countered hero's defense drops by 50%
- The countering hero's attack rises by 10%
Environment: after both teams are selected, the engine randomly assigns one of the five elements as the battle environment, applying a further modifier layer — matching elements are unaffected, generated elements gain 5% health and 10% faster action, and overcome elements lose 3% health.
The result is that team composition matters before a single attack lands. Two heroes chosen for raw statistics can be strictly worse than two weaker heroes chosen for synergy — which is the intended design outcome.
Match Resolution
Heroes engage in pairs following the initial ordering, with each combatant acting on their own attack-speed schedule rather than in strict alternation. The winning team is the one with more survivors when the timer expires. Matches run against an NPC opponent, which selects three heroes at random, or between two players sharing the machine, with an agreed time limit.
Persistence
Every result is written to a log with a timestamp, both rosters, and the outcome:
Ti win
---
Team Ti - Team Teo
---
Treant Protector:452;62;1.5;38 - Sniper;0;36;2;29
Trasex:3;40;2;27 - Lanaya;0;53;4;29
Troll:0;48;2.5;15 - Naga Siren;0;56;6;32
Match history is browsable by timestamp, with full detail retrievable for any individual match.

An early project, and a genuinely good one for learning where complexity actually comes from in a system: not the combat loop, but keeping three overlapping modifier sources resolving consistently every time a statistic is read.