Swarms: Fixes and Advanced Flocking
This update contains a couple of fixes, that let the swarms actually run a bit more smoothly. Additionally, this is the start of the advanced flock development.
Fixes:
1 - The first fix refers to the spawning of the agents. Earlier the agents just spawned on random positions within a given radius. But if they accidentally spawned into each other, they either got slung away or Unity's NavMeshAgent got broken. Now the spawn circle is automatically divided into multiple spawn-positions. And it will be checked, if a spawn-position is actually free, before it is used to spawn an agent.
2 - Secondly the movement-speed for all the flock types is set to the exact same value. Earlier I had to roughly estimate if my vales were the same.
3 - The next fix is my personal favourite, because I always break my head about the following question: Which way to move the agent should I use in Unity? And again the answer is: transform.position += new Vector3(). Because everything else causes problems (like they always did).
Start of Advanced Flocking:
And finally after over one month of coding, the advanced flocking simulation is finally in the project. The goal of the project is to create a flocking algorithm that includes pathfinding and obstacle-avoidance and can be used on every kind of map. And here it is:
For the start I connected the methods from the Pure-Pathfinding-Flock and the Pure-Flocking-Flock. To find the way around the map, one of the swarm-agents becomes a leader, that moves with pathfinding. All the other agents have that leader as a target of their normal flocking algorithm. Complementing this, I added a follower-leader-chain-system: the aforementioned leader is the main leader. But if a normal flock-agent loses sight of this main leader, it searches for another agent, that still has a connection. That way a long leader-follower-chain can be build, that lets the whole swarm navigate through a complex built map. And if nonetheless an agent gets lost, that agent can become an additional leader that uses pathfinding until it finds the main leader again.
Other Updates:
- The perception area of the avoidance- and cohesion-behaviours are now separated.
- A little bit more performance by using Vector3.SqrMagnitude instead of Vector3.Magnitude.
- Unity Vesion 2019.4.13
(21.10-26.10)
Files
Get Advanced Flocking Simulation
Advanced Flocking Simulation
Improvement of a classic flocking algorithm with global navigation and intelligent obstacle avoidance.
More posts
- Written Master ThesisApr 27, 2022
- New Maps and no Performance RecordingNov 20, 2020
- Performance of Agent-ChainsNov 12, 2020
- Advanced Flocking and User InterfaceNov 01, 2020
- Swarms: Pure Flocking and Pure PathfindingOct 21, 2020
- Saving Map and Start for FlockingOct 15, 2020
- Finished: Obstacle 3D GenerationOct 10, 2020
- Update: Obsatcle Analysis and UISep 30, 2020
- Project Start: Controller and Arena GenerationSep 21, 2020
Leave a comment
Log in with itch.io to leave a comment.