 |
|  |
 |
|
Ozymandias
|
|
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
|
 |
Scio Me Nihil Scire
Jan 1970 time: 06:31
|
|
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.
|
|
|  |
 |
|
Ozymandias
|
|
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
|
|
|  |
 |
|
Ozymandias
|
|
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
|
 |
Scio Me Nihil Scire
Jan 1970 time: 06:31
|
|
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
|
|
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
|
 |
Scio Me Nihil Scire
Jan 1970 time: 06:31
|
|
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?
|
|
|  |
All times are GMT. The time now is 05:31. Apolyton Time is 00:31. |
top of page
|
|
|
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
|
|
|
|
|
|