Plan for Gary Haussmann
by Gary Haussmann · 01/29/2005 (10:38 pm) · 2 comments
As mentioned in my previous plan I am attempting to pit small groups of creatures, controlled with an RTS style point-and-click interface, against the traditional FPS controlled guy with guns. The big problem I saw when starting this was that using the normal AIPlayer to control each creature led them to behave in a rather robotic and uninteresting manner. So I tried to make some AI that was still relatively simple, yet provide for more creature-like behavior.
So I started by giving each creature the ability to hold a set of simple short-term goals, like "attack this guy" or "move to this location". The code figures out which short-term goal currently has the highest priority (based on proximity of enemies, etc.) and does some movement or shooting or whatever to try and satisfy that goal. When all the goals are satisfied, the creature stands around stupidly, although it will still react to approaching enemies. In this picture, the critters are standing around my pimped-up car, having just killed me in it a few seconds ago.
The icon above their heads tells me what current short-term goal they are trying to accomplish. This was for debugging, but I'll probably leave it visible to the controlling player. Other players and enemies won't be able to see the creatures current goal.
For movement, instead of making a beeline to their goal or using full navmesh, each creature basically does a guided random walk. Each tick the creature looks at a random nearby point to see if that point is evaluated as better than its current location. For moving, points closer to the goal point are evaluated higher; for attacking, points within the optimal weapon range to the target are evaluated as better. The net result is a sort of wandering path that accomplishes the task, but looks a little chaotic and less robotic than just moving in pure straight lines.
Here we see a small pack proceeding toward their destination. You can see from the footprints that each critter has made a different zig-zagging path to reach their goal. This makes critter movement more interesting, and also makes them a lot harder to hit.
What next? I need a few more short-term goals (avoid, get item) and then will write up some script functions for the higher-level behaviors like patrol, guard, ambush, etc. And then I have to do some game design to figure out what sort of weapons and abilites to distribute among the critters and humans.

So I started by giving each creature the ability to hold a set of simple short-term goals, like "attack this guy" or "move to this location". The code figures out which short-term goal currently has the highest priority (based on proximity of enemies, etc.) and does some movement or shooting or whatever to try and satisfy that goal. When all the goals are satisfied, the creature stands around stupidly, although it will still react to approaching enemies. In this picture, the critters are standing around my pimped-up car, having just killed me in it a few seconds ago.
The icon above their heads tells me what current short-term goal they are trying to accomplish. This was for debugging, but I'll probably leave it visible to the controlling player. Other players and enemies won't be able to see the creatures current goal.For movement, instead of making a beeline to their goal or using full navmesh, each creature basically does a guided random walk. Each tick the creature looks at a random nearby point to see if that point is evaluated as better than its current location. For moving, points closer to the goal point are evaluated higher; for attacking, points within the optimal weapon range to the target are evaluated as better. The net result is a sort of wandering path that accomplishes the task, but looks a little chaotic and less robotic than just moving in pure straight lines.
Here we see a small pack proceeding toward their destination. You can see from the footprints that each critter has made a different zig-zagging path to reach their goal. This makes critter movement more interesting, and also makes them a lot harder to hit.What next? I need a few more short-term goals (avoid, get item) and then will write up some script functions for the higher-level behaviors like patrol, guard, ambush, etc. And then I have to do some game design to figure out what sort of weapons and abilites to distribute among the critters and humans.

About the author

Torque Owner Mark Berry
I really like the 'thought' icons, I'm going to pinch that idea!
Cheers, Mark.