[Freeciv-Dev] Re: [RFC] Caching AI values
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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.
> > Counter increment: hooked up on events
> > --CITY_LOSS,
> > --CITY_ACQUISITION
> >
> > Cached value: list of all friendly refuelling points
> > (basically the list of all cities + non-occupied airbases + ally cities)
> > Counter increment: hooked up on events
> > --CITY_ACQUISITION,
> > --ENEMY_DESTROYED (it could have been occupying an air-base),
> > --END_OF_PHASE (assuming that city loss can occur only during the enemy
> > movement phase)
> > Note the event ENEMY_DESTROYED is higly unlikely to change the cached
> > value, so we can skip it here.
>
> Same as above.
>
> > So, ideally,
> > 1. The counters would be subscribed to certain events.
> > 2. This "subscription" can be hardcoded.
> > 3. Counter <-> cached value relation can be flexible: one counter can
> > expire several caches.
> >
> > Other possibly useful cached values:
>
> > enemy cities on the continent (useful for global invasion
> > management, diplomat code etc)
>
> It has to be tested how much faster this would be compared to a
> for each player:
> if enemy player:
> for each city:
> if city.continent==continent:
Same as above: you have 100 units, why do this cycle 100 times if you can
just cache the list?
> > enemy targets reachable by unittype around a city (useful for
> > bombers etc)
>
> for each unittype:
> for area accessible with this unittype around city:
> if tile has enemy unit:
>
> should be fast.
and same here yet again
besides you don't just count enemy targets, you calculate the want, which
uses win_chance
> > wonders built on a continent (useful for caravans and not building
> > too many wonders at the same time).
>
> Same as the first: list of cities for a certain player and continent.
In this case it might be faster.
G.
- [Freeciv-Dev] Re: [RFC] Caching AI values, Raimar Falke, 2002/04/03
- [Freeciv-Dev] Re: [RFC] Caching AI values, Raimar Falke, 2002/04/03
- [Freeciv-Dev] Re: [RFC] Caching AI values,
Gregory Berkolaiko <=
- [Freeciv-Dev] Re: [RFC] Caching AI values, Mike Kaufman, 2002/04/04
- [Freeciv-Dev] Re: [RFC] Caching AI values, Raimar Falke, 2002/04/04
- [Freeciv-Dev] Re: [RFC] Caching AI values, Mike Kaufman, 2002/04/04
- [Freeciv-Dev] Re: [RFC] Caching AI values, Raimar Falke, 2002/04/04
- [Freeciv-Dev] Re: [RFC] Caching AI values, Ross W. Wetmore, 2002/04/05
- [Freeciv-Dev] Re: [RFC] Caching AI values, Raimar Falke, 2002/04/06
|
|