.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 April 16th, 2004 04:17 AM

SUGGESTION: AI troop building algorithm
 
I think this should fix most issues with the AI troopbuilding.
I dunno how squad assembly or troop gathering from provinces work, so maybe this has to be tweaked accordingly.

Could anyone else than me use this algorithm in a test game to see if it works out? Could be that I'm quite biased and don't see obvious weeknesses...

for call buildcastle go here BUILDCASTLE

</font><blockquote><font size="1" face="sans-serif, arial, verdana">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">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 (numberofprovinces)&gt;(numberofcastles)*4
AND ((turnnumber)-(numberofcastles)*10)*10%=true SAVEMONEYTURN=true

1) Build troops at castles in following order
- 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)*3&lt;(numberofpriests)
- most heavily armed commander IF (turnnumber)&gt;5
- scout

- holy troop IF (bless effect)=true
- 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;11 IF 3 pieces
- archers: IF Long-/Compound Bow
- light troops: (ress)&gt;7 IF 3 pieces
- fill with light archers
[if there are multiple troops that fit a condition, mix equally]
[bless effect=true IF 3 pathes @4 OR 1@6/1@4 OR 1@9 or better]

2) Build special troops
- special commanders IF mage
OR
IF special troops ARE undead, amphibic, flyers
- build as many special troops as ressources, (availablemoney)/2, (commandvalue) allows

3) 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 (troopnumber)&gt;(commandvalue)
- highest movement[for patrol]</pre><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">edited:
if you have trouble deciphering the "code" part, use the font size option of your browser. There's no way I could fiddle with it using the BB code here...
***!!, *URL* tag doesn't work within *code* tag, so I had to put the URL for the castle buildind algorithm seperatly


[ April 16, 2004, 06:45: Message edited by: Arralen ]

Gandalf Parker April 16th, 2004 05:20 AM

Re: SUGGESTION: AI troop building algorithm
 
Finally. A real and testable suggestion which isnt overloaded with nation-specifics.

HotNifeThruButr April 16th, 2004 06:30 AM

Re: SUGGESTION: AI troop building algorithm
 
You spelled assassin wrong, I'm not a modder, but I think programming is very specific about spelling.

Arralen April 16th, 2004 06:36 AM

Re: SUGGESTION: AI troop building algorithm
 
I was thinking about something definitly more complex, but than it dawned to me that such a solution wouldn't work:

The more complex the building algorithm gets, the more you'll have to account for the complexity of the real situation.
But than we would be talking about writing a real, albeit small, AI for each nation seperatly. It's a bit a "all or nothing" situation here. So I went for "allmost nothing" (some call it "keep it simple, stupid", but I always wonder if the comma is ment to be there http://forum.shrapnelgames.com/images/icons/icon12.gif ").

Anyhow, here's my first draft, numbers will shurely have to be tweaked and some things won't work with the rest of the game/code in this way, but we'll see.


@HotNifeThruButr
http://forum.shrapnelgames.com/image...s/confused.gif
**** you, ****** grudger !! http://forum.shrapnelgames.com/images/icons/tongue.gif http://forum.shrapnelgames.com/images/icons/icon12.gif
This is pseudocode anyway - nothing to put in a mod file.
Would be cool to have AI scripts, but we won't see that for years I guess.
And it's "hashishin" or something like that (can't remember exactly) in reality. If anyone is intered, look it up for yourself. http://forum.shrapnelgames.com/images/icons/tongue.gif

[ April 16, 2004, 06:36: Message edited by: Arralen ]

HotNifeThruButr April 16th, 2004 07:16 AM

Re: SUGGESTION: AI troop building algorithm
 
http://forum.shrapnelgames.com/images/icons/shock.gif ... http://forum.shrapnelgames.com/image...s/confused.gif

Just tryin' to be helpful http://forum.shrapnelgames.com/images/icons/icon9.gif

Arralen April 16th, 2004 07:34 AM

Re: SUGGESTION: AI troop building algorithm
 
And I put a smily in there... maybe I'll put some more ...

But "asashin", "assassine", "ashassinne" or whatever wouldn't make any difference - the devs would have to turn it into C code anyway.

