A high-performance, large-scale real-time strategy (RTS) battle simulator built in Unity using Data-Oriented design principles. Simulate tens of thousands of autonomous agents at playable frame rates by leveraging DOTS, parallelism, and custom pathfinding and scheduling optimizations.
-
Massive Scale Run battles with 100K+ units on desktop and 30K+ on laptop hardware without dropping below 30 FPS.
-
Data-Oriented Architecture (DOTS) Entities & Component System (ECS) for cache-friendly memory layouts.
-
Multithreading & Burst C# Job System schedules workloads across all CPU cores; Burst compiler transforms hot code paths into highly optimized native SIMD instructions.
-
Flow-Field Pathfinding Precompute a global vector field guiding all units toward goals in O(G + N) time, replacing per-unit A* queries.
-
Grid-Based Spatial Partitioning Divide the map into discrete cells to localize collision checks and enemy searches, dramatically reducing per-unit query costs.
-
Staggered Updates Spread AI, targeting, movement, and attack logic over multiple frames to smooth CPU usage and eliminate frame-time spikes.
-
Off-Screen Entity Culling Throttle or skip expensive logic (projectile simulation, AI updates) for entities outside the camera frustum.
-
Unity: 6.0 or later
-
Packages:
- Entities
- Burst
- Jobs
-
Clone this repository:
git clone https://github.com/Sh1co/Unity-DOTS-Battle-Simulator.git
-
Open the project in Unity Hub.
-
Set the unit counts in the AllyStart and EnemyStart gameObjects
-
Press Play in the Editor.
Benchmarks on a high-end desktop (i9-14900KF, RTX 4090) sustain > 30 FPS with 134 000 agents, compared to ~ 4 200 agents in the naïve implementation. On a laptop (i7-9750H, GTX 1660 Ti), the optimized build holds ~ 30 FPS at 38 000 agents.
- Fork the repo
- Create a feature branch (
git checkout -b feature/YourFeature) - Commit your changes (
git commit -m 'Add some feature') - Push to the branch (
git push origin feature/YourFeature) - Open a Pull Request
Based on the master’s thesis “Scalable Battle Simulations in Strategy Games: Evaluating Optimization Methods in Unity” by Sherif Nafee.