.com.unity Forums

.com.unity Forums (http://forum.shrapnelgames.com/index.php)
-   Dominions 2: The Ascension Wars (http://forum.shrapnelgames.com/forumdisplay.php?f=55)
-   -   SUGGESTION: AI troop building algorithm (http://forum.shrapnelgames.com/showthread.php?t=18773)

Arralen May 28th, 2004 04:38 PM

Re: SUGGESTION: AI troop building algorithm
 
I'll continue the test game this weekend.
Meanwhile here are some improvements to the (pseudo-)code:

</font><blockquote><font size="1" face="sans-serif, arial, verdana">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">[if there are multiple troops that fit a condition, mix equally,
starting with the most ressource-costly first]
[bless effect=true IF 3 pathes @4 OR 1@6/1@4 OR 1@9 or better]

0) IF ERMOR(Ash, Soul)OR PANGAEA(CarrWoods) GOTO 2)
CALL BUILDCASTLE

IF (availablemoney) STILL &gt;400
BUILD lab where's a special commander(mage) to build
IF (availablemoney) STILL &gt;(templecost*2)
BUILD temple at
- prov. that offers special holy commanders (mages, priest=3, dunno)
- prov. that have a castle
IF (numberofprovinces)&gt;(numberofcastles)*4
AND ((turnnumber)-(numberofcastles)*10)*10%=true SAVEMONEYTURN=true; SKIP 1-3)


1) Build troops at home province
- IF prophet=false BUILD priest-3 or better
- most expensive mage commander (80%:max. 1/2 of available money/ 20%: max.3/4)
- assassin/spy/bard etc. IF ((turnnumber)-5)*10%=true
- priest w/o magic IF (turnnumber)&gt;(numberofpriests)*3
- most heavily armored commander IF (turnnumber)&gt;5 AND 'unusedleadership'&lt;10
- scout (50 - (turnnumber)*2)%

- holy troop IF (bless effect)=true AND 3 pieces possible
- heavy troops:(ress)&gt;14 with (strat move)&gt;1, best move first IF 2 pieces possible
- heavy troops:(ress)&gt;14 IF 3 pieces
- medium troops: (ress)&gt;10 IF 3 pieces
- archers: IF Long-/Compound Bow


2) build troops at castles [highest ress value goes first]
- most expensive mage commander (max. 1/2 of available money)
- assassin/spy/bard etc. IF ((turnnumber)-5)*10%=true
- priest w/o magic IF (turnnumber)&gt;(numberofpriests)*3
- most heavily armored commander IF (turnnumber)&gt;5 AND 'unusedleadership'&lt;10
- scout (50%)

- holy troop IF (bless effect)=true AND 3 pieces possible
- heavy troops:(ress)&gt;14 with (strat move)&gt;1, best move first IF 2 pieces possible
- heavy troops:(ress)&gt;14 IF 3 pieces
- medium troops: (ress)&gt;10 IF 3 pieces
- archers: IF Long-/Compound Bow


3) Build special troops [in non-fortress prov]
- special commanders IF mage
OR
IF special troops ARE undead, amphibic, flyers, stealthy
- build as many special troops as ressources, (availablemoney)/2, (commandvalue) allows


4) Build patrols at province w/o castle and less than 20 troops on patrol
IF
borders enemy prov.
OR has lab, but no castle
OR has only 2 land neighbours
OR has 3 neighbours, but only 1 owned

THAN BUILD
- most mobile commander IF (numberoftroops)&gt;(commandvalue)
- highest movement troop[for patrol]


5) Build troops at all castled prov. [high ress value first]
- light troops: (ress)&gt;7 IF 3 pieces
- fill with light archers/slingers

6) Build troops in prov
IF
borders enemy prov.
OR has lab, but no castle
OR has only 2 land neighbours
OR has 3 neighbours, but only 1 owned
- heaviest inf (50%)
- archers (no matter what)</pre><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">

Arralen September 23rd, 2004 03:52 PM

Re: SUGGESTION: AI troop building algorithm
 