Players could print it out and try running a test nation/game with it, though. Think they wouldn't be that sensitive vs. spelling, would they?

http://forum.shrapnelgames.com/images/icons/icon7.gif

HotNifeThruButr April 16th, 2004 08:00 AM

Re: SUGGESTION: AI troop building algorithm
 
Oh, this is for the devs, I thought it was a mod. Anyways, Smilies keep the cosmos from caving in on itself thus destroying all existence!

http://forum.shrapnelgames.com/images/icons/icon10.gif http://forum.shrapnelgames.com/images/icons/icon7.gif http://forum.shrapnelgames.com/images/icons/icon12.gif http://forum.shrapnelgames.com/image...s/rolleyes.gif http://forum.shrapnelgames.com/images/icons/icon6.gif http://forum.shrapnelgames.com/images/icons/tongue.gif http://forum.shrapnelgames.com/images/icons/shock.gif http://forum.shrapnelgames.com/image...s/confused.gif

edit: hehe, I can fit another in

[ April 16, 2004, 07:00: Message edited by: HotNifeThruButr ]

Peter Ebbesen April 16th, 2004 10:47 AM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

Originally posted by Arralen:
I think this should fix most issues with the AI troopbuilding.
<font size="2" face="sans-serif, arial, verdana">I think (by a quick scan) that this one would have, e.g., Machaka wasting its money on a tiny elite force of Sorcereresses and Sorcerors (Mage Commanders, typically available for 50% of gold after upkeep) and Black Hunters (sacred and expensive) backed up by Machaka archers.

It would also keep AI nations from buying their very most powerful priest/mages (Anathemant Dragons, Grand Masters, Niefel Jarls, Vanadrotts, Grand Theurgs &etc) unless extremely wealthy. (> ~800 remaining after fortress building and upkeep).

That aside, the two worst potential weaknesses with your algorithm are that a) recruitment as presented is completely separate from the already existing force composition and b) recruitment is independent of location.

case a)
That means that in case of casualties, troops will not be recruited to replace capabilities lost, except by chance. If a lot of leaders bite the dust (e.g. through a determined assassination campaign on behalf of an enemy), no more leaders are bought to replace them than those who would be bought anyhow. Likewise, if a series of battles sees the light elements of the AIs force composition slain, it will not rush to reproduce the capability.

case b)
As a country grows larger, it becomes much more important where troops are recruited. The current AI recruitment strategy of hordes of troops all over the place is pretty forgiving of this case, as the troops bought are ususally quickly moving and can easily be gathered where needed. The AI can easily mass troops because, honestly, masses of sword fodder is what it recruits all over the placed.

Your recruitment strategy, based on fewer but higher quality troops, would work much worse with the "any location goes" for recruitment as it can take an obscene amount of time to move heavy troops from one end of an empire to the other.

I fear your entire step 1) is deeply flawed - as described, it seems incredibly easy to counteract as a human.

Step 3) seems intended to set up the AI for defeat in detail. Patrols of size 20 in each border province? Yes, PLEASE, today is a good day for somebody else to die.

-----------

Sorry for being such a spoilsport, but unless your AI takes the currently existing force composition and the front needs in mind when recruiting, I fear that a top-heavy recruitment strategy is one of the worst possible.

[ April 16, 2004, 09:48: Message edited by: Peter Ebbesen ]

Gandalf Parker April 16th, 2004 03:03 PM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

Originally posted by Peter Ebbesen:
</font><blockquote><font size="1" face="sans-serif, arial, verdana">quote:</font><hr /><font size="2" face="sans-serif, arial, verdana">Originally posted by Arralen:
I think this should fix most issues with the AI troopbuilding.

<font size="2" face="sans-serif, arial, verdana">I think (by a quick scan) that this one would have, e.g., Machaka wasting its money on a tiny elite force of Sorcereresses and Sorcerors (Mage Commanders, typically available for 50% of gold after upkeep) and Black Hunters (sacred and expensive) backed up by Machaka archers.

