Wednesday 16 June 2010

Behaviour

I've been playing with code to add behaviour to the bots. At the moment this only relates to basic movement. They will either chase an enemy or return to their original task.

I am pleased with the results. It has been fun getting the bots to follow me about. They dart in then move away and jostle for position to get a good shot.

I also like the way that when they don't have a target they resort to the pathfinding to get back to their previous task.

I took some pleasure when I led them all to the far side of the map then ran away from them. They turned round at different times and eventually all worked their way back across the map to where they started.

If you have read my previous comments about pathfinding you'll know I was having performance problems with this. The basic pathfinding is unchanged. I did as I expected and have pre-calculated all the paths that I know before the game starts. These are saved with the map. All other paths needed are calculated during the game.

I use one hardware thread (on the Xbox 360) for any pathfinding requested and another hardware thread for all of the rest of the AI. I had to do this just in case working out any one path took too long. I did not want the reactions or behaviour to be held up. So far it's worked well.

No comments: