Apolyton Archive  |  Preserved copy of the Apolyton Civilization Site and its forums as they stood in September 2005. Read-only; nothing here can be posted to or replied to.  |  Forum index |  About this archive |  The 1998–2001 UBB forums
Today on Apolyton WARDELL INTERVIEW PROMO A.C.S. HISTORY CHAPTER 4 GET CIV4 /w FREE PLUS! A.C.S. PHOTO GALLERY GET A.O.M. V1.1
Apolyton Civilization Forums
main| civ2| civ3| civ4| smac| ctp2| ron| moo3| galciv| galciv2| alt| about|
ApolytonPLUS | register | search | faq | new posts | pm (-/-) | upload | members
hall of fame new! | civgroups | civgroups news | interviews | the column | radio | chat | directory | news | store | PLUS
Apolyton Civilization Forums : Powered by vBulletin version 2.0.3 Apolyton Civilization Forums > Civilization III > Civ3-Creation > AI unit building priorities
Show a Printable Version | Email This Page to Someone! | Receive updates to this thread | Report this to Apolyton news!
16.Sep: 7 NEW FILES
15.Sep: TRIAL + NO SLEEP = ONE GAME
13.Sep: PATCH THE PREVIOUSLY UNPATCHABLE

bottom of page
   - CIV3 CONQUESTS $29.99 - CIV3 from $9.99
Author
Thread    < Last Thread     Next Thread > Post New Thread     Post A Reply
Saint Marcus is offline Saint Marcus
King
Scio Me Nihil Scire
Jan 1970
time: 06:31
  Old Post 13-10-2003 19:09 Visit Saint Marcus's homepage!
Edit/Delete Message Reply w/Quote
#1 Report this post to a moderator
AI unit building priorities Help yourself to an AD-FREE life

What determens what unit an AI civ will build?

For instance, if the AI has a choice to build a 2-2-1 unit (cost 30) or a 3-3-1 unit (cost 60), with the same resources and roles, what will it build? The strongest one (in this case, the 3-3-1 unit)? The one with the best price-performance ratio (the 2-2-1 unit)? Both? And if it does build both, in what ratio does it build them?

I hope someone has any insights in this matter.

Gramphos is offline Gramphos
ACS Civ III Files Manager, Prince of Development
Chalmers, Sweden
Apr 2001
time: 06:31
  Old Post 13-10-2003 19:38
Edit/Delete Message Reply w/Quote
#2 Report this post to a moderator
Enter the AD-FREE zone

I've no idea how the AI determines the unit construction. But the AI strategies of the unit matters (and a multiple strategy unit is counted either as one of the strategies) The AI will try to get to a given ration between defensive and offence units (But I don't know that ratio)

Ozymandias is offline Ozymandias
Prince

Aug 2001
time: 00:31
  Old Post 16-10-2003 19:13
Edit/Delete Message Reply w/Quote
#3 Report this post to a moderator
Support Apolyton buy from Amazon

This has been the subject of a massive study at CFC:

http://forums.civfanatics.com/showt...y=&pagenumber=1

Synopsis:

Essentially, it seems (to me, anyway) that the AI is designed to select from among a HUMAN-designed and intelligently crafted and LIMITED forcepool.

The AI builds Defensive : Offensive units in the 55% : 45% range. It "understands" that highest attack value (at equal cost) equals the "best" attacker; ditto DF for defender. In a small force pool it seems to intelligently choose multiple HP units; not necessarily so in a larger pool.

The basic experiments were sets of test with ( (AF + DF) * HP ) = 10. The AI seemed to build well balanced units with a limited number of choices; once all choices were presented it "fell in love" with 1-9-1 defenders and geared heavily towards 9-1-1 and 8-2-1 attackers -- the problem with play balance can be seen here as these attackers become relatively easy to pick off; hence my opinion re: the limited forcepool.

The AI is also miserable with artillery and DOES NOT seem to take MF into account when "choosing" what units to build. For mods where heavy artillery production is desireable I think we're all eagerly awaiting the "auto-build" improvements in Conquests.

Best,

Oz

Last edited by Ozymandias on 21-10-2003 at 04:28

Saint Marcus is offline Saint Marcus
King
Scio Me Nihil Scire
Jan 1970
time: 06:31
  Old Post 20-10-2003 02:47 Visit Saint Marcus's homepage!
Edit/Delete Message Reply w/Quote
#4 Report this post to a moderator
Support Apolyton, buy Alpha Centauri

I read the entire civfanatics thread, and then did some testing of my own. The AI seems to favor one main defensive unit, and one main offensive unit.

the two tests conducted were with a modded map, rules, and civs. 1 human player, 3 AIs. The AIs had varying build-often priorities (attack units, defense units, attack+defense units).

they could all build the following units:

Warrior: 2-2-1-30 A/D
Skirmisher: 2-1-1-20 A
Spearman: 1-2-1-20 D
Chariot: 2-1-2-30 A

in this test, the three AIs build mostly the same units, with a small variation of 2 units per 100.

the results:

3% chariots
11% skirmishers
25% spearmen
61% warriors

the second test was essentially the same, only with warriors being Attack-only. This resulted in:

2% chariots
4% warriors
30% spearman
64% skirmishers

Both tests were repeated three times each, with similar results.

conclusions:

As was already established in Civfanatics: the AI builds the cheapest defensive unit it can build, when the city is defenseless.

The AI finds extra movement points (and thus, the ability to retreat) not worth spending extra shields on.

problems:

what determens what defensive or offensive units the AI will build?

In the second test case, it favored 2-1-1-20 units over 2-2-1-30 units, suggesting it merely looks at the A-stat, and then picks the cheapest. However, the first test case shows the AI prefering 2-2-1-30 units over 2-1-1-20 units. The only difference is that in the first case, the unit has both A and D flagged. Yet, it is safe to assume most of those warrios were Attacking units (since the number of purely defensive spearmen being build remained roughly the same). Maybe the AI simply favors multi-role units? Maybe the AI will only look at the stat it has been flagged for? In that case, in the second test the A-warrior simply has a 2 attack strenght, costing 30 shields, while the A-skirmisher also has 2 attack strenght, while costing only 20. But in the first test, the A-skirmisher has 2 attack for 20 shields, while the A/D-warrior has 4 Attack+defense for 30 shields. More testing will be done on this subject, but I suspect that this is the case.

Saint Marcus is offline Saint Marcus
King
Scio Me Nihil Scire
Jan 1970
time: 06:31
  Old Post 20-10-2003 04:19 Visit Saint Marcus's homepage!
Edit/Delete Message Reply w/Quote
#5 Report this post to a moderator
Support Apolyton, pre-order Civilization IV

new test:

pikeman 1-3-1-30 D
archer 3-1-1-30 A
swordman 3-3-1-60 A/D
cavalry 3-1-3-60 A

result:

cavalry: 5%
archer: 10%
pikeman: 35%
swordman: 50%

Results are much the same as the first test. Fast attack unit 3-5%, cheap attack unit 10%, cheap defense unit 25-35%, expensive multi-role unit 50-60%.

I do have to say that one of the civs showed a different result in one instance:

cavalry: 14%
archer: 22%
pikeman: 32%
swordman: 32%

It's probably a fluke, since in repeated tests the result didn't come up again.

Saint Marcus is offline Saint Marcus
King
Scio Me Nihil Scire
Jan 1970
time: 06:31
  Old Post 20-10-2003 04:42 Visit Saint Marcus's homepage!
Edit/Delete Message Reply w/Quote
#6 Report this post to a moderator
Full PM-box? Change here!

same test, only with swordmen being A-only

result:

swordman: 0%
cavalry: 5%
pikeman: 28%
archer: 67%

fairly similar as the earlier test with the A-only warrior. 5% or less fast and expensive units, 30% defenders, and 65-70% attackers.


of course: the number of defensive units depends highly on the number of cities. more cities=more defensive units.

GhengisFarb is offline GhengisFarb
Deity
I want my HAMBURGERS!!
May 2002
time: 23:31
  Old Post 20-10-2003 05:50 Visit GhengisFarb's homepage!
Edit/Delete Message Reply w/Quote
#7 Report this post to a moderator
Support Apolyton

How do Hidden Nationality options fit into their build scheme?

Ozymandias is offline Ozymandias
Prince

Aug 2001
time: 00:31
  Old Post 20-10-2003 07:14
Edit/Delete Message Reply w/Quote
#8 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Unscientific aka "annecdotal" evidence -- the AI likes specially flagged units.

