Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: CMA
Home

[Freeciv-Dev] Re: CMA

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Raahul Kumar <raahul_da_man@xxxxxxxxx>
Cc: freeciv development list <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: CMA
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 25 Sep 2001 17:13:25 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Tue, Sep 25, 2001 at 05:14:11AM -0700, Raahul Kumar wrote:
> I've been reading the sma6.diff you sent me. The agents needed for a full ai

Maybe we should start with a minimal set of agents.

> Manage_diplomacy
> (subagent manage diplomat?)
> Manage trade
> How many caravans from which cities to which other cities
> Manage techtree

All the three agents above aren't needed in a starting set of agents.

> manage city_improvements(goes into city management?)

This is definitely needed in the base set. And no this shouldn't be
part of the CMA.

From an old email:
-----------------------------------------------------
Firstly City Management Agent (CMA) should be renamed into Agent of
Citizen Management (ACM).

There should be an Building Advisor (Agent).
============================================

This agent doesn't really carry out any action. There would just be a
query method.

Input:
  - type of the continuation of the current production (don't cancel,
  maybe cancel, cancel)
  - city id
  - weights for the 8 roles (food, shields, trade, gold, science,
  luxury AND size (to put aqueduct and sewer system) and unhappiness
  (for temple and co))

Output:
  - improvement id for a normal building or NONE
  - turn at which the above building will be finished
  - improvement id for a wonder or NONE
  - turn at which the above wonder will be finished

Implementation:
  There must be a value for each possible improvment (normal building
  and wonder) and each role. I will call this gain. So the gain of a
  library for science will be >0 and for all other roles 0.

  The gain has to depend on the city. It is for example not useful to
  build a market if there are 0 gold collected by taxes. Same for a
  sewer system if the city size is 3. Furthermore the gain has to be
  decreased over time for improvements which can get obsolete. To
  implement some kind of planning in advance if should be possible to
  soften the jump. So instead of jumping from city size 7 to 8 for the
  Sewer System from 0 to a value 100 (for example) if may more useful
  to return 5 at city size 6 and 20 at size 7.

  The gain could just be the amount of food/shields/trade/... such a
  building could give the city.

  To let the caller decide if it wants to take the longer time for a
  wonder the adviser returns one and let the caller decide.

Another agent we need is 
the real City Management Agent aka Mayor
========================================

It will manage all the civil aspects of a city.

Input:
  - weight for the roles of the city (settler breeding, maximize
  size/production/gold/science)
  - buy limits (absolute amout of gold, percent of global gold,
  minimal turns gained)
  - accepts orders for military units and military buildings (this
  allows a split in the Major and the Proconsul (I'm not sure if the
  word is the right one))
  - city id

Output:
  - none

Uses:
  - ACM, Building Advisor

Description:
  Chooses production based on roles. Buys production if
  allowed. Increase the unhappiness role of the Building Advisor if the
  number of entertainers ACM sets are too high.

  The military orders should have some kind of seriousness attached
  (for example a "complete it in n turns or less or forget it" field)
  to schedule them into the civil queue.

City Defence Agent aka Proconsul.
=================================

Input:
  - city id

Output:
  - orders for the corresponding CMA of the city

Description:
  Should ensure that the city has MINIMAL military defense.

Implementation:
  I simple one would request/ensure two defending units where one is
  the best available defending unit. If would also request city walls
  at the sight of the first enemy. It would request barackes if there
  were more than x military units build in this city.

  A full fledged implementation could be much more
  complicated. Assessing danger of enemies especially with fog of war
  is difficult. There will also at the time of the railroad a
  differentiation between normal defending forces and temporary cunter
  attacking forces. These can be transfered from other cities.

  The simple solution I outlined above is simple to implement and
  maybe enough.
-----------------------------------------------------

I still think this is a good plan.

> Manage wonders
> 
> I have run into what I call the Great Library wonder problem as far
> as wonder management goes.  You may recall that the Great library
> only gives you techs two other civs have researched.  Therefore as
> number of players in the game goes down the value of this wonder
> sharply decreases. I've been trying to write a general function
> that computes the value of a wonder for the AI based on
> 
> a) number of turns wonder is in effect
> b) amount of techs req to get wonder
> (if it is possible to build 3 wonders before you get one really great wonder)
> c) no of players in game
> 
> and cannot think of a way to make it general enough. The wonders can
> be changed via rulesets, so if someone adds a new wonder that relies
> on the no of people in game: how does the AI cope?

I haven't tought about this but at first look it looks like a hard
problem indeed. IMHO there have to be a wonder management. This wonder
management has to be control over a set of cities to work
efficiently. Since at least now the effect of wonders are hardcoded
anyway in the code I see no problem of also use hardcoded values (in
the first version) of the wonder management agent.

> I think a few lines can be deleted from the function real_optimize_worker
> 
> if (missing[FOOD] < 0)
> +      missing[FOOD] = 0;
> +    if (missing[SHIELD] < 0)
> +      missing[SHIELD] = 0;
> +    if (missing[TRADE] < 0)
> +      missing[TRADE] = 0;
> +
> 
> Possible to delete the above lines entirely. Simply substitute
> 
> +    /*
> +     * we satisfied the wish, but we need to put all workers 
> +     */
> +    if (missing[FOOD] <= 0 && missing[SHIELD] <= 0 && missing[TRADE] <= 0) {
> 
> for the current
> 
> +    /*
> +     * we satisfied the wish, but we need to put all workers 
> +     */
> +    if (missing[FOOD] == 0 && missing[SHIELD] == 0 && missing[TRADE] == 0) {

No. Because we use the array missing also latter.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Using only the operating-system that came with your computer is just
  like only playing the demo-disc that came with your CD-player."


[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] CMA, Raahul Kumar, 2001/09/25
    • [Freeciv-Dev] Re: CMA, Raimar Falke <=