This is a classic case of a game's scope expanding beyond what the original code is capable of. To cut a long story short, I'm re-writing the AI, yep the soldier AI. Sounds like a right blow and it feels like one too but I came to the annoying conclusion that it was the only feasable way to proceed.
I'll explain my reasoning. The soldier AI has never been rewritten completely; ever since the very first (and very crappy) version of the game I demoed on TDC the fundamental code of the soldier AI has been the same. Since then more and more features have been bolted on and the code slowly became horribly inefficient and horrible to maintain. When I started re-writing the monster AI, I realised the monsters could do most of the stuff the soldiers can, and in better and more reliable ways- and the code is so much more compact and well organised. It was at this point the idea of rewriting crossed my mind. I was having a fight with some soldiers just to try and make up my mind and the fact that more than about 3 soldiers fighting caused slowdown swayed me... in my mind that is just not acceptable because in itself it limits the scope of the game.
Right, thats the bad news done with. The good news is that I am well into the writing of the new AI codebase. I have all of their behaviours specified- in many cases its just writing what I wrote before in a more organised fashion. There is one key difference however, and that is pathfinding. In the old AI code, soldiers gave the illusion of spatial awareness by moving to and from pre defined cover points- which in most cases worked quite well, but in cramped indoor spaces they often had trouble pursuing the player. With the new pathfinding system the AI find their way around any environment with no trouble at all- they seem so much smarter already. The pathfinding system which is based around Alien's advanced path movement object (not APFO which requires the NET update) also supports moving to cover and a range of other manouvers inherantly. The AI can now not only follow patrol paths in their unaware state, but also move around the map to objectives. For example a squad can move across the map to a certain location and set up patrols there. When they are traversing the map they don't just walk there, they properly move from to cover to cover, watching each other's backs as they go.
I'll also feel a lot better when I release the open source because I was ashamed of the old soldier AI code! People always said it was impressive and I always thought "if only they knew how bad it looked under the hood..."
|