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]
To: badamson@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#14923) Stupid AI Building Wants
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 13 Mar 2006 01:06:54 -0800
Reply-to: bugs@xxxxxxxxxxx

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

On Sat, 11 Mar 2006, Benedict Adamson wrote:
> 1) The military adviser code pounds arbitrary numbers into a mess to
> produce a 'want' value

Yes, but I am not sure that the main problem is that the values are so
arbitrary. If you think in term of scheduling, the build code is a sort of
first-in-first-out algorithm, where the highest wants always overshadow
the smaller wants all the time. This is a problem with the attack wants,
because they are typically very high. But reducing them risks the AI not
building sufficient attackers.

I and Greg discussed at length various options, like actually building a
scheduler for the AI that would ensure that various considerations were
taking into account, and not just whatever seemed the most desired at any
moment. Another option that Greg suggested was simply to build a
statistical sample of whatever we had available, which is much simpler but
depends, I think, on the ruleset being cooperative to such an approach.

Of course, better want calculation helps for any scheduler.

> Use a different ruleset and the founders and settlers code will adapt
> well.

Actually, the founder code is built with smallpox as a basic assumption,
which is bad, but fast. It does badly under the traditional 'largepox'
settings using notradesize and mintradesize (however these settings are
quite dubious anyway, IMHO, and now largely obsolete).

> 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'm not sure why you think the current improvement wants are defunct. Is
this a structural problem, or just a problem of individual effect
calculations?

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

I've seen a lot of them in some savegames. I did not get the impression
that they were put to good use, though. But I could say that about a lot.

> 3) AI aircraft. Similarly.

I've seen them put to good use in past games.

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

I've seen work successfully in past games. Is this not the case anymore?

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

Greg argued that the net effect of Barracks is to make units 50% cheaper
(since they become 50% better, you need less units). The same would apply
to Airport, and it also has the benefit of airlift, but Airport costs a
lot more to build.

> 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?

IIRC, the current algorithm tries to find the best attacker it can build,
then the best attacker it could ever build, and bumps tech wants for the
latter. In order to work for your scenario above it should take into
account the number of bulbs needed for the 'best' attacker when
determining which would be the best attacker for research. Doesn't that
soud right?

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

That is just a problem with an individual effect calculation, no?

> 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.

I think the key problem here is that the AI is unable to think what would
be the case if it built a settler in a city with only +1 food surplus. In
many cases, it would end up with the +2 surplus necessary to support the
settler. Often it would have sufficient granary storage to support it
until it reached its destination. I think this is why I almost never have
a problem building settlers when I am playing Republic but the AI does.

I used to think this problem was quite tricky since we couldn't know what
the surplus would be if we reduced the citizen by one, but, assuming the
city will always first try to upkeep its units, we can just deduct 2 food
upkeep and the tile worker yielding the least food, and see what the
result is.

> 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?

We could start with a strategic planning module for the AI as a whole...

Actually, I do not think the current AI design of letting each city decide
for itself what is the best course of action is very sound.

  - Per





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