
The Challenge
Develop a real-time strategy game with intelligent enemy AI, building systems, and complex unit management. The AI needed to prioritize resources, defense, and offense across a multi-layer decision system while maintaining 60+ FPS performance with hundreds of active agents, real-time combat, and live player commands.
What I Built
I engineered the full RTS gameplay: a 6-layer behavior tree AI for strategic decision-making, a modular unit architecture using the state pattern, responsive player controls with drag-select and context-sensitive commands, adaptive enemy logic balancing resources and combat, and the complete RTS loop including building systems, NavMesh pathfinding, UI integration, and real-time unit production.
Watch it in action
Technical Contributions
1. Multi-Layer Behavior Tree Architecture with Strategic AI
Problem:
Build an enemy AI capable of managing defense, economy, production, and unit allocation simultaneously without decision conflicts, while adapting to player behavior.
Solution:
Implemented a 6-layer hierarchical behavior tree with 20+ node types handling everything from global strategy to individual unit actions.
Result:
AI manages 15+ collectors, 700+ walls, and multiple factories while reacting dynamically to pressure, resources, and player attacks.
2. Advanced State Pattern for Unit Behaviors
Problem:
Support many unit types (mobile and stationary) with complex behaviors that switch states cleanly while scaling past 100+ active units.
Solution:
Built an inheritance-friendly state pattern, with shared abstract classes and clean state transitions including NavMesh actions.
Result:
Reduced code duplication by 70%, enabling new unit types with minimal overhead and fully modular behaviors.
3. RTS Player Control System
Problem:
Implement intuitive RTS controls: drag-selection, multi-select, and context-sensitive commands that react differently depending on target type.
Solution:
Built a full interaction stack with click filtering, selection box logic, and smart command interpretation (move, gather, attack).
Result:
Supports single-select, multi-select, drag-box, and smart right-click actions that automatically infer user intent.
4. Building System with Grid-Based Placement
Problem:
Allow players to place buildings with real-time feedback, grid snapping, rotation controls, and NavMesh-safe placement.
Solution:
Implemented a live preview system with grid snapping, rotation, and click-to-confirm placement.
Result:
Grid-snapped, responsive building with real-time rotation and safe pathfinding integration.
5. Modular Behavior Tree Framework
Problem:
Needed a flexible, reusable AI framework to support multiple node types without rewriting core logic.
Solution:
Created a full Behavior Tree framework with abstract Node classes, Condition/Action/Decorator types, and parent–child relationships.
Result:
Easily extended with new node types and logic branches, powering the RTS’s full strategic AI system.
Results & Impact
6-layer behavior tree making 20+ strategic decisions per frame.
Architecture supporting unlimited unit types with ~70% code reuse.
Stable 60+ FPS with 100+ active units and complex real-time AI.
Cross-system coordination (AI, units, buildings, controls) achieved through modular patterns.
Clean architecture with proper inheritance, disciplined singletons, and separation of concerns.








