[Ant Attack] Ant Hunting Update
Ah ha, I've had a break through (kinda).
I've tuned the hunting code where the ant tries to track the player or track another ant who's already tracking the player.
First off I tweeked the ordering of the "Can I see the player or their trail?" checks, so I can throw out further checks as quickly as possible, without having to bother with a line of sight test.
Secondly, I made sure that the smells that make up the trail are always ordered by their strength, strongest first. Basically this means that as soon as all three checks are valid...
1. The smell I'm checking is within a certain distance.
2. The smell is within my "Field of Vision" i.e. infront of me.
3. I have Line of Sight to the smell.
...I can stop checking any more, knowing that I have found the smell closest to the player.
The worst case situation is if all the smells are infront of the ant and within range, but it only had Line Of Sight to the weakest.
Third and finally I stopped myself from doing something really stupid. I had set it up so that all the ants only recheck their targets once ever second. The theory being that at least it was better than rechecking every game cycle.
But now, I do recheck the targets each cycle, only I do it one ant at a time. So instead of doing 20 ants all at once, I can do 20 ants spread over 1 second.
I'll mention more on why this is "good thing" in a later post. Suffice to say for now though that I'm a very happy bunny indeed and things are running well.