Advertisement

Ideas for a Modular Enemy AI

Started by March 14, 2009 08:32 PM
4 comments, last by CIJolly 15 years, 8 months ago
I am working on a top down run and gun, and have finished the weapons. By making weapon modules which added things like submunitions, explosions, freezing, poison, etc, I was able to approach the situation in such a way as to make a wide variety of weapons using combinations of exisiting code. (Diablo style, really). I am interested in doing the same thing with AI. That way, I can make modules for gun wielding enemies, melee chargers, healers, kamakazi bombers, etc, and load them in a modular way such that I can make a large variety of enemies by mixing things around. Any advice on what the best way to go about this would be? I handled modular weapons by giving them indexes which, when a collision occured, went to a lookup table to see the special effects. I'm getting the feeling that doing this with AI will be somewhat more involved. At the moment I was thinking having logic along the following lines: Loop through list of modules, giving the current game state to the modules decision making functions. These will return an int based on how beneficial the module is at this time (Eg, a melee module would return 0 when the player was out of melee range, a heal myself module would return 70 if critically damaged). These values could be modified based on AI personality. (Eg, a fearless enemy will have their run-away value slashed). The modules will then be randomly decided between, with those returning highest after the decision making process being more likely to be picked. Carry out the modules commands in the update method, checking periodically to see if the module should break (Eg, if taking large amounts of damage, stop heal module and reevalute. On the reevaulation, run away would evalute highly and be the most likely to be picked and acted upon). Once module the module is completed, reevaulate situation. Does that sound like a sensible plan? Hopefully it will allow me to make interesting and varied enemies. Has anyone else tried something like this before and has a suggestion to make it go smoothly? I'm using C#, if it's important. Thanks for reading.
Two Word: Subsumption architecture
http://en.wikipedia.org/wiki/Subsumption_architecture

Advertisement
Can only one module be active at a time? If so what you are suggesting sounds reasonable (evaluate a 'usefulness value' for each and pick the best).
Go with a FEAR-style planner. You can then do exactly what you want by specifying what actions each class of enemies can use, and let the planner sort when and how to use them.
Quote: Original post by Steadtler
Go with a FEAR-style planner. You can then do exactly what you want by specifying what actions each class of enemies can use, and let the planner sort when and how to use them.


Yep. Have to agree with that for more reasons than simply the modularity of it.

Dave Mark - President and Lead Designer of Intrinsic Algorithm LLC
Professional consultant on game AI, mathematical modeling, simulation modeling
Co-founder and 10 year advisor of the GDC AI Summit
Author of the book, Behavioral Mathematics for Game AI
Blogs I write:
IA News - What's happening at IA | IA on AI - AI news and notes | Post-Play'em - Observations on AI of games I play

"Reducing the world to mathematical equations!"

Thanks for the advice everyone. You've given me a lot of things to check out.

This topic is closed to new replies.

Advertisement