Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2003:
[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: Tue, 14 Jan 2003 03:19:42 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Mon, Jan 13, 2003 at 03:07:13PM -0800, Mike Kaufman via RT wrote:
> On Mon, Jan 13, 2003 at 03:46:59AM -0800, Ben Webb via RT wrote:
> > I'm not talking about nuts and bolts; I'm talking about your interface
> > being consistent. What's to stop a user feeding in a NULL city pointer
> > and then saying he wants City-range effects? You need to add error
> > checking to the function to enforce this. impr-gen just assumes that if
> > you put in a NULL city pointer you don't want City-range effects.
> with a city of NULL, then we'll iterate over all cities at City-range.

That seems rather counter-intuitive. Surely we have city_iterate already
for iterating over all cities? What if you don't want to iterate over
all cities? (As I've already said, there are a few places where you want
to consider only Player- and World- range effects.)

> > How does this iterator function deal with unit effects, by the way?
> in version 1 and the upcoming version 2, we don't. But if we demand that
> all unit effects are Local, I don't think it'll be much of a problem.

It's not a problem (and I'm not sure what the range has to do with it -
units are still affected by effects at Island range and above - and
City if they're in a city). I was just curious at how your iterator
function compared with that in impr-gen for unit effects.

> > Speed cost? I'd imagine it'd be faster if anything. (By bitfield, I mean
> > that defined in the C language - e.g. int active:1; int pending:1 etc.)
> I'll do this.

Well, subject to Jason's suggestion to use bool active:1;
bool pending:1, which seems eminently sensible, of course. (Although the
C standard does seem to suggest that a bitfield can only be of type int,
signed int, or unsigned int. I'm not sure if typedefs which just happen
to resolve to ints are acceptable.)

> > See the documentation of the ".outside" member in
> > data/default/buildings.ruleset in FreecivAC. They're not AC-specific
> > effects, but more a consequence of the improvement-centric way in which
> > effects were originally defined. For example, the Unit_Defend effect at
> > Player range actually only affects units in all of a player's cities.
> > You could imagine a similar Player-range effect that affects units in
> > the field as well (e.g. a tech that improves armour). A similar
> > distinction is made by AC for city Science or Tax bonuses - does a
> > Player-range Science bonus boost the Science output of each city (like
> > the Civ SETI Program) or the total Science output of your Civ (as the AC
> > government science bonuses do) ?
> I can well imagine such an effect. Why not an additional effect if that's
> what you want? that would be considerably easier than special casing a
> single effect.

Er, it's not just a single effect; you'd need to add additional effects
for Science_Bonus, Science_Pct, Tax_Bonus, Tax_Pct, Unit_Defend,
Unit_Attack, Unit_Attack_Firepower, Unit_Defend_Firepower, Unit_Recover,
Unit_Vet_Combat, Upgrade_One_Step, Upgrade_One_Leap, Upgrade_All_Step
and Upgrade_All_Leap, in the current code, and more if you add more unit
effect types. For example, in the default ruleset, the Unit_Recover
effect of United Nations works on units in the field, while the various
Unit_Defend effects work only on units in cities.

> for the bonuses, can you give me an example where the two results will 
> be different?

You are in a government which confers a 20% science bonus (e.g.
Knowledge). You have ten cities, each producing 1 science. This gives a
total science output of 10, plus 20% bonus, i.e. 12. A 20% bonus acting
on each city individually would give a per-city science output of 1.2,
which would be rounded down to 1, i.e. it would have no effect.

> > No, I mean the effect of a destroyed Apollo. That won't be added in when
> > you load the savegame, because the improvement itself is never added.
> > (See FreecivAC for handling of Player- and World- range destroyed
> > effects.)
> oh, yes. I've given some thought to this problem. Obviously we do not want
> to store effects in the savegame, so I'm thinking that the best way to do
> this is to add another Impr_Status I_DESTROYED or something similar, so
> that both the client and server know that the improvement's effects (that
> survive) should be added, but the building should not. This will also care
> of unique buildings that can't be rebuilt.

That might work, although you still have to look after destroyed buildings
that no longer have an owner - i.e. they belong to dead players.

        Ben
-- 
ben@xxxxxxxxxxxxxxxxxxxxxx           http://bellatrix.pcl.ox.ac.uk/~ben/
"Wit is educated insolence."
        - Aristotle



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