Help with A.I

Blitz3D Forums/Blitz3D Programming/Help with A.I

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.

I always used a state model. Normaly the guards are patroling, but when they see the player (using entityvisible if they are close enough, and maybe the Field of View Function from the code archives), then they go into panic mode. In panic mode their reaction time is shorter and their field of view is bigger. In panic Mode they also run instead of walking. I added some direct bones manipulation to the neck of the guards, so first (if not in panic mode) they look to the player, then it takes up to a second until they react, kind of "what the..!!!"-reaction.
When the player escapes successfully, they fall back into normal patroling mode (non-panic) after a couple of time, 20 secs or something.
It is also possible to allow chain reactions of panic-mode enabling. So if one guard has seen you, an other guard who cannot see you but can see the first guard is now in panic mode too. This can be solved recursively.