It would also keep AI nations from buying their very most powerful priest/mages (Anathemant Dragons, Grand Masters, Niefel Jarls, Vanadrotts, Grand Theurgs &etc) unless extremely wealthy. (> ~800 remaining after fortress building and upkeep).
</font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">Thats why I have been waiting for someone to actually go from complaining that the AI sucks, to actually taking a stab at developing some AI rules that are testable. People who have even tried something close tended to be obviously thinking of certain nations such as Ulm and Ermor, while leaving ones off like Pangaea and Jotun. Personally, Im a firm believer that if rules fail to approximate logic, then random might do better. Not completely random but some thrown in.

No extreme is ever going to be correct. A middle-of-the-road compromise is usually better. I would throw a dice roll in there. Maybe something setting the type of army being constructed. An elite force, a cheap mass, or a mage planning to fill up on summons. Then the AI can concentrate on filling that army for a few turns before sending it out. But the first step would probably be to test this central logic he came up with.

[ April 16, 2004, 14:04: Message edited by: Gandalf Parker ]

Nephelim April 16th, 2004 05:54 PM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

Originally posted by Gandalf Parker:
People who have even tried something close tended to be obviously thinking of certain nations such as Ulm and Ermor, while leaving ones off like Pangaea and Jotun.
<font size="2" face="sans-serif, arial, verdana">I don't know how polite it is to mention other games, but I was really impressed with the AI in galactic civilizations... Each race had its own AI, so things -could- be specific.

Though I understand illwinter is very small, so probably doesn't have the manpower for this approach.. (Though I don't know how big stardock is, either).

*grins* Perhaps we as a community can bribe the stardock guys to contribute http://forum.shrapnelgames.com/images/icons/icon7.gif

Gandalf Parker April 16th, 2004 06:37 PM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

Originally posted by Nephelim:
</font><blockquote><font size="1" face="sans-serif, arial, verdana">quote:</font><hr /><font size="2" face="sans-serif, arial, verdana">Originally posted by Gandalf Parker:
People who have even tried something close tended to be obviously thinking of certain nations such as Ulm and Ermor, while leaving ones off like Pangaea and Jotun.

<font size="2" face="sans-serif, arial, verdana">I don't know how polite it is to mention other games, but I was really impressed with the AI in galactic civilizations... Each race had its own AI, so things -could- be specific.
</font><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">That would be great, but....
GalCiv has been built entirely with AI as the goal. It started on OS/2 and was mentioned in any discussion on AI for many years before PC's and Windows caught up to handling the multi-threading it does. Now its on PC and other people are hearing of it.

Dominions was built on multiple humans playing in PBEM. Thats not to say that such an improvement would be impossible but it would be a large rewrite from the "single-thread AI for all the nations" which was tossed into the game. Especially since AI doesnt seem to be the Illwinter programmers idea of fun, it would be mostly a solo-player improvement, it would never be good enough, and would take alot from other projects.

Personally Im 95% a solo player and would love to see improvement in this. In fact Id prefer if it went player scriptable. But I think small logic tweaks is the most likely to get patched in.

Gateway103 April 17th, 2004 03:33 AM

Re: SUGGESTION: AI troop building algorithm
 
I would love to test your algorithm out, but unfortunately, between my thesis and exams, I wouldn't be free until after the 28th... So if you still need tester then, drop me a line. ^_^

-Gateway103

Jondifool April 17th, 2004 08:43 AM

Re: SUGGESTION: AI troop building algorithm
 
It could be just me thinking this but isn't dom2 quite suited to having different AI strategys. Something like giving the pretenders personality in form of different play and recruit styles. The game just needs a few archtypes to seleckt
from,and then the AI would not be that predicteble, and hopefully also more challenging.

the pseudocode in this exsample could be one, change the prioritys a bit and we have another.

Gandalf Parker April 17th, 2004 07:07 PM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

Originally posted by Jondifool:
It could be just me thinking this but isn't dom2 quite suited to having different AI strategys. Something like giving the pretenders personality in form of different play and recruit styles. The game just needs a few archtypes to seleckt
from,and then the AI would not be that predicteble, and hopefully also more challenging.

the pseudocode in this exsample could be one, change the prioritys a bit and we have another.

<font size="2" face="sans-serif, arial, verdana">All quite true. But unless the code is going to be split, it doesnt do us much good to psuedo code it.