At CFC I was trying to devise a benchmark unit (as I mentioned in my earlier thread) to see, e.g., how many AF/DF "Invisibility" is worth -- but that's not how the algorithm seems to function ...

More to follow as I play with flags this week --

Although may I suggest tests? -- Try using my "benchmark" 5/5/1 1HP* and simply decrease total AF+DF while adding each flag in turn and seeing if an "equilibrium" can be reached for each flag either (i) vis-a-vis AF/DF (all my work indicates that the AI does indeed evaluate 1AF = 1DF, even though it tends to produce more high DF units in the % range I mentioned above - ~55% D : ~45% O) or (ii) vis-a-vis differently flagged units compared against one another.

*I chose this as the benchmark as I wanted to be able to play around with 10% variations in "value" for the different tests - just trying to keep matters statistically equivalent - and this unit was the "obvious" midpoint of (AF + DF) * HP = 10

Best Regards,

Oz

Saint Marcus is offline Saint Marcus
King
Scio Me Nihil Scire
Jan 1970
time: 06:31
  Old Post 21-10-2003 01:00 Visit Saint Marcus's homepage!
Edit/Delete Message Reply w/Quote
#9 Report this post to a moderator
Support Apolyton, buy Galactic Civilizations

I'll try your tests after I'm done with mine. I'm working with some of the units for a scenario I'm working on, to see which ones the AI will build.

For this test, I lumped the 1st and 3rd test together.

Spearman 1-2-1-20 D
Pikeman 1-3-1-30 D
Skirmisher 2-1-1-20 A
Archer 3-1-1-30 A
Warrior 2-2-1-30 A/D
Swordman 3-3-1-60 A/D
Chariot 2-1-2-30 A
Cavalry 3-1-3-60 A

Results:

Chariot: 0%
Skirmisher: 0%
Archer: 0%
Warrior: 7%
Cavalry: 10%
Spearman: 14%
Pikeman: 14%
Swordman: 55%

The AI clearly prefers to have expensive strong units, to inexpensive cheap units. Spearmen were only build as first units in undefended cities, and after that they switched to the stronger Pikemen units. Likewise, the AI didn't build any chariots but went straight to the stronger (and twice as expensive) cavalry unit. The AI did build some "inferior" warrior A/D units, but clearly prefered the superior swordman A/D unit.

Once again, the AI seemed to prefer multirole units, over attack-only units.

Saint Marcus is offline Saint Marcus
King
Scio Me Nihil Scire
Jan 1970
time: 06:31
  Old Post 21-10-2003 01:25 Visit Saint Marcus's homepage!
Edit/Delete Message Reply w/Quote
#10 Report this post to a moderator
Support Apolyton, buy Civilization 2

Same test, only with warriors and swordmen being A-only.

Results:

Chariot: 0%
Warrior: 0%
Cavalry: 2%
Swordman: 3%
Archer: 3%
Spearman: 16%
Pikeman: 22%
Skirmisher: 54%


As expected, the AI prefered the cheaper A-only skirmisher/archer units over the A-only warrior/swordman unit, as shown in previous tests. Also as expected, the AI prefered stronger cavalry over chariots and pikemen over spearmen. But oddly enough...it prefered 2-1-1 units over 3-1-1 units. I can't explain it.

Saint Marcus is offline Saint Marcus
King
Scio Me Nihil Scire
Jan 1970
time: 06:31
  Old Post 21-10-2003 02:41 Visit Saint Marcus's homepage!
Edit/Delete Message Reply w/Quote
#11 Report this post to a moderator
Support Apolyton, buy GURPS/ Alpha Centauri

Repeating the last two tests, only with all units costing 10 shields.

Results (warrior/swordmen A/D)

Skirmisher: 0%
Archer: 0%
Chariot: 0%
Warrior: 2%
Cavalry: 4%
Spearman: 8%
Pikeman: 8%
Swordman: 78%

Results (warrior/swordmen A-only)

Archer: 0%
Chariot: 0%
Warrior: 0%
Swordman: 2%
Cavalry: 7%
Spearman: 12%
Pikeman: 27%
Skirmisher: 52%

This is seriously pissing me off....why would it prefer a 2-1-1 unit over a 3-1-1 unit of the same cost?

