[Freeciv-Dev] [RFC] Caching AI values
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
While doing flying stuff, AI computes a few values which should be cached
(like the number of air targets around a city). I can see 2 approaches to
such caching:
1. Compute these values at the start of the AI player's turn.
2. Compute these values as needed and then record them into a struct
together with the time they were computed.
I favour the second approach greatly. First, you don't have to trace the
spagetti AI calls to see to it that the values are initialized before
being accessed. Second, you don't have to decide beforehand if you should
waste CPU initializing them at all or it's too earely in the game to do
that (doesn't make much sense to count the number of air targets before
you discover Flight): in approach 2 they would be initialized as needed.
But to execute 2nd approach efficiently, one has to have the "time"
concept. I remember Raimar and Co talking about game.turn variable or
somethign like this. My time has to be a bit more precise, I think: there
are two AI movement phases per turn and "time" should distinguish
between "turn 10 start-turn" and "turn 10 end-turn".
Please provide me with insightful remarks and great suggestion on these
matters.
G.
- [Freeciv-Dev] [RFC] Caching AI values,
Gregory Berkolaiko <=
- [Freeciv-Dev] Re: [RFC] Caching AI values, Raimar Falke, 2002/03/19
- [Freeciv-Dev] Re: [RFC] Caching AI values, Gregory Berkolaiko, 2002/03/19
- [Freeciv-Dev] Re: [RFC] Caching AI values, Raimar Falke, 2002/03/19
- [Freeciv-Dev] Re: [RFC] Caching AI values, Tony Stuckey, 2002/03/19
- [Freeciv-Dev] Re: [RFC] Caching AI values, Gregory Berkolaiko, 2002/03/19
- [Freeciv-Dev] Re: [RFC] Caching AI values, Raimar Falke, 2002/03/19
- [Freeciv-Dev] Re: [RFC] Caching AI values, Gregory Berkolaiko, 2002/03/20
- [Freeciv-Dev] Re: [RFC] Caching AI values, Raimar Falke, 2002/03/21
- [Freeciv-Dev] Re: [RFC] Caching AI values, Gregory Berkolaiko, 2002/03/21
- [Freeciv-Dev] Re: [RFC] Caching AI values, Raimar Falke, 2002/03/21
|
|