2D Turn-Based Strategy AI Design Question
I've posted this on the XNA forums as well but I am hoping that someone will be able to provide some insight here too.
I have a question regarding game AI and the best design approach to take. I am currently working on a 2D turn-based strategy game and I trying to figure out the best approach to handling AI on a per-unit basis. For a CPU player, should each individual game unit be responsible for handling its own AI decisions or does it make more sense to have an AI "Director" that handles performing any AI calculations and simply move the game units around as seen fit?
Here is a list of my thoughts so far:
- I'm trying to keep things simple, so I am just having one unit active at one time
- The units should be working together towards a common goal...either capturing objectives on the map or defending
- There will only ever be one CPU player at a time
- Only the CPU units would need AI functionality; Player control units have dumb AI and await human commands.
- AI actions are pretty basic in my mind (I'm sure I'll come up with more later):
ATTACK
- Attack Nearest Enemy Unit
- Attack Weakest Enemy Unit
- Attack Strongest Enemy Unit
DEFEND
- Fortify Position
- Defend Friendly Unit By Attacking Threatening Unit
MOVE
- Move to objective
Thank you for your time.
(A better description of the game would help.)
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!"
In strategy games makes more sense to have all the decisions point towards a common goal.
So, if you add independent AI for each unit, it would seem reasonable for the AI at times to consider it's own best interest rather then the interest of the CPU player, for instance, retreating before dying when it's death would produce a better outcome. And this behaviour alone doesn't make much sense.
It would make more sense to have a single AI entity decide what each unit does in order to achieve this common goal.
You might however spice things up a bit. For instance, you might introduce the concept of fearful units that will retreat if they face a particularly scary opponent. This would play out more like a characteristic of that particular unit, rather then an individual decision, and the CPU player would just have to make it's decisions bearing that characteristic in mind.
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!"