Saint Marcus is offline Saint Marcus
King
Scio Me Nihil Scire
Jan 1970
time: 06:31
  Old Post 21-10-2003 03:02 Visit Saint Marcus's homepage!
Edit/Delete Message Reply w/Quote
#12 Report this post to a moderator
Support Apolyton, buy Call to Power 2

Never mind any of the tests, there seems to be crap hardcoded in the game. AI unit building preferences are hardcoded per unit, that's why at times it seems to prefer inferior units to superior ones, simply because of hardcoded priorities. ****.

Last edited by Saint Marcus on 21-10-2003 at 03:15

Ozymandias is offline Ozymandias
Prince

Aug 2001
time: 00:31
  Old Post 21-10-2003 04:38
Edit/Delete Message Reply w/Quote
#13 Report this post to a moderator
Support Apolyton or Terrorists Win

quote:
Originally posted by Saint Marcus
Never mind any of the tests, there seems to be crap hardcoded in the game. AI unit building preferences are hardcoded per unit, that's why at times it seems to prefer inferior units to superior ones, simply because of hardcoded priorities. ****.


It's not QUITE that dire -- among a limited choice of units, the AI will make certain "intelligent" choices -- but, as I wrote above:

"Essentially, it seems (to me, anyway) that the AI is designed to select from among a HUMAN-designed and intelligently crafted and LIMITED forcepool."

Don't be too depressed -- you ran some good tests and it's knowledge about how the beast works that is most important. Understanding the CONSTRAINTS is and will be the key to decent mod-making -- making certain that the force pools available at any time fall within patterns the AI recognizes.

Granted, it's hardly "ideal" -- why an all-purpose AI selection algorithm wasn't developed is a mystery to me (and note that no Firaxians ever seem to comment in these threads ...).

Indeed, it wouldn't suprise me if the genesis of the Conquests improvements which will auto-generate units (and can be set to expire as Wonders currently do) arose in direct response to these limitations on the AI -- and, who knows, it might even prove to be an elegant solution ...

Keeping My Fingers Crossed,

Oz

Saint Marcus is offline Saint Marcus
King
Scio Me Nihil Scire
Jan 1970
time: 06:31
  Old Post 21-10-2003 18:11 Visit Saint Marcus's homepage!
Edit/Delete Message Reply w/Quote
#14 Report this post to a moderator
Avatar Enlargement: We've got the solution

After further testing, I'm wary about the AI making "intelligent" choices. I added some new units to the game (without replacing the old ones), thus they should be "clean", without hardcoded preferences. Yet, this isn't the case. First the AI seems to be "smart" in building the strongest units, but after changing the stats (making the strong weak and weak strong) the AI still builds prefers the same unit, eventhough it's weaker.


so first:

Pikeman 2: 1-3-1-10 63%
Spearman 2: 1-2-1-10 9%

then:

Pikeman 2: 1-2-1-10 56%
Spearman 2: 1-3-1-10 31%

Makes no sense whatsoever. First, I believed there were preferences hardcoded for the existing units (thus making the AI prefer longbowmen over archers, regarless of stats), however, this newest test with new and "clean" units seems to indicate that these preferences too are hardcoded somehow, somewhere.

It's frustrating.


(And Conquests improvements generating units? What if the Russians capture a German tank factory and suddenly recieve Panzer IVs every few turns?)

Ozymandias is offline Ozymandias
Prince

Aug 2001
time: 00:31
  Old Post 21-10-2003 19:27
Edit/Delete Message Reply w/Quote
#15 Report this post to a moderator
Inflate your Upload Space

quote:
Originally posted by Saint Marcus [...]
It's frustrating.

(And Conquests improvements generating units? What if the Russians capture a German tank factory and suddenly recieve Panzer IVs every few turns?)


Hi Saint Marcus,

I'll be doing a recap hopefully in the next week or so of all that's been learned and not learned, and I am personally very grateful for your efforts!

A quick question on your most recent test -- whose results are indeed disturbing (I'm an ex-programmer and can't even imagine why anyone would design an algorithm in such a fashion) -- how were the units flagged re: O/D?

Also, re: Soviets churning out Mk IVs, don't forget that, even in PTW, improvements can be tied to government types, which Soviets and Nazis presumably wouldn't share!

Best Regards,

Oz

Saint Marcus is offline Saint Marcus
King
Scio Me Nihil Scire
Jan 1970
time: 06:31
  Old Post 21-10-2003 22:04 Visit Saint Marcus's homepage!
Edit/Delete Message Reply w/Quote
#16 Report this post to a moderator
Support Apolyton, buy Civilization III: Complete

quote:
A quick question on your most recent test -- whose results are indeed disturbing (I'm an ex-programmer and can't even imagine why anyone would design an algorithm in such a fashion) -- how were the units flagged re: O/D?


both of those units were flagged D. There were other A units that the AI build, but only in small quantities. For some reason, it started building 70-90% defensive units. It prefered "Pikeman 2" over "Spearman 2", even if "Spearman 2" was the strongest. All flags were the same, the only difference between the units were it's name, graphics, and defensive strength. Cost was the same.

The same happened in the earlier tests. I changed the Longbowman to Skirmisher, and the AI seemed to prefer it over the Archer, even if the Archer had higher stats. In every test that featured both units, the AI prefered building the weaker Skirmisher unit over the Archer unit, even if both units cost the same.

I then believed it had something to do with the fact that the Longbowman is superior to the Archer in the regular game, and that AI-preferences might be hardcoded to follow the epic-game unit upgrade paths.

However, in the last test with the added and (thus "clean") Spearman 2 and Pikeman 2 units, the AI still prefered the Pikeman 2 to the Spearman 2, regarless of it's strenght.

In the both tests, on first turn, when all cities were undefended, it would build the Spearman 2 unit. Even when the Pikeman 2 unit had 1-3-1 stats, and costed the same. That's stupid enough as it is. However, after those first units, it would almost solely build the stronger pikeman 2 units.

But in the second test, with the Spearman 2 units being the strongest, it still followed the same behaviour. First a Spearman 2, then a bunch of Pikemen 2. Eventhough the Pikemen 2 was weaker. It still prefered it.

There must be something hardcoded in there somewhere. But I can't figure out what it is. Both units were "clean". Why did it still prefer one over the other, even if it's weaker?

Saint Marcus is offline Saint Marcus
King
Scio Me Nihil Scire
Jan 1970
time: 06:31
  Old Post 21-10-2003 22:06 Visit Saint Marcus's homepage!
Edit/Delete Message Reply w/Quote
#17 Report this post to a moderator
Support Apolyton buy from Amazon

quote:
Also, re: Soviets churning out Mk IVs, don't forget that, even in PTW, improvements can be tied to government types, which Soviets and Nazis presumably wouldn't share!


Hmm, good point. so it might indeed work.

but what about the scenarios where two civs share the same governement?

  < Last Thread     Next Thread > Post New Thread     Post A Reply
All times are GMT. The time now is 05:31.
Apolyton Time is 00:31.
    top of page
Rate This Thread:
Forum Jump:
Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is ON
vB code is ON
Smilies are ON
[IMG] code is ON
 




Contact Us - Apolyton Civilization Site - Support Us!

Building a better Apolyton through better information. Click here and take our poll!
Non-US visitors, click here!

Powered by: vBulletin Version 2.0.3
Copyright ©2000, 2001, Jelsoft Enterprises Limited.

Page generated in 0.0504 seconds (89.31% PHP - 10.69% MySQL) with 30 queries
Page Loading Time:

Support Apolyton: Amazon USA | Amazon UK | Amazon DE | Amazon FR |
Support Apolyton and get FREE PLUS, Buy from Chips&Bits: Galactic Civilizations | Galactic Civilizations: Deluxe Edition | Call to Power 2 | Civilization: The Boardgame | GURPS/ Alpha Centauri | Alpha Centauri | Civilization IV | Civilization III: Complete |


Front Page | Civilization IV | Civilization III | Civilization II | Call to Power II | Alpha Centauri | Master of Orion III
Rise of Nations | Galactic Civilizations | Galactic Civilizations II | Misc
Alt.Civs | Civ I | C:CtP I | About | News | Directory | Apolyton Store | Forums | Chat | Columns | Interviews | Newsletter
Scenario League | CSC | Clash of Civs | Spanish Site | CtP Maps | Cradle of Civ | WesW's Ctp1/2 Site | Civ3 Haven

apolyton.net | apolyton.com | civilization2.net | civilization3.net | civilization4.net | civilizationiv.info | calltopower.net | galciv.net | galciv2.net | moo3.net