Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2001:
[Freeciv-Dev] Re: AI questions
Home

[Freeciv-Dev] Re: AI questions

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, Petr Baudis <pasky@xxxxxxxxxxx>, Raahul Kumar <raahul_da_man@xxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: AI questions
From: "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>
Date: Fri, 30 Nov 2001 21:22:50 -0500

At 11:18 PM 01/11/25 -0800, Raahul Kumar wrote:
>
>--- "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx> wrote:
>> Ruleset tech goals as well as those suggested by advisors are used to
>> compute the weight of all those under them in the tree. The tech goal
>> chosen is the one with the highest accumulated weight.
>>
>
>Ross, please mention filenames, function names and line numbers for tech
goals.

grep is a wonderful tool :-)

advdomestic.c, advmilitary.c, ai_manage*(), and too many routines in 
server/(grep for building or calls to the ai_manage*()) are the main ones.

>Can you describe the weights used in a bit more detail? I know you changed
the
>weights in your corecleanup patches and that resulted in radical behaviour
>change.  

Weights *should* be in the range of 0-100 for normal activities. Anything
over 100 is a *critical* must do action. One of the biggest changes was to 
impose the 0-100 limitation at various points for non-critical activities
that just had a bad computational algorithm that didn't respect this. 

A second was to make sure choice structs were properly initialized
and that unreasonable values were rejected. Having a stack address become
your weight value was very detrimental.

A third was to put a bias on a previously chosen value. The AI tends to
reevaluate its past decisions rather than remember them and thus can
thrash for trivial computational reasons. Typically a new choice should 
be (I used 50% most times) better than the one it remembers from the last 
turn, with of course the 100 ceiling on such bonuses. Note, you evaluate 
all new choices to get best choice, *then* compare to the previous turn's 
bonussed value to see if something really better has come up :-).

Most of the remaining tweaking was to add new rules to discourage poor
behaviour or simplify some existing ones as in settlers.c, rather than 
change existing weight constants. This was done by running the corecleanups 
(with lots of print debug additions and changes) in full debug mode and 
staring at the computations leading up to the poor behaviour.

>> But since the military advisor usually panics under danger threats and 
>> demands the best military possibility drowning out the rest, the game 
>> tends to follow a pretty standard track.
>> 
>
>Yes, I noticed this. What happens if you fix priority so that military units
>don't always have higher priority than anything else? My initial tries ended
>up with the ai always building improvs and wonders, too much so. The current
>ai also tends to flip flop. I've often noticed the ai changing wonder prod
from
>city to city. 

I "upped" the danger factor to discourage running away and leaving a
city undefended. This had the interesting effect of significantly
reducing the number of units running around, triggering danger reflexes
to build more units that usually went out and suicided so had to be
replaced. The effect is far more building improvements rather than
military wastage. Gregory commented that the civs were now overly
peaceful and boring, though the game often finished in the 1700s with 
a successful space race.

Adding some rules to try and maintain a minimal settler force (i.e.
1/3 of the total city count), resulted in a much more expansionist
Civ especially in the later game when Settlers aren't particularly
highly weighted in comparison. The result was a lot of Settler killing
atrocities, increase in bodyguards, and return to more militaristic
play as expanding civs and wandering units started interacting again.
Having a settler force also meant that the pollution problem in the
later game got fixed before it got out of hand. Also there were a
lot more railroads, and vicious battles as resources could be 
concentrated and expended much more efficiently, as well as larger
more developed cities.

Changing weights is *not* a simple cause and effect, but a much more
subtle change to a mildly constrained chaos engine.

And note that the current AI is really very flexible. It often needs
subtle control of things spiralling into undesirable behaviour, rather
than radical restructuring to offer completely different play style. 
This is better than balancing in some respects, as a balanced system
is often translated by programmers into too predictable.

>Do You Yahoo!?
>Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
>http://geocities.yahoo.com/ps/info1

And no I really don't think I have a good enough handle on the AI yet
to want to reinvent the system. My current thrust is still to work on
fixing local things, or trying to localize things so that the natural
interfaces and flow starts to coalesce a bit more. I hope/suspect, that 
at some point a lot of the current code will become compact weighted
activities, and a new management layer will try to impose some longer
term strategies by manipulating a few key "personality" weights, or 
selecting activites with a stack-ish multi-unit or longer term 
collective choice system. The one could evolve into the other without
too much pain or loss of playability.

Cheers,
RossW
=====




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