Previous Blog Next Blog
Prev/Next Blog
by date

Cooking AI on Gas

Cooking AI on Gas
Name:Steve YorkshireRifles Acaster
Date Posted:Apr 03, 2008
Rating:4.0 out of 5
Public:YES
Comments:YES
RSS Feed:GarageGames Blog feedor Subscribe with .
Profile Page:View profile page for Steve YorkshireRifles Acaster

Blog post
After much hammering away at my AI, things have been coming along nicely.

Initially I implementing the coded Djikstra pathfinding by Robert Brower, which was a great way of learning to understand what pathfinding required.

After that I moved on to something more complex, enabling Gabriel Notman's C++ pathfinding resource (new zip available I see) for Mark Holcomb's CTF resrouce. Gabriel was nice enough to send me his scripts so I could have a good look through a working example - very useful as I'm not a programmer, but I can script a bit.

Initially I tried to mod my now built CTF resource to fit my AI routines, but in the end found it easier to start from the ground up with Gabriel's pathfinding C++ files and Mark's array C++ file, and eventually I got my custom goal-by-trigger based AI working with these resources. So that really sorted my pathfinding problems out.

Video, my AI using Gabriel's pathfinding, running around Mark's CTF map. And me changing the AI's goals dynamically with the console.

After that was sorted out, I worked on fixing my AI's combat-think, team, targeting system. I'd been using a heavily modded version of the famous Killer Kork by Devans. This had been a great script for reading through and learning how AI work. Using my hugely cutdown version I found that it could get a bit laggy with 32 AI on the go - and had a noticeable jolt ever thinktick() if I spawned all 32 in one go. I reckoned this was because each Killer Kork AI had it's own Vislist, which it updated every thinktick(), so that's 32 extra lists duplicating 31 other AI, getting updated every tick.

Going back to Mark's CTFbot resource I made a MasterArrayList which each AI joins when they spawn (and so does the player 'cos I'm only interested in SinglePlayer gaming). Every think(), working side-by-side with the pathfinding, they check for non-team members within their dynamically set %range. Finding the nearest with a decent LOS they attempt to shoot them.

Even with a LOS check for friendlies, there is the occaisonal blunder of friendly-fire, so I knocked up a bit of hacky code for projectiles to ignore damage on teammates.

After much fiddling and testing and tweaking, I'm pretty pleased with it. 32 AI running around, shooting the hell out of each other with shotguns, smgs and rifles - and no lag.

Last versions AI causing an almighty conflagration of dodgy LODed models and animations.


I tweaked my triggerable spawn system to get rid of the remain $globals in my AI script, so everything important can be changed on the fly with scripts and triggers.

dospawn(%name, %aitype, %team, %spawnPoint, %startup, %sight_range, %weapon, %goal)


That's pretty much done for my basic AI, I need to come up with an OnStuck() or dynamic avoidance of teammates function for when they occaissonally bump into each other and get jammed. And I need to come up with a OnDeath() "spawn ammunition of the type of weapon it was carrying" for the player to pickup.

After that I want to knock up a dedicated hunter AI to run down enemies for melee type attacks, and then start getting some functionality for the player sorted out.

So, I've been busy, and I've been productive. And I still managed to get time to go to an Ale Festival last week!

Steve Acaster - yorkshirerifles.blogspot.com/

Recent Blog Posts
List:08/24/08 - Content, Stuff and Bouncing Bombs
08/06/08 - Walk and Chew Gum Conundrum
07/12/08 - 8 Million Shades of Brown
06/17/08 - TGEA upgrade
05/02/08 - Squad Based Movement Explained
04/26/08 - Dubious Demo Released
04/03/08 - Cooking AI on Gas
03/13/08 - First Blog: Intro, Plan and Progress

Submit ResourceSubmit your own resources!

You must be a member and be logged in to either append comments or rate this resource.