Complete.Org: Mailing Lists: Archives: freeciv-ai: January 2003:
[freeciv-ai] Re: (PR#2644) AI needs 5400 years to get Republic

[freeciv-ai] Re: (PR#2644) AI needs 5400 years to get Republic

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ue80@xxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-ai@xxxxxxxxxxx
Subject: [freeciv-ai] Re: (PR#2644) AI needs 5400 years to get Republic
From: "rwetmore@xxxxxxxxxxxx via RT" <rt@xxxxxxxxxxxxxx>
Date: Wed, 1 Jan 2003 11:31:20 -0800
Reply-to: rt@xxxxxxxxxxxxxx

At 10:16 PM 02/12/31 -0800, Raahul Kumar wrote:
>--- "rwetmore@xxxxxxxxxxxx via RT" <rt@xxxxxxxxxxxxxx> wrote:
>> I think Anthony has suggested the right approach to this in his
>> summary, though the solution tends to go somewhat against his
>> usual views on detailed planning.
>> The idea is that production of certain elements like barracks 
>> should *not* be a standalone calculation but have a certain
>> feedback weight that depends on how many have already been
>> built and the current Civ size. There is a flavour of this in
>> *minimum* thresholds used in advdomestic.c in the corecleanups
>> if you want practical examples.
>Devil is in the details Ross. What weights should we go with ?
>I do however like your idea.

Actual numbers are perhaps best determined by letting GB playtest :-)

But in reality, they don't really matter a lot within fairly broad
sensible ranges - the fact that different personalities would have
different weights should make this obvious (and by now you should
not be surprised by that view :-). 

In different games some weights (==strategies) will be more effective 
than others, but that is why the same human doesn't always win or use 
the same stategy every time. That is also why weights are also "fuzzy"
and "what weights?" is not really as important a question as "what
kind of weights?".

Lastly, an AI that chooses dynamic strategies based on feedback is a 
second generation AI - do something simple first, then add the dynamic 
layer based on experiences gained and don't try and eat the whole pie 
in one gulp, or you will get mental indigestion :-).

>> The key elements are a (fixed) max/min threshold and a cumulative
>> weight that reflects the (civ-wide) level of some component.
>When you say fixed max/min threshold, I assume you mean in % terms.
>I.E 10% of cities should have barracks/No more than 30%.

Thresholds are dependent on what you are controlling. Don't be limited
in your imagination or make an a priori restriction of possibilities
during the brainstorming stage.

>I take issue with the fixed max/min threshold. There are certain
>such as aqueducts, marketplaces/libraries whose numbers can be better
>every 1-2 turns. 

Taking issue with your own limited view so you can move beyond it is
a good sign.

There are at least two models for applying the feedback constraints.
First one can do the simple and obvious count constraint
  if (!RANGE_CHECK(min, count, max)) want = 0
But a more useful approach is to build a feedback function with some
sort of linear, quadratic or other behaviour than simple step function
and the various thresholds and scores as its coefficients and variables.
  want = feedback_adjust(want, min, max, cummulative_score)
  want = feedback_adjust(want, &min[], &max[], &cummulative_score[])

You will note, the first is just a trivial hardcoded example of the
more general second forms.

Since, the cumulative_score may adjust anytime one adds a new city, 
grows population, or any other factor you build into them, calculations 
of want may change on a turn by turn basis, or may not. One might be 
able to optimize using the information for any given case, but the
need or frequency of this is largely an orthogonal issue.

>I.E A 20 city empire. It has no cities larger than size 7. Obviously, rather
>than a fixed want of 10% min Aqueducts, it should want 0.

If your overall Civ goal has no growth, economic or scientific goals, 
the thresholds for these might be very low. If you are describing 
something like an Aqueduct that has a very specific application use,
then its specific thresholds should reflect this. There is no reason 
the implementation could not reduce wants to 0.

You have just recognized that thresholds are dependent on what you 
are controlling, the game state and the personality desires :-).

But note, if one goes to a generalized vector of "factors" with
elements like aqueduct contributing to several factors in varying
proportion, i.e. it is a building, used for growth, it may be more
difficult to make the sorts of rigid planned decisions you suggest 
above on a global basis. In general the more strategic, the fuzzier 
the logic.

>> It should also be the case that individual want calculations take
>> into account the strengths of the particular city, and the city
>> production be tuned by the wants of a particular personality as 
>> well. Thus a food rich city (usually means lots of trade with
>> road building) should be tuned for growth, libraries and markets,
>> or settler/worker production, i.e. the elements that are most
>> population dependent. Shield rich cities should become factories
>> for military or non-military units, wonders and defensive strong
>> points. And in choosing production and worker tasks, a city should
>> have a feedback from the personality desires for vector components.
>> A Ghandhi would value population growth (food and social improvements),
>> while a Bismark would go for production, science and military
>> elements (in that ranking) over growth.
>So per city weights as well ? Which one dominates ?

Right now, base want calculations pretty much return constants with no
game state feedback. Get rid of some of the current horribly detailed 
constant evaluations and introduce a wider scope of simpler effects.
Since (strategic) want can vary from "0" to "x00", precision in computing
the tenth decimal place is not really as important as having a wide 
understanding of quickly/crudely evaluated effects.

Since a functional feedback adjustment can use both local and global 
effects, the answer to your question is dependent on the particular 

Stopping a local city from building walls to repel an invasion because
you only implemented a global/strategic building quota and did it as a 
step function is probably a foolish set of implementation decisions.

>> The combination of the two will insure that cities that are best
>> suited for certain production elements, or most in need will be
>> the ones to exceed the thresholds, while others will be held back
>> in over supply scenarios, and instead turn to some of the other
>> opportunities. This will cause a more balanced overall growth, 
>> but a much more varied (and hence interesting) mix of individual
>> elements.


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