AI Programming strategies

Blitz3D Forums/Blitz3D Programming/AI Programming strategies

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

A fairly simple way is to have a set of vectors:

Vector from AI to player (Vector 1)
Vector from AI to nearest AI friend (Vector 2)

If the vector from AI to player is shorter than AI to friend then head towards the player.
If the vector from AI to player is longer than AI to friend then check the following as well:

If the dot product of normalised Vector 1 (AI to player) and normalised Vector 2 (AI to nearest AI friend) is >'Tolerance Value' (Tolerance Value would be between say 0.7 (about 45 degrees) and 1 (0 degrees) ) then cause the AI player to head at an angle perpendicular to the angle between AI and player for a brief amount of time.

That is one way, and it can be tweaked okay. This is not about pathfinding but more about collision avoidance.