Complete.Org: Mailing Lists: Archives: freeciv-ai: April 2003:
[freeciv-ai] Re: New settler code
Home

[freeciv-ai] Re: New settler code

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv AI development <freeciv-ai@xxxxxxxxxxx>
Subject: [freeciv-ai] Re: New settler code
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Sat, 26 Apr 2003 20:00:30 +0000 (GMT)

On Sun, 13 Apr 2003, Gregory Berkolaiko wrote:
> > - Removed bug which made us use other players' caches (thanks Greg)
>
> I don't see any real changes. When we call contemplate_new_city, we will
> still use cache from the player who did auto-settlers last.

No way. Look here, this is the main AI at end of turn loop:

 players_iterate(pplayer) {
   if (pplayer->ai.control) {
     ai_settler_init(pplayer);
   }
   auto_settlers_player(pplayer);
   if (pplayer->ai.control) {
     ai_do_last_activities(pplayer);
   }
 } players_iterate_end;

ai_do_last_activities -> ai_manage_cities -> contemplate_new_city

> > - We now consider the possibility of adding settler to existing city.
>
> When you consider adding to city, (so city is not virtual in
> fill_cityresult) your center will be taken but you still subtract
> something when you deal with waste/corruption.

Thanks. Fixed.

> The government-related changes I would prefer as a separate patch, if
> possible.

Ok.

> > citymap.[c|h] files are unchanged and are not attached.
>
> Now I finally got to citymap and I don't like the concept. First of all,
> it means that AI players work incoordination: they do not try to make
> cities on others' spots. Secondly, I don't like mixing server and AI and
> here you have server creating a city and putting it on AIs map. I feel
> that citymap should be maintained on per-player basis by players
> themselves. This will lead to more CPU usage, but I think this is the
> only proper way.

Ok, changed it to your way. Now we recalculate the map every turn for
every AI player. I also moved it into common/aicore/ since it now can be
used for client-AI without changes.

I had to drop the 'reserve extra tile in addition to city center' code
from citymap, though. :( Doesn't seem like the code took a heavy penalty
in terms of achievement, though.

> BTW, such map could also be used for explorers.

Please do.

> I am also unsure what the citymap actually holds right now. The comment
> isn't very clear, especially the "maximum city radius".

/* CITYMAP - reserve space for cities
 *
 * The citymap is a large int double array that corresponds to
 * the freeciv main map. For each tile, it stores three different
 * and exclusive values in a single int: A positive int signifies
 * a maximum city radius. A value of zero indicates that the tile is
 * presently unused and available. A negative value means that this
 * tile is occupied and reserved by some city or unit.

'maximum city radius' is all the tiles that one city can work. We increase
positive value (the crowdedness of a tile) for each city that can use it,
unless it is reserved, in which case it is totally off-limits.

I will post the new version soon. Need to make up some numbers to keep
Raimar happy first ;)

  - Per



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