28 July 2006

AI pathing





I've started working on rewriting the AI to control the bombers. My last iteration had a basic state machine and a whole lot of role specific code. I'm adding a task based stack. The top action is the only one that runs and when it determines it's completed itself it is removed. So it's also pretty simple to queue things up, or interrupt and resume. For example my bomber right now has a dive bombing mode where it does this: Goto(NextAttackPosition) DiveBomb(UntilTooClose). I added a small flag when the bomber is taking a lot of fire. The AI checks this against a threshold and adds a temporary AvoidFire action that runs for a few seconds. When things have cooled off it resumes DiveBombing.

The hardest part about AI is debugging it, so have custom debugging visuals for each action - something that would be a lot harder if the code was organized differently. Look at the pretty colored lines!! And these JPGs suck, so sorry about that.

0 Comments:

Post a Comment

<< Home