I must admit - it's not only Gandalf who can't play as an AI would, strictly follwing the 'build script' .. I can't do it either. After 6..10 turns I simply screw up .. either I overlook something I'm supposed to do, or I start doing things I shouldn't http://forum.shrapnelgames.com/images/smilies/wink.gif

So if there's anyone out there interested in an AI that does not only build Light Infantry, please test this building script. If it works well, the devs may put something similar into the game, maybe. http://forum.shrapnelgames.com/images/smilies/happy.gif

ioticus September 23rd, 2004 04:43 PM

Re: SUGGESTION: AI troop building algorithm
 
Where do I get this mod, and how do I install it?

Kristoffer O September 23rd, 2004 04:55 PM

Re: SUGGESTION: AI troop building algorithm
 
It's not a mod. It's a suggested AI algorithm. In other words its an attempt at making a strategic manual for the AI. Print it out and play a game with those rules and never take any initiative of your own and you are playing the game acording to the Arralen AI Algorithm. If tested and proven good it might inspire JK to alter the current algorithm. If you come across any problems notify Arralen. He seems to be up for input http://forum.shrapnelgames.com/images/smilies/happy.gif .

Gandalf Parker September 23rd, 2004 05:09 PM

Re: SUGGESTION: AI troop building algorithm
 
Its a set of AI rules. People keep saying "broke" but they rarely come up with specific suggestions such as this thread did. There is also another one like it on AI castle building somewhere.

The reason it needs testing is that its not hard to come up with specifics on how Ulm would play better or how Ermor would play better. But there is only (at this time) one AI program. So if you were to write a generic AI using words like infantry, cavalry, archer, mage, priest... then will it make things worse when played by Pangaea, or Caelum, or Atlantis.

The_Tauren13 September 23rd, 2004 06:22 PM

Re: SUGGESTION: AI troop building algorithm
 
I think I'll attempt to test this, so wish me luck; I'm not sure how hard it's going to be.

Cheezeninja September 24th, 2004 12:34 PM

Re: SUGGESTION: AI troop building algorithm
 
It seems to me that its more important to have a challenging and entertaining game than a complex AI that can sit in the same seat as a human and do a passable job. Why not script it so whenever the AI plays a nation that nation plays alot like the dead Ermor nations? I've noticed that the AI does a remarkably better job when the infantry is auto-generated and it can focus more on the commanders and construction. Could it not be set up so that the AI gets a smaller percentage of the money it should be recieving, but also gets free thematic troops that will keep its army looking national instead of independant, then it could focus more on the other things and probably be a good deal more challenging. I am far more interested in the way the game plays than whether or not the AI is playing fairly.

PDF September 25th, 2004 06:50 PM

Re: SUGGESTION: AI troop building algorithm
 
Cheezeninja,
I do like your suggestion very much http://forum.shrapnelgames.com/images/smilies/happy.gif I don't care if the AI plays by the same rules than the players, and like you would prefer to have AI field "nice" armies !
By the same token AI armies should be starvation-protected.

Gandalf Parker September 25th, 2004 09:10 PM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

PDF said:
Cheezeninja,
I do like your suggestion very much http://forum.shrapnelgames.com/images/smilies/happy.gif I don't care if the AI plays by the same rules than the players, and like you would prefer to have AI field "nice" armies !
By the same token AI armies should be starvation-protected.

I liked that, since the AI cant do reasonable planning based on low or high supply provinces. But then I thought about it and realized that it would be a major thorn to Ermor and other death scales which count on creating large rings of non-supply to aid in their defense.

Not that I ever liked that. I wouldnt mind seeing it get nerfed but it IS a plus factor of theirs which would be cut down. Something to consider but I cant quite decide if it knocks the suggestion out or not. Opinions?

Arralen October 23rd, 2004 07:28 PM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

The_Tauren13 said:
I think I'll attempt to test this, so wish me luck; I'm not sure how hard it's going to be.

Any results so far?

I'm not shure if it makes sense anymore, though.
With DOM3 in development, will the DOM2 AI be tweaked any more?

However, I started a test game myself and already did some tweaks to the pseudocode:

<font class="small">Code:</font><hr /><pre>
[bless effect=true IF 3 pathes @4 OR 1@6/1@4 OR 1@9 or better]

[IF there are multiple troops that fit a condition,
mix equally, starting with the most ressource-costly first]

[IF there are multiple troops that fit a condition ressource-wise (Troop-Type),
but only building one of them would fit the whole condition,
build only that troop : applies to (1i) especially]
-------------------------------------------------------------------

0) IF ERMOR(Ash, Soul)OR PANGAEA(CarrWoods) GOTO *X*)
IF money&gt;(castle cost) CALL BUILDCASTLE

*------------------------------------------------*
BUILDCASTLE
IF money=1.5*(castle cost) OR desirabilty&gt;7
CHOOSE prov with highest "desirability points"

a) has indie _troop_ with (ress. cost)&gt;14 2pts

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

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

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

e) would have 1 castle neighbours -1 pt
would have 2 castle neighbours -2 pts
*------------------------------------------------*


*X* IF (availablemoney) STILL &gt;400
BUILD lab where's a special commander(mage) to build
IF (availablemoney) STILL &gt;(templecost*2)
BUILD temple at
- prov. that offers special holy commanders (mages, priest=3, dunno)
- prov. that have a castle
IF (numberofprovinces)&gt;(numberofcastles)*4
AND ((turnnumber)-(numberofcastles)*10)*10%=true SAVEMONEYTURN=true; SKIP 1-3)


1) a) IF prophet=false BUILD priest-3 or better, no matter where

Build troops at home province
b) assassin/spy/bard etc. IF (turnnumber-5)*10)[Max30]% = true
c) priest w/o magic IF (turnnumber)&gt;(numberofpriests)*3
d) most heavily armored commander possible
IF (turnnumber)&gt;5 AND 'unusedleadership(=set to defend)'&lt;5
e) scout (50 - (turnnumber)*2)%
f) most expensive mage commander possible
(80%:max. 1/2 of available money/ 20%: max.3/4)


g) holy troop IF (bless effect)=true AND 3 pieces possible
h) heavy troops:(ress)&gt;14 with (strat move)&gt;1, best move first
IF 2 pieces
i) heavy troops:(ress)&gt;14 IF 3 pieces
k) medium troops: (ress)&gt;10 IF 3 pieces
l) archers: IF Long-/Compound Bow


2) Build troops at castles [highest ress value goes first]
a) scout (50%)
b) assassin/spy/bard etc. IF (turnnumber-5)*10)[Max30]% = true
c) priest w/o magic IF (turnnumber)&gt;(numberofpriests)*3
d) most heavily armored commander possible IF (turnnumber)&gt;5 AND 'unusedleadership'&lt;5
e) most expensive mage commander possible (max. 1/2 of available money)

f) holy troop IF (bless effect)=true AND 3 pieces possible
g) heavy troops:(ress)&gt;14 with (strat move)&gt;1, best move first IF 2 pieces possible
h) heavy troops:(ress)&gt;14 IF 3 pieces
i) medium troops: (ress)&gt;10 IF 3 pieces
k) archers: IF Long-/Compound Bow

3) Build special troops [in non-fortress prov]
a) special commanders IF mage
OR
IF special troops ARE undead, amphibic, flyers, stealthy
b) build as many special troops as ressources, (availablemoney)/2, (commandvalue) allows


4) On turn 9,12,15 ... Build patrols at province w/o castle and
less than 20 troops on patrol
IF borders enemy prov.
OR has lab, but no castle
OR has only 2 land neighbours
OR has 3 neighbours, but only 1 owned

THAN BUILD
a) most mobile commander IF (numberoftroops)&gt;(commandvalue)
b) highest movement troop[for patrol]


5) Build troops at all castled prov. [high ress value first]
a) fill with light archers/slinger and light troops:(ress)&gt;3 (60%/40%)

6) Build troops in prov
IF borders enemy prov.
OR has lab, but no castle
OR has only 2 land neighbours
OR has 3 neighbours, but only 1 owned
a) heaviest inf (50%)
b) archers (no matter what)</pre><hr />


All times are GMT -4. The time now is 08:34 AM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2025, Shrapnel Games, Inc. - All Rights Reserved.