Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2002:
[Freeciv-Dev] Re: [RFC] Caching AI values
Home

[Freeciv-Dev] Re: [RFC] Caching AI values

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Mike Kaufman <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Cc: Gregory Berkolaiko <Gregory.Berkolaiko@xxxxxxxxxxxx>, "Ross W. Wetmore" <rwetmore@xxxxxxxxxxxx>, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [RFC] Caching AI values
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 4 Apr 2002 18:13:12 +0200
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Thu, Apr 04, 2002 at 10:10:14AM -0600, Mike Kaufman wrote:
> On Thu, Apr 04, 2002 at 06:01:27PM +0200, Raimar Falke wrote:
> > On Thu, Apr 04, 2002 at 09:36:07AM -0600, Mike Kaufman wrote:
> > > On Thu, Apr 04, 2002 at 11:58:39AM +0100, Gregory Berkolaiko wrote:
> > > > On Wed, 3 Apr 2002, Raimar Falke wrote:
> > > > 
> > > > > On Sat, Mar 23, 2002 at 03:09:07PM +0000, Gregory Berkolaiko wrote:
> > > > > > 
> > > > > > But first a couple of examples:
> > > > > > ======================================================================
> > > > > 
> > > > > > Cached value: list of all own refuelling points of the type 
> > > > > > FUEL_CITY
> > > > > > (basically the list of all cities)
> > > > > 
> > > > > IMHO the speed improvement for this is very small if only cities are
> > > > > included. The problem are the airbases. To get these you have to
> > > > > iterate over the whole map. What about a global airbase list? 
> > > > > Mantained by set_special and clear_special.
> > > > 
> > > > Yes, this is very good idea.
> > > > Still if you have 10 bombers and you consider them one-by-one, it make 
> > > > sense to build the list only once.
> > > 
> > > no, this isn't a good idea (checking for airports in set/clear_special 
> > > that
> > > is). We should maintain the list where we create and/or destroy airports,
> > > otherwise we have to do an airport check the billion other times we use
> > > set_special.
> > 
> > So you are against a:
> > 
> > void map_set_special(int x, int y, enum tile_special_type spe)
> > {
> >   MAP_TILE(x, y)->special |= spe;
> > 
> >   if (contains_special(spe, S_ROAD) || contains_special(spe, S_RAILROAD)) {
> >     reset_move_costs(x, y);
> >   }
> > +  if (contains_special(spe, S_AIRBASE))
> > +    add it to the list
> > }
> > 
> > ??
> > 
> > You are for (in update_unit_activity):
> >   if (activity==ACTIVITY_AIRBASE) {
> >     if (total_activity (punit->x, punit->y, ACTIVITY_AIRBASE)
> >         >= map_build_airbase_time(punit->x, punit->y)) {
> >       map_set_special(punit->x, punit->y, S_AIRBASE);
> >       unit_activity_done = TRUE;
> > +     add to list
> >     }
> >   }
> 
> yes, I would rather it be here rather than in set_special. Mainly because
> it does the same exact thing, but gets called _a_lot_ less.

Ok.

> > > Besides, don't we have to have a list for each player?
> > 
> > You can't own specials.
> 
> my bad, I was thinking in the stupid server-ai paradigm where the ai has
> access to the entire map. 

> The ai shouldn't add airbases it can't see to its list. when ai
> becomes non-cheating, this won't be a problem.

Ok.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  This message has been ROT-13 encrypted twice for extra security.


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