Im not sure if psuedo-coding a change in the linear AI code will get put in either, it just seems more likely.

LDiCesare April 17th, 2004 10:23 PM

Re: SUGGESTION: AI troop building algorithm
 
Hi!
I don't get this one:
- priest w/o magic IF turnnumber*3 &lt; numberofpriests
If you have no priests, this condition will always be false and you'll never build any. Isn't that supposed to be a &gt;?
In general, I'm afraid these rules will let you build too many units that resist fights well and not enough fodder if you need fodder. It also won't adapt to the opponents. I don't like rules which don't adapt themselves to the context.

In my own game, I programmed the ai to adapt itself to the opponent. This means it tries to have a certain distribution of forces, based not on types of units -not moddable- but on unit abilities. So I basically say I want a distribution of f.e. 20% archers, 20% fast units, 40% heavy infantry, 10% leaders, 5% fortresses, 3% labs, 2% temples, and the ai looks at the current distribution of units it's got and builds new units in order to be able to reach that goal. This means you have a 'fitness' function evaluated for each unit you coudl build: If you need more priests, the system will pick a priest. If you need more mages, it will build a mage. If you need both, it will build a priest that also has magic powers.
I included fortresses, labs, etc. in the distribution because I see it as distribution of the money to be spent (and yes the figures are silly - you probably need more temples than labs). That way if you have a lot of troops and only one fortress, the fitness of building a fort somewhere will be huge, while building any kind of troop will be low. This one may be tricky since you can always do something with more troops but not with more fortresses, so you may want to exclude fortresses from the list. However, the original proposal of building fortresses once every ten turns if some conditions effectively means fortresses have a weight of 10% of all money spent.
I'd also suggest budgeting in advance: You plan to build this or that next turn, with a set priority. This lets you build up money for buildings when necessary.

Note it's possible or even desirable to use the enemies' distribution of forces as your own target if you can't think of a distribution yourself. In particular if you are swarmed with crappy light infantry, you may want o build more crappy troops yourself so your heavy infantry won't exhaust itself to death against huge hordes. Or decide that known enemies of type 'light infantry' means you must build more of the type 'archer', and 'undead' requires more 'priests'.

I coded something like that in my own game. You can check a more thorough explanation of the algorithm this: link if you are interested.

Arralen April 27th, 2004 12:26 PM

Re: SUGGESTION: AI troop building algorithm
 
Looks like no-one liked the idea that much that he put some time into testing it. As my time is severly limited, I didn't get very far in my test game 'til now.
Here's the result - I tried to move/attack in a fashion I've seen the AI doing it :

turn 0_______________________________________________
sidhe war godess
water6, earth 4, death 1
growth, luck, magic +1, DOM 4
fortified city .. 6 points left

against difficult AIs:
Abysia, Ulm, C'tis, Caelum, Pangaea, Vanheim, Jotunheim, Machaka

on Karan w/o waterways
indies 7, rare random events, rest standard

prov tax set to (100-unrest)% each turn
__________________________________________________ __
turn 1
start:
prov. 123, inc. 190, ress 80
treas. 400, inc. 190, upk. 17
builds:
sidhe lord 280/16
2 danoine sidhe 35/16
2 cu sidhe 16/1
1 longbow
remain: 6 gold/24 ress.
__________________________________________________
turn 2
treas. 165, inc 190
(123) ress 80
declares prophet
builds:
bard 75/5
2 danoine sidhe
1 cu sidhe
remain: 4 gold/42 ress.
__________________________________________________ _
turn 3
treas. 165, inc 190
(123) ress 80
random: witch Branwen A2S2N3
assembles for attack on
neigbouring prov (50 militia & LI):
Castellan, 15 HI, 6 LongB (fire achers)
Sidhe War Godess (5x Cast, Attack nearest)
Sidhe Lord prophet (divine bless, cast)
4 danoine sidhe (fire nearest)
3 cu sidhe (hold, attack rearmost: flank)
set up in middle of map
builds:
bard
2 danoine sidhe
1 cu sidhe
remain: 4 gold/42 ress.
__________________________________________________ __
turn 4
fight in (128)
5 archer(3), 20 militia (3), 10 light inf (6), 3 commander (11) LOSSES: 1 MI spearman(9)
random: 28 unrest in man
treas: 95, inc. 90, upk 36
(123) inc 84, ress 74
(128) inc 6, ress 12
attack on next prov (121): 40 LI, Crossb, HI
builds:
(123)
monk 30/1
4 tower guards
1 slinger
(128) nothing
remain: 6 gold/3 ress
__________________________________________________ _
turn 5
research Alt1, Evo1
fight in (121)
11 crossbow(5), 7 HI(13), 15 Jav(9), 3 Com(13)
LOSSES: 1 Longb, 3 HI, danoine sidhe retreat
(2 danoine sidhe go to 128, I'll leave them there)
treas. 63, inc 125, upk 38
(121) inc 5, ress 25
(123) inc 112, ress 105
(128) inc 8, ress 12
army goes back to (123)
builds:
def 2 in all prov
(123)
forester
1 cu sidhe
1 Longb
(121),(128) nothing
remain: 4/92
______________________________________________
turn 6
research Alt1,Evo2
treas 88, inc 158, upk 41
(121) inc 5, ress 26
(123) inc 142, ress 111
(128) inc 11, ress 13
priest moves to 121 to build temp
army assembles for attack on
neigbouring prov 116 (50 LI, Crossb, HI):
Castellan, 11 HI, 6 LongB (fire achers)
Sidhe War Godess (5x Cast, Attack nearest)
4 tower guards
Sidhe Lord prophet (divine bless, cast)
4 danoine sidhe (fire nearest)
5 cu sidhe (hold, attack rearmost: flank)
set up in middle of map
builds:
(123)
castellan
1 danoine sidhe
1 cu sidhe
1 slinger
(121,128) nothing
remain: 0 gold, 42 ress
__________________________________________________ ___
turn 7
power ranking
provinces: 1 / forts: - / income: 6 / gem inc.: - /research: 6 /dominon: 6 / army size: 8
research Con1, Alt1, Evo2
treas 135, inc 185, upk 45
(116) 17, 11
(121) 6, 27
(123) 152,126
(128) 10, 13
priest builds temple in 121
random: Beothric, knight of Stone lead-75
Jotunheim sighted in 86
2nd castellan set out to gather dainone sidhe from 128
armies attacks 106 [to cut of Jotunheims advance - as the AI always does] (60 woodsmen, blowpipes)
builds:
castellan
(116,121,128) nothing
remain: 2 gold
___________________________________________
turn 8
treas 169, inc 223, upk 45
(106) 23, 19
(116) 22, 12
(121) 7, 28
(123) 116,132
(128) 10, 13
fight in (106): 2 LOSSES: HI
prophet builds temple in 106 (next to Jotunheim prov.)
SWGss searches for sites
army sits idle
3rd castellan moves up with 1 d-/1cu sidhe
builds:
(123)
castellan
1 d-sidhe
(106,116,121,128) nothing
remain 1 gold

___________________________________________
turn 9
treas 176, inc 249, upk 48
....

I think it does quite fine 'til now, maybe it is a little bit fond of building castellans. Even bulding much more scouts wouldn't do that much good, so maybe I'll put in a %tage (growing with turns elapsed) that, if no mage is build, NO commanders is build unless there's a dire need for leadership.

Other suggestions?

Scott Hebert April 27th, 2004 05:38 PM

Re: SUGGESTION: AI troop building algorithm
 
Something I would change is the unrest part of that idea.

Taxes should be lowered by 20% for each 5 points of unrest in the Province. This results in 0 Unrest in the Province the next turn (assuming 25 or less Unrest) so that the Tax Rate can be raised back to 100%. Since unrest itself lowers the income of the province, this is preferable IMO than waiting for it to resolve itself.

Kristoffer O April 28th, 2004 07:22 PM

Re: SUGGESTION: AI troop building algorithm
 
Hmm, it's a bit difficult to follow without graphical representation. I should test it when I get some spare time.

Gandalf Parker April 28th, 2004 09:01 PM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

Originally posted by Kristoffer O:
Hmm, it's a bit difficult to follow without graphical representation. I should test it when I get some spare time.
<font size="2" face="sans-serif, arial, verdana">Family man, teacher, game developer. And you talk about testing this for us when you get "free time"?
http://forum.shrapnelgames.com/images/icons/icon9.gif
Now Im feeling guilty. I KNOW I have more free time than you do.

MStavros May 9th, 2004 05:50 PM

Re: SUGGESTION: AI troop building algorithm
 
Ah, so anyone came up with any good ideas so far in this topic?

Arralen May 9th, 2004 10:35 PM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

Originally posted by MStavros:
Ah, so anyone came up with any good ideas so far in this topic?
<font size="2" face="sans-serif, arial, verdana">You'll find the idea this thread is all about at the very beginning.

How good it is is debatable, though. And testable, so feel free to do a test game and report your findings.

[ May 09, 2004, 21:36: Message edited by: Arralen ]

HotNifeThruButr May 10th, 2004 03:56 AM

Re: SUGGESTION: AI troop building algorithm
 
How about something to discourage the building of units that don't go well together? Like if the comp has 60% of his already built + will be built forces (measured by gold + resource value, not unit numbers, so one knight will be "more" than 2 militia) as units without missile weapons (exclude javelins and other such minor missiles)and with less than, say, 13 prot, it will feel less compelled to make Archers, Comp bowmen, slingers (excluding Mictlan warriors with slings) and Longbowmen. Maybe have it roll a 3 sided dice, and if it lands on 1, proceed with archer building, if not, abort. Having 60% or more of your army being units with 13 or greater prot makes the three dice roll apply when the comp wants to make crossbowmen and other artillery types.

A way to improve location might be to might be by giving forts that are closest to an enemy province (not indep) that borders on your province a higher priority when building. This will be measured in "provinces away," so a fort that's two provinces away from an enemy will have a higher priority than one that's three provinces away. The capital might be exempt from this rule since there are cap exclusive units.

Maybe this can just work with unit Groups.

Edit: There might also be an impact on troop building depending on the neighbor and his force's composition. If the AI "sees" enemy forces with many hoplites, it will bump down light infantry, and missile units production and train more heavy infantry, heavy cavalry, and artillery/crossbow type units. If it sees tramplers with morale lower than 11 and no berserking, it will build more missile units. But always bump up production in units that are as big as or bigger than the enemy's tramplers.

Is that realistic?

Edit: This also makes it possible to reform the difficulty system, where instead of cheating on pretender points (that's the current AI difficulty setting, no?) we can enable more AI features at harder levels and disabling AI features at easier ones so it actually plays smarter/dumber. For example, an impossible AI might know not to mix Knights with Crossbows and orders non-combat commanders to flee instantly, or give assassins optimal assassination equipment whilte an easy AI wouldn't care about unit mixes in combat and wouldn't equip assassins with good equipment.

Edit: thought of something else. You could also factor in spell to troops synergy (I believe that's the right word for worky-togetherness). If the AI utilizes an army of light infants, it could be less inclined to cast flying shards, while friendly high prot units and hostile low prot units encourage it. It will not summon Air Elems when facing enemies composed of units bigger than the elems themselves. If it's got abysian or other heat resistant units, it will bump up desirability for heat spells.

[ May 10, 2004, 03:18: Message edited by: HotNifeThruButr ]

wombatsSAR May 10th, 2004 07:07 PM

Re: SUGGESTION: AI troop building algorithm
 
From what I recall of the GalCiv AI (I was a beta on the OS/2 implementation - not that that means much of my understanding and programming skills), I believe that the basic module could be moved from game to game - Stardock's first Windows game was ... The Corporate Machine (? - seems odd, but then I recall some problems with the originally proposed name for the game) - a biz empire game - and the same core AI from GalCiv was moved to it. Anyway, I'm wondering aloud if it might be possible to license and adapt that AI. ... Could be too messy and too expensive, but then again, Brad Wardell (GalCiv head programmer) is a nice guy (tm) and it might be possible/not-too-expensive.

That said, the conVersion work involved could be gross - much as I liked the game, the feature set was spartan compared to that of Dominions II and it's possible that there are just too many options for the AI to cope. However, the AI was quite good at what it did. Brad had said that it was possible to put in a nearly "perfect" game player (economically) but that it made a very boring opponent. They had to add some stuff to spice up its antics. And on top of that were the "skins" - a couple of which were actually adapted from the play styles of some of the players. For those that have played the game, "Martzian" (sp?-been too long) AI was from one of the betas.

Gandalf Parker May 10th, 2004 08:07 PM

Re: SUGGESTION: AI troop building algorithm
 
GalCiv is automatically the one to mention in any conversation about AI. But even Brad said it was years to get it converted to Windows. Id hate to think what it would take for windows, linux, mac-X, solaris. Some of Brads talking-papers on the subject might help.

Plugin AIs are great but any plugin has to have something to plug into with the right connections. It could be swappable modules, or importing player game saves (Brads method), or player scriptable (my personal favorite).

But if I want to say
</font><blockquote><font size="1" face="sans-serif, arial, verdana">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">IF ArmyA&lt;100 and ArmyA(LI)&gt;50 then buy HI
</pre><hr /></blockquote><font size="2" face="sans-serif, arial, verdana">then there needs to be labels for storing army and troop info. It needs to have been written or re-written to have lots and lots of grabbable labels.

But if its linear. Going thru each nation one at a time and just spending their resources.. then I can suggest that "Buy LI, LI, LI, LI" might be better as "Buy LI, LI, HI, Calvary".

Of course I should test it first. Anyone should be able to play a game as an AI. Only buying or building by the formula with no extra.. well OK, I couldnt do that. Not for more than a dozen turns or so. But SOMEONE might be able to.

[ May 10, 2004, 19:08: Message edited by: Gandalf Parker ]

HotNifeThruButr May 11th, 2004 06:20 AM

Re: SUGGESTION: AI troop building algorithm
 
Galactic Civilizations? I bought that game and thought it was a waste of 30 bucks. Didn't give it much of a chance though.

proteus May 11th, 2004 02:05 PM

Re: SUGGESTION: AI troop building algorithm
 
It is a good game with a good AI.
But I still recommend HoMM3. Awesome AI. Not as many units/spells like in Dom2, but still lot of different units/spells.
Also in Doms2, the majority of the units are 'useless', just like the spells.
Quantity <<< Quality.

Gandalf Parker May 11th, 2004 02:11 PM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

Originally posted by proteus:
It is a good game with a good AI.
But I still recommend HoMM3. Awesome AI. Not as many units/spells like in Dom2, but still lot of different units/spells.
Also in Doms2, the majority of the units are 'useless', just like the spells.
Quantity <<< Quality.

<font size="2" face="sans-serif, arial, verdana">Wow you really should play more. In 5 or 6 more years you will learn to say things like 'useless to me' instead of useless. I have found very little in the game that is useless but it has take about a year of purposely looking at things that seemed that way in order to find how they might be used. A player has to find the nation/strategy that fits their playing style (and then of course the rest would be useless to them)

Gandalf Parker May 11th, 2004 02:15 PM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

Originally posted by HotNifeThruButr:
Galactic Civilizations? I bought that game and thought it was a waste of 30 bucks. Didn't give it much of a chance though.
<font size="2" face="sans-serif, arial, verdana">For nearly a decade GalCiv has been mentioned in scientific papers and serious discussions about Artificial Intelligence. Its the game built around AI algorythms. The original OS/2 Version mostly but now that Windows can do multi-threaded tasking (kindof) Brad has tried to port it to Windows. Its still a work in progress. I own a copy but I must admit Im kindof waiting for the game itself to get more interesting to make the AI worthwhile

proteus May 11th, 2004 02:21 PM

Re: SUGGESTION: AI troop building algorithm
 
That is true...you were right, this was my example. pI am never using LI for example, but maybe it is useful as well, just not for the AI.]

Arralen May 28th, 2004 04:17 PM

Re: SUGGESTION: AI troop building algorithm
 
Quote:

Originally posted by Kristoffer O:
Hmm, it's a bit difficult to follow without graphical representation.
<font size="2" face="sans-serif, arial, verdana">ok, here it is:
http://www.politik-intern.de/bilder/...1/screeny1.png

[ May 28, 2004, 15:26: Message edited by: Arralen ]

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:31 AM.

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