top of page

Crusade - Formation System

Crusade is a crowd simulation made in Unity 3D that demonstrates the movement of large unit groups using swarm intelligence. Units follow a flocking algorithm to remain in a set formation whilst moving from one point to another avoiding obstacles in their path. Made for my Masters final project going deep into the RTS mechanic of unit formations.

Through both my BSc and MSc I have always aimed to improve in my knowledge of AI. To do this, I have put a lot of focus into strategy games where there are commonly three concrete levels of AI, including low level pathfinding to high level decision making. Unlike my Enemy Confederation (BSc Individual Project) that is a complete game containing all three levels, Crusade goes deeper into the mechanic of unit formations and movement.

The key features of Crusade include flocking and obstacle avoidance. To create the movement, units use the three rules of flocking: Alignment, Separation and Cohesion. Alignment keeps the units heading to their target direction that is calculated after a movement command has been given. Separation keeps units from colliding with each other, by doing a distance check and seeing how close units are to each other. Finally, cohesion was altered to keep units heading towards their target offset from the centre, rather than the centre like in other common flocking examples. These rules create the foundation of the movement that units follow.

Additional mechanics were added to improve the look and feel of the formation movement. An example of one of these mechanics include squad rotation. To allow a squad to rotate, they had to have a target rotation to match. If this rotation was 180 degrees away from the original rotation, units would charge towards the centre to flip around and face the other way. Although it worked, units broke formation removing the desired effect. Slowly altering a squad's rotation overtime allowed for units to rotate properly to match their target rotation.

Crusade also showcases a lot of visual elements that show the potential of what this system could be used for. The original idea was to turn the project into a battle simulation, hence the name Crusade. However, as development time was short, more time was spent researching and narrowing down how to get formations to look good. Adding human like models immensely changed how the movement felt due to uncanny valley. Originally, Unity capsules represented units and if a unit broke formation it felt wrong. As capsules gave the illusion of robots which shouldn't make mistakes. Once knight models were added, every time a unit broke formation, it felt natural as humans are not perfect.

On top of a battle simulation, there are lots of possibilities this system could be used for. It could be redesigned to be more of a mundane solution for simulating crowds in places like a stadium. Or it could be turned into a Unity tool, that could be used for creating films and videos, the possibilities are endless!

bottom of page