Basic Flocking Optimization - Android Build - 20000 Boids - Unity ECS/DOTS
Hi there!
In this video, we are going to look at ways to optimize flocking behaviour and run it on my Android smartphone to see how far our performance tuning can take us.
We will focus on the following areas -
Usage of BLOB asset store to store parameters that stay constant during the gameplay - this will make sure all the boids are referring to the same memory block where these parameters are not duplicated in every boid.
Limiting the iteration - When the boids are close to one another / when they are clumped together, the code will have to iterate on a lot more boids than necessary - every frame - which results in rapid frame drops. We will incorporate a simple logic to limit these iterations.
Field of view - If we are choosing a limited number of boids around a given boid then we will make sure we pick the most relevant boid by defining a field of view - in a way only boids in front of a given boid swept along the field of view are considered.
I am sure this can be pushed further and the system can be better optimized by introducing algorithms like particle swarm optimization / genetic algorithms and also by writing even more optimized code.
Though these methods might - in some cases - provide marginal performance improvement, at the least we know where the bottleneck is - Iterating and pushing boids into a cell. It would be ideal to register only boids that matter in a cell and implement a quadtree for quicker convergence.
Scalar projection - https://www.youtube.com/watch?v=_ENEsV_kNx8
BLOB Asset Store - https://www.youtube.com/watch?v=7_rZhp6V8ds
Source code -
https://github.com/ForgingStation/Flocking-Optimization---20000-Boids-on-Android-Smartphone
Science & Technology
#Forging Station
#Sumera Sankruthyayana
#Boids
#Flocking
#Boids optimization
#Swarm optimization
#BLOB asset store
#Field of view
#limited boids
#Android build
#Boids on smart phone
#Samsung S8+
#100000 boids
#limited perception
#efficient boids
#performant boids
#20000 boids Android phone
#Basic optimization
#Common memory block
#Lower memory foot print
#FOV
#Visualization
#Unity DOTS
#Unity ECS
#Execute on all threads
#Multithreaded