Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2006:
[Freeciv-Dev] Re: (PR#14923) Stupid AI Building Wants
Home

[Freeciv-Dev] Re: (PR#14923) Stupid AI Building Wants

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#14923) Stupid AI Building Wants
From: "Benedict Adamson" <badamson@xxxxxxxxxxx>
Date: Sat, 11 Mar 2006 16:28:22 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=14923 >

Per I. Mathisen wrote:
...
> How is [the building wants code] broken? It does seem to work.
...

It does *seem* to work for rulesets similar to the default ruleset. 
Provided you do not look closely.

1) The military adviser code pounds arbitrary numbers into a mess to 
produce a 'want' value, whereas the founders and settlers code does a 
good job of trying to take into account the costs of founders, settlers 
and ferries, the kinds of terrain available, and the distances to 
objectives. It so happens that the numbers produced by the military 
adviser seem to be OK for the default ruleset. Use a different ruleset 
and the founders and settlers code will adapt well. The military adviser 
code will not. The improvement wants are similarly suspect. The problem 
here is that the numbers must be compared to decide what to build, so 
both must adapt to the ruleset. No amount of tweaking the military 
adviser or improvement want computations will ever fix that problem; 
only a replacement with something that computes a value that can truly 
be compared to the cost-benefit analysis done by the founders code is 
adequate: that means a dimensionally correct value measured on the same 
scale. We have gone to much trouble (through the effects code) to enable 
expression of rulesets different from the default; I believe the AI 
should be able to cope with them, but currently can not. I'd go further 
and say that the only rulesets worth producing are those quite different 
from the default, as they are the only kind that can give a really 
different game experience.

2) AI paratroopers. There is code executed for them, but does the AI 
ever actually decide to build any?

3) AI aircraft. Similarly.

4) Space race. Will an AI actually ever decide to build the Apollo 
Program and win by flying to Alpha Centuri?

5) The AI is obsessed with building Barracks and Airports, to the point 
of stupidity.

6) In the default ruleset, there is an almost linear progression in the 
best kind of military unit to build. But consider a ruleset in which 
there are variant technology branches (for example, one branch for spear 
men type units and another for cavalry type units), such that the AI 
ought to research the technologies on whichever branch it has progressed 
furthest. How would the AI cope? The Ancients ruleset has this feature 
to some degree. I suggest that rulesets with that feature are more 
interesting, because they present a real strategic choice to the player.

7) How many ferries is enough? The AI will happily build vast flotillas 
of unnecessary ferries: a long-standing problem.

8) The AI never builds some kinds of improvements that human players do 
(Harbours, for example). Why?

I believe my patch helps #1 and #6. I know it fixes #2--5, 7 and 8, 
having observed AI-only games running with it.

...
> Is not the problem then that the AI stops building settlers under
> Republic?
...

Yes.

An underlying problem is perhaps that the AI undervalues new cities, so 
that when it compares the benefit of building a Settler (the value of 
the new city) against the cost (the upkeep in shields and food) it 
concludes that they are not worthwhile. Perhaps it undervalues new 
cities because the AI does not consider the benefit to be gained once 
the new city has grown.

However, under Republic the AI faces the difficulty that some cities 
apparently can not support Settlers at all: most cities will have only a 
+1 food surplus, rather than the +2 required. It is reasonably common 
that none of the AI's cities have a +2 food surplus. In that case, it 
does not matter how highly the AI values new cities, because it believes 
it can not build the Settlers to found them. My observations of of the 
AI suggested that this was the main reason for the problem.

I think it is useful to compare the AI's play with my own. When I play 
the game, I use CMA pre-sets. In the rush-to-Republic phase I generally 
use a 'science' pre-set for all cities, which gives many bulbs. However, 
I usually tweak some cities to force them to produce surplus food to 
support Settlers. Once I have a proper government, I keep the larger 
cities on the 'science' pre-set and switch the smallest cities to a 
'growth' pre-set. The smallest cities are also usually the Settler 
producers (because, being recently founded, they are at the edge of my 
nation and therefore near settlement sites). I think the tweaking and 
use of different pre-sets is what prevents me falling into the trap that 
the AI can fall into. Another example of the AI lacking strategic 
planning. The code I added to reduce the Want for governments with 
expensive Settlers was an attempt to provide the AI with a little 
strategic planning; evidently it is not good enough. Perhaps what we 
really need is a strategic planning module for the AI, which sets the 
(food, shield, science, etc.) building priorities for each city, as I do?





[Prev in Thread] Current Thread [Next in Thread]