Archive for June, 2009

AI Architecture Overview

Sunday, June 21st, 2009

I’ve had a heck of a hard time with the design and implementation of the AI for Solium Infernum. I’ve erased the drawing board twice in fact. The only thing that remains from the Armageddon Empires code is the basic structure of the goal objects themselves. A goal still activates — goal.Activate() — to do its data analysis and planning and then is processed — goal.Process() — when it comes time to generate the AI’s orders and actions. I also kept the concept of an AIBrain object as a containment device and goal action interpreter but that’s not really much of an innovation or big deal. I’ve also still got all the fuzzy logic modules and work that I had done but that’s not a big deal either (although a lot of saved work)

When I first went to approach the AI for Solium Infernum my major concern was to improve the “meta reasoning” and the prioritization system for the goals that were generated. In AE each top level goal was given a priority ranking and the goal might or might not get processed depending on how it ranked with other goals and how many action points were available. The ranking was of course dynamic so as the AI Brain’s gained information or processed new meanings from information the ratings of the goals that it was pursuing went up and down. This worked pretty well for AE since you averaged a good deal of action points each turn (even if you couldn’t predict exactly what you would have each turn due to the dice buy and roll system for initiative) but for SI it wasn’t working very well.

The reason was because the actions that you perform each turn are much tighter and fewer in number. You have a maximum of 6 order slots to use each turn and most games you will only have access to 2 to 4 slots. That means that you have to really focus your strategy. You can move legions, demand resources, perform rituals, bid on items in the bazaar but you can’t do them all in a single turn. If you are pursuing a vendetta against another player and only have 3 order slots then you will be moving at most 3 legions that turn. There are other orders that you can issue but they are “Response” orders that happen when you respond to an item in your turn log. For example if somebody makes a demand of you then your “response” generates an order but it doesn’t cost you a slot. But the short of it is that a competing priority system doesn’t make much sense when your actions have to be very focused like this.

So for SI I came up with the concept of a ranked pipeline with a two tiered goal system. Critical goals are tier 1 goals that must process through until some condition is met. They cover situations that just can’t be replaced by another goal and forgotten….things like pursue Vendetta, defend against Vendetta, pursue Blood Feud, retake Pandemonium etc. Mission goals are tier 2 goals that provide not only the foundations to pursue the tier 1 goals but also the “character for the AI’s.” These are goals that focus on building up your capabilities, pursuing your primary and secret objectives and determine to a large degree how the AI interacts with its opponents. Tier 2 goals often lead to situations that cause tier 1 goals to be generated.

You can have any amount of Tier 1 goals in the pipeline and they are ranked according to how critical each one is. If you are engaged in two Vendettas then one Vendetta is going to get a higher priority than the other depending on which situation is more dangerous. If a tier 1 condition ends then the goal is removed from the pipeline (stack) and all the remaining tier 1 goals pop up to fill the vacant space…. this is actually quite rare though. It’s the AI’s job (like any good human player) to make sure that it doesn’t have more tier 1 goals than it can handle. On the eve of the anniversary of Barbarossa this ironically is always easier said than programmed. What’s nice about the diplomatic system in SI is that in most cases you can avoid tier 1 goals to a point if you are willing to sacrifice something be it prestige, resources, land or even artifacts. So you can put off an inopportune bully but at a cost (and only for so long but that’s another discussion).

The Tier 2 goals can only ever exist one at a time and are very fragile. They fail easily and are replaced by another. The AI’s have Archetypes that are randomly chosen that determine their Avatar attributes, perks, rank etc (not deterministic but random within ranges and pools of choices for perks). The Archetypes define a play style by influencing the composition of a strategy pool of rated choices. For example if the AI was an #AggressiveWrath type then it would favor building up its military capabilities and start bullying its weaker neighbors if the opportunity looked good. When it needed a solution to some problem then aggressive type goals will be rated higher. It’s martial Skill attribute will get precedence so that it can increase its Command Rating and get more legions out on the board. So when a tier 2 goal is needed the AI constructs a list of possible goals that each have a specific rating for desirability. Some situations might prompt the AI to rule out certain goals entirely or only consider a singe goal. Finally a roulette wheel approach randomly determines which goal is chosen but goals with higher ratings will of course be more likely to be chosen. That’s the key to generating “character” or “personality” type behavior.

That’s a pretty good description of the high level architecture for the AI. The concept is nothing new and the hard work is all in creating the goal objects and their scripts that process information and yield discrete orders. In some follow on entries I see about discussing some of the new techniques that I used to solve some interesting problems that I encountered….like using genetic algorithms to choose the best resource cards given some desire for certain types (souls for example) and an offering of cards with different types and amounts.

Help Save The Queen!

Wednesday, June 3rd, 2009

That which will not be named also seems to want me to know that “My lady awaits.” I can’t imagine how it can afford to do the type of advertising it does unless it is some sort of gaming ponzi scheme. I really try never to be negative about other games and the choices made by other designers but I’m still scratching my head over this one. I do just a little advertising but wherever I do advertise they seem to be there as well probably driving up my bids. So I have had this great idea for my upcoming marketing blitz for Solium Infernum. Try these out for size:

Meet Wicked Women!

Your Succubus Awaits!

Devil Your Pleasure!

Here is the image I’ll use for the banners of course:

Iron Maidens