User avatar
Pocus
Posts: 25662
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Modding Novelty: AI and regional decisions

Fri Apr 19, 2013 5:31 pm

Hi there!

Beginning with AGE executable generated on April 18th and beyond, you can now program some precise logic in how the AI can choose the decisions cards to play, and where. Regional decisions are present in Pride of Nations, Alea Jacta Est / Birth of Rome and will arrive in Rise of Prussia Gold and American Civil War 2.

You parametrize decisions with these fields:

AIRelativePickChance // Relative chance to pick this decision (and then determine it is played) compared to others decisions available
AIImprovedCalc // The improved chance calc (following data) is not used, only based on region value (much faster and much dumber). By default, we don't use all these extra fields (retrocompatibility)
AIBaseChance // Base Chance to play this decision
AIMustBeSea // default no
AIModChanceMoneyLevel // modifier to base chance per money level (0 to 7)
AIModChanceWSULevel // modifier to base chance per WSU or Steel level (0 to 7)
AIModChanceConscriptLevel // modifier to base chance per conscript level (0 to 7)
AIModChanceGoodsLevel // modifier to base chance per Mfg Goods level (0 to 7)
AIModChanceMoraleLevel // modifier to base chance per Morale level (0 to 7)
AIModChanceCitylevel
AIModChanceNoCity
AIModChanceHarborlevel
AIModChanceBesiegedOwn
AIModChanceBesiegedOpp
AIModChanceFortLevel
AIModChanceLoyaltyChunk // chunk size is 10 points
AIModChanceControlChunk // chunk size is 10 points
AIModChanceNoAdjEnemy // including this region
AIModChanceAdjEnemy // including this region
AIModChancePillaged
AIModChanceNotPillaged
AIModChanceHasEnemy
AIModChanceNoEnemy
AIModChanceEnemyChunk // chunk size is 100 points
AIModChanceFriendlyChunk // chunk size is 100 points

First thing first, you need to define the relative chance for a decision to be picked, with AIRelativePickChance, among the decisions the AI have in its force pool. For example if there are 5 decisions A and 10 decisions B and the first one has AIRelativePickChance = 1 and the other AIRelativePickChance = 2 then the probabilities will be

5x1 + 10x2 = 25
Chance for A: 5/25
Chance for B: 20/25

Once B is deployed once, this falls to
Chance for A: 5/23
Chance for B: 18/23

etc.
As you can see, if a decision is drawn often, then there will be less to deploy further, and so the rarer decisions may appear more often.

By default the value is at 1, so there is a probability strictly proportional to the amount remaining in the pool.

Second, you'll want to fine tune where the decision is played. For that, for a particular decision, you must set AIImprovedCalc = 1. If you don't do that (which can be your intent for some simple decisions), then the AI will play decisions based on the global, generic value, of the region (this is not entirely true in PON where there is embedded Colonial/non colonial logic).

And then, the big part, how you parametrize the decision... (never understood why this is not parametize, but well, who I'm to speak of oddities in the English language? ;) )

The base chance to play a decision is 0%. And this is important that most of your regions don't qualify for the playing of a decision. A good rule of thumb is that 90% at least of the regions should not qualify. Because if you have 1% or more chance to play a decision in a region, then it involves more complex computing down the road, and we don't want that, right?
If you are unsure if you went overboard or not, you can check in the AI log how much time this specific decisions algorithm takes. Don't go over 1 second. For ROP gold, the process uses 800 ms on my average computer.

So again, it is a bad idea to sprinkle your decisions with 1% there and there, which will make all regions have a few % chance of playing each decision.

For a simple example, lets say you want a decision to be played in big cities (you game have cities from 1 to 10). You'll use these values:

AIModChanceCitylevel = 10

The higher the city level, the more chance you can play the decision. Keep it simple, no need for tons of parameters per decision.

This is the ROP gold XLS file, if you want to get some more infos and read the comments, this will surely help you.
[ATTACH]22313[/ATTACH]

Also, know that we are in the process of adding more parameters in a few days, to tailor better the AI decisions process.
Attachments

[The extension xls has been deactivated and can no longer be displayed.]

Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

User avatar
Hobbes
Posts: 4437
Joined: Sat Mar 11, 2006 12:18 am
Location: UK

Fri Apr 19, 2013 6:46 pm

Looks great! :thumbsup:

User avatar
Leibst
Posts: 2581
Joined: Wed Sep 27, 2006 6:06 am
Location: Madrid, Spain
Contact: Website Facebook

Fri Apr 19, 2013 10:02 pm

This will make better the IA strategy. Well, now we have only 214 fields to fill to define a RGD. :bonk:
:thumbsup:
Image
Headquarter game designer of Battles For Spain, Ageod English Civil War, España:1936 and Thirty Years War
HQ website

Baris
AGEod Guard of Honor
Posts: 1945
Joined: Fri Apr 16, 2010 9:50 pm

Sat Apr 20, 2013 7:25 pm

Splendid ! and Rise of Prussia Gold?? Browse through the posts but couldn't find any info , but great news. :thumbsup:

User avatar
Pocus
Posts: 25662
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Sun Apr 21, 2013 11:06 am

Ah, I thought it was already announced in a facebook whatever post. Bah, it will be very soon, given its release date ;)

About decisions, yes, 214 data fields. That's not super optimal to manipulate them with Excel, but until we get an intern or a volunteer willing to do an utility, this will remain as is. Still bearable I believe... You just have to take your time checking the cells.

I'll add more fields this week, there are some things that can't be done right now with the few :bonk: we have!
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

User avatar
Pocus
Posts: 25662
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Tue Apr 30, 2013 3:15 pm

Some new data fields (13), the wiki has been updated:

http://www.ageod.net/agewiki/Regional_Decisions

The new data fields allow better control on the regions you want the decisions to play, along with some 'cut off' levels, i.e say you want to target a region with a city, but only for cities of level 5+ These cut-off fields can do that.

Plus some additions related to EP and VP checking.
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

User avatar
Leibst
Posts: 2581
Joined: Wed Sep 27, 2006 6:06 am
Location: Madrid, Spain
Contact: Website Facebook

Tue Apr 30, 2013 3:28 pm

good news, then i have to study carefully these aditions for SCW. :sherlock:

Is it possible to tell the AI play a RD in a region with enemy units?
Image
Headquarter game designer of Battles For Spain, Ageod English Civil War, España:1936 and Thirty Years War
HQ website

User avatar
Pocus
Posts: 25662
Joined: Wed Oct 19, 2005 7:37 am
Location: Lyon (France)

Tue Apr 30, 2013 4:13 pm

With AIModChanceHasEnemy, you can incite her to do so yes. The RGD must be valid, sure...
Image


Hofstadter's Law: "It always takes longer than you expect, even when you take into account Hofstadter's law."

Return to “Modding AGE engine games”

Who is online

Users browsing this forum: No registered users and 21 guests