Complete.Org: Mailing Lists: Archives: freeciv-dev: June 1999:
Re: [Freeciv-Dev] struct government + AI
Home

Re: [Freeciv-Dev] struct government + AI

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] struct government + AI
From: "Bobby D. Bryant" <bdbryant@xxxxxxxxxxxxxxx>
Date: Tue, 08 Jun 1999 22:45:05 -0500

Sune Kirkeby wrote:

> Now that the core functionality of the struct government
> patch has stabilized, it is time to update the AI, so
> that it may choose governments based on information given
> to it in struct government and not based on hardcoded
> evaluations of governments.
>
> For this I could use some input on how people imagine it
> might be done.  ...

I'm not familiar with the existing AI code, so the following may be
similar to what's already implemented, or on the other hand perhaps
completely incompatible with it, but if I were coding it from scratch
I'd do something like this:

Enumerate a list of "behavior classes" to control the AI's global
strategy at any given time.  For starts, use something like:

    Expansion (for grabbing the most/best land before someone else does)

    Peace_and_Prosperity (for growing big cities and doing lots of
research)
    Limited_War (for fighting a nuisance war without totally shutting
down the economy)
    Total_War (for when a war matters more than anything else)

Other classes could be added later, if more subtlety is desired.

Then, for each behavior class define a static evaluation function that
can be applied to a government's definition to return a scalar.  When
the AI is choosing a new government, it would apply this function for
it's current behavior class to each government type that it currently is
allowed to use, and it would pick the government type that returned the
highest value for the evaluation function.

The functions would work by assigning a multiplier for the various
numeric descriptors of a government, and perhaps assigning a flat
integer value to other types of features.  For instance, during
Expansion you would presumably want lots of settlers, so you would apply
a negative multiplier to a government's costs for maintaining Settlers
(higher cost --> "more negative" product --> lower value returned by
function).  Similarly, during Total_War you would want lots of troops,
so you would apply a negative multiplier to the cost of maintaining
troops in the field.

It would take some guesswork and playtesting to get the evaluation
parameters set right, but it shouldn't be too much of a problem.  I
someone gets ambitious, it might be possible to write a client AI that
adjusts the parameters as it plays, and thus learns from its mistakes.
(A genetic algorithm should do this learning task well, if only you
could get it to participate in enough games. Who knows, maybe this kind
of thing will give some of us an excuse to write game programs for our
theses!)

Bobby Bryant
Austin, Texas

p.s. -- Things could of course be more general than above.  A single
function could do the trick, if you passed the behavior class in as a
parameter.  Also, if you don't like all those negative multipliers in
the examples above, reverse the sense and let the scalar returned by the
function by a "cost", so that the lowest value is best, rather than the
highest.



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