The idea for the project was driven by this project called Node Garden, where a set of curves would twirl in space to create nodes. I thought it would be interesting to simulate a battlefield since it is hard to understand the patterns in the battle. I had planned to simulate armies, each comprised of an infantry, cavalry, archers and catapults. The two armies would have their own unique warfare strategies.
Each army has strength and a formation. The soldiers have a random speed between min and max speed limits, a random power between min and max limits of power for each army. The infantry runs towards each other. Every time two soldiers collide, the soldier with higher power survives and the soldier he collided with reduces his power.
The collision and mechanics of the fight worked well in the first iteration but the soldiers passed each other to the end, since their run was configured so that they move to the other army base.
In the second iteration the soldiers ran towards the nearest enemy. This skewed up the formation of the army, and all the soldiers ran towards the fastest soldier in the other army, as it would always be the closest enemy. I referred to this problem as Bow-Tie problem because of the patterns formed.
In the final design, the bow-tie problem was fixed by introducing two terms, field of view and group confidence. Every soldier has a fixed field of view and if there is an enemy in his field of view he would run straight to the enemy, else he would widen his field of view and run towards the closest enemy. Group Confidence is defined by number of fellow soldiers around him, as long as there were certain number of soldiers in a fixed radius around him, the soldier would run straight, else look for the closest enemy.