View Single Post
  #10  
Old April 16th, 2004, 05:56 PM
LintMan's Avatar

LintMan LintMan is offline
Sergeant
 
Join Date: Oct 2000
Posts: 295
Thanks: 0
Thanked 0 Times in 0 Posts
LintMan is on a distinguished road
Default Re: SUGGESTION: AI castle building algorithm

Quote:
Originally posted by Arralen:
This is a part of the troop building suggestion
------------------------------------------------
Build castle
IF money=1.2*(castle cost) OR desirabilty>7
CHOOSE prov with highest "desirability points"


a) has indie troop with (ress. cost)>14 2pts

b) will give (combinedress)>66 [BASE w/o scales]
AND isn't next to another castle 1 pt
OR (combinedress)>99 2 pts

c) has site with allows special troops 1pt
has site with allows special commanders 2pts

d) has 4 land neighbours, of which 2 are not owned AND not neighbouring owned provinces 1pt

f) would have 2 castle neighbours -2 pts
------------------------------------------------
A few comments:
- For a, are you counting commander units? *Many* standard indy commanders have a res cost > 14. Even aside from that, 2 pts seems to place a lot of desirability on having high-resource indep troops. I think this should probably be more nation-dependent. Ie: An indy province that produces heavy cav may not be much of a benefit for a nation that already has some good heavy cav units.
- I think that b above has a potential hole where it could build new castles that share provinces with one or more other castles, thereby reducing *those* castles resources to unfortunate levels even though the new castle meets the criteria. Perhaps a check that all bordering provinces of the prospective castle site should have <= 100% admin after factoring in the new castle, or -2 pt desirability rating
- I tend to emphasize putting castles at/near stable enemy borders. In d, I'm not sure what you mean by "... AND not neighboring owned provinces" ... neighboring what - enemies? I don't know if I'm missing the point, but I think I'd scratch that part so it could put castles on its borders.
- Is there no point e on your list?
- It might also be worth somehow factoring in some desirability for building castles at/near "where the action is". IE: The AI is probably better off building a castle near where its current main army is engaged than at some place on the other side of its empire.
- Another thing to consider is that if the AI does start building castles anywhere near its enemies is that it should make sure it is capable of defending the province while the castle is under construction (to protect its investment), and will be able to defend the castle after it's built. It would be a bad thing if the AI starts building undefended or marginally defended castles that opponents could easily take and use for themselves to support their advance.
- It might be worth setting some castle-to-province ratios, at which castle building becomes greater and greater priorities. Say:
code:
if (ctp-ratio < 0.1)  // if less than 1 castle per 10 provinces
save_income_percentage_for_castle(0.2) // save 20% of income towards castle
else if (ctp-ratio < 0.05) // 1 castle per 20 provinces
save_income_percentage_for_castle(0.5) // save half of income towards castle
etc.

The numbers above are arbitrary, but you get the idea. This could allow a gradually increasing priority for castles as the AI expands, and also would allow the AI to save up for castles rather than just building them when it happens to have enough money or relying on occasional money-saving turns.
Reply With Quote