Making Two Million Soldiers Move in Unity.
by Vicente C.
Published |
46
Share
Excentio uses compute shaders, flow fields, and shared squad decisions to run Increwar's largest battles almost entirely on the GPU.
Excentio recently shared an update to Increwar, an incremental strategy game built around real-time battles with up to two million units. The changes improve how soldiers spread through a fight and respond to nearby combat, with magic and, in Excentio's words, “bloooooood” added on top.
Even at that scale, each soldier keeps its own position, health, target, and animation. Excentio stores about 84 bytes per soldier in GPU buffers and updates them through compute shaders. The CPU dispatches those passes and draw calls, while any data it needs back is read asynchronously.

This is not a Unity DOTS setup. Excentio compares it more to writing a smaller engine inside Unity because the soldiers do not have GameObjects, Transforms, or built-in physics. Anything the simulation needs has to be recreated on the GPU.

Squads make the larger decisions. Each chooses whether to charge, hold, kite, or march, and its members follow. Coarse nodes summarize nearby collision cells with each team's population and center of mass, so a squad can find an enemy formation without checking every unit.

For movement, each team shares one flow field. The GPU builds a distance map to the nearest enemy, and each soldier reads the direction for its area. Higher traversal costs bend the route around trees, walls, and steep ground. Solving the field costs the same whether ten thousand or one million units follow it.
Once the armies meet, a dense grid keeps collision checks local. Each cell is one contact diameter wide, so soldiers search only the surrounding 3x3 neighborhood. The grid is rebuilt every frame, and the same sweep finds nearby targets.

Damage from several attackers is added to a fixed-point accumulator and applied in a separate pass. This lets every hit land during the same frame.

Rendering also gets simpler with distance. Nearby soldiers keep their full animation, while distant ones become two-triangle sprites. In Excentio's captures, 200,000 soldiers take about 1 ms to simulate. A larger test shows 2,000,520 soldiers at 11 ms per frame across a battlefield about 2.5 kilometers wide.
Battles with several armies still need tuning. Squads move toward active fights to reduce queues, but for now, each one can focus on only one threat. Excentio is testing whether splitting squads into smaller groups could help.

You can follow Increwar and Excentio through the links below:

Interested in learning more?
If you’re interested in the technical side of Unity? The Unity Dev Bundle brings together six books covering shaders, math, procedural shapes, editor tools, and character customization.
Jettelly wishes you success in your professional career! Did you find an error? No worries! Write to us at [email protected], and we'll fix it!

Subscribe to our newsletter to stay up to date with our latest offers

© 2026 Jettelly Inc. All rights reserved. Made with ❤️ in Toronto, Canada