Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: (PR#2521) general effects framework
Home

[Freeciv-Dev] Re: (PR#2521) general effects framework

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: kaufman@xxxxxxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2521) general effects framework
From: "Ben Webb via RT" <rt@xxxxxxxxxxxxxx>
Date: Mon, 9 Dec 2002 09:45:47 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Mon, Dec 09, 2002 at 09:26:11AM -0800, Raimar Falke via RT wrote:
> On Mon, Dec 09, 2002 at 08:24:30AM -0800, Mike Kaufman via RT wrote:
> So there are non-immediate effects (persistent) which stay and effect
> other objects. And there are immediate effects which are one-shot and
> get removed immediately.

A point of comparison: impr-gen has no notion of immediate effects. They
stay for as long as the improvement exists, just like ordinary effects;
it's just that they are only iterated over when the improvement is
constructed. Personally, I think Mike's implementation sounds better in
this regard though.

> > If EFR_NONE is used, then the effect is not added to any lists. This is
> > needed (I think) for equiv_range not for effects.
> Can you explain it more?

I'd be interested to hear this too. ;)

> Isn't it possible to design something like this:
>  effect A depends that no effect B is active
>  effect B depends on A

As far as I can see, no, because there is no "not cond_eff" so you can't
construct effect A.

> > To put this in perspective, city_updates _will_ take longer since we have
> > to iterate through an undetermined number of effects to determine
> > trade/science/happiness/etc bonuses. The looping will have some overhead,
> > but for the default ruleset, we'll be adding just the same number of
> > bonuses (and the nice part is that all the bonuses (?) will be in the same
> > place ---  the effects lists).
> It is possible that Ben's implementation was faster here because it
> cached the per city bonuses? I can remember Ben wrote this.

The city bonuses are cached every time you update the effects. But this
cuts down on the number of effect iterations required, not the number of
effect updates, just to make this clear. I'd be surprised if this wasn't
a _lot_ faster, since you want to calculate city bonuses far more
frequently than you update effects. The evaluation of the bonuses
themselves should actually be faster with impr-gen than with current
CVS, in fact, since you're not having to check for the existence of
a load of improvements, but I doubt the difference is measurable! This
does of course come at the expense of memory, though.

        Ben
-- 
ben@xxxxxxxxxxxxxxxxxxxxxx           http://bellatrix.pcl.ox.ac.uk/~ben/
"And you'll never gain weight from a doughnut hole"



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