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

[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: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>
Date: Sun, 13 Apr 2003 20:59:17 +0100 (BST)

On Sat, 12 Apr 2003, Per I. Mathisen wrote:

> Hopefully final version. Changes:

Unlikely ;)

>   - 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.  Not that it's 
a terrible mistake, I guess all players aim for Republic and have no 
wonders, so the cache is essentially valid.  But still, it is a mistake.

I still prefer the interface I outlined, static player_id and static turn 
are stored in aisettler.c along with the cached map.  Every time there is 
a call to find_best_city_placement, the cache is checked for validity and 
cleared if necessary.  This will introduce one extra check per 
find_best_city_placement call, but it's not much and solves the headache 
of thinking where to initialize the cache.

>   - 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.

>   - Correct caches city center (thanks Greg)

You welcome :)

Apart from these issues, I think aisettler.[ch] is ready.

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

> 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 in coordination: 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.  BTW, such map could also be used for explorers.  I am 
also unsure what the citymap actually holds right now.  The comment isn't 
very clear, especially the "maximum city radius".

I do think that the code looks great, is readable, but I think there is a
lot that can be improved.


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