Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: Advice re making building respect effects in rulesets
Home

[Freeciv-Dev] Re: Advice re making building respect effects in rulesets

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Thomas M. Payerle" <payerle@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Advice re making building respect effects in rulesets
From: Mike Kaufman <kaufman@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 4 Dec 2002 11:56:28 -0600

On Wed, Dec 04, 2002 at 10:10:05PM -0500, Thomas M. Payerle wrote:
> Hi,
> I'm new to the list, but have played (against AI) freeciv, and was thrilled
> when looked at the buildings.rulesets and saw how configurable things were.
> Was rather disappointed when I discovered that the effects field for buildings
> and wonders really is ineffective.
> 
> Over the Thanksgiving holidays, I have been hacking the code to actually try
> to make it honor the effects field of the rulesets, instead of the hard-wired
> by building type that exists currently.  Have had some success, migrating code
> from one framework to the other piecemeal, and will share with the list when
> approaching something usable.

I'm the maintainer who is currently in charge of this project. I also have
have some semi-working code that (at least preliminarily) addresses this
issue. I was going to wait until I had vetted it a bit more, but apparently
there's some interest out there, so I'll work on it a bit more and put it
out on the list at the end of this weekend I think.

I'll answer most of these below, but realize that 1. the code in CVS in
non-functional (you need most of the gen-impr patches [look for freecivAC])
and 2. a lot of the code already in CVS is going to get binned.

> 
> But I was having some questions that outside input might help with (not sure
> if they really have pat answers or not):
> 
> 1) What is the intended meaning of EFR_BUILDING range?  I did not notice any
> examples of it in use.  Is it only supposed to be for effects, and means that
> the effect has the same range as the improvement conferring it?  If that is
> the case, would it not be better to just replace EFR_BUILDING with the 
> improvements range when reading the ruleset file (i.e. do it once per game
> or so rather than once per city per turn or so)?

it is in use. Take a look at city walls. It means that the effect only
applies to the object generating the effect. It also may be useful in the
following example: a building has effects A and B. B has a cond_eff of C
and A has a cond_eff of B. B is EFR_BUILDING. In this case A will not be
active unless B is active. 

> 
> Or does it mean that it is effective on all (the player's?) cities that have
> that building?  But improvements have bldg_req, and effects cond_bldg fields
> for that.

no.

> 
> 2) Can someone explain the reason for having both EFT_CAPITAL_EXISTS and
> EFT_CAPITAL_CITY?  I understand they are really distinct effects, but only
> marginally so, for should CAPITAL_EXISTS be true if and only iff one of hte
> player's cities has EFT_CAPITAL_CITY?  I guess one could try to have an
> "AirForce One" (the name of US president's official plane) wonder as a 
> floating
> capital, with EFT_CAPITAL_EXISTS but not located in any one city, so that it
> is effectively impossible to take the player's capital (unless you take the
> city with the wonder).  I haven't migrated the code dealing with corruption,
> etc., that is dependent on distance from capital, so I suspect that would not
> work anyway.  

EFT_CAPITAL_CITY is a city-ranged effect. EFT_CAPITAL_EXISTS should be a
player-wide effect. though I could see one making EFT_CAPITAL_EXISTS a global
effect. that way a player needn't have EFT_CAPITAL_CITY to have
EFT_CAPITAL_EXISTS.

> 
> 3) It looks like wonders which should survive destruction of their city
> get attached to a city id of -1.   This would require that all corresponding
> effects either be EFT_NONE (?) or EFT_WORLD, as it is no longer able to be
> identified with either a player or a continent.  Is this a reasonable 
> limitation?

This is where the code in my posession really differs from the code in CVS.
in my code, effects are put into a list, and if they orginated from a
building (they don't have to be: a government, or tech, or nation suffices)
then an id attached to that effect identifies it as such. If the effect
survives the building's destruction, then it simply stays in the list
instead of being removed.

> 
> 4) Anyone think that a range EFR_ISLAND_ALL effecting _all_ cities on a given
> island, irregardless of owner might be useful?  (Actually, should probably
> be called EFR_ISLAND, with existing EFR_ISLAND renamed as EFR_ISLAND_PLAYER,
> as it really only effects cities of same owner on same island, but that 
> probably would be problematic renaming).  How about EFR_DISTANCE and/or
> EFR_DISTANCE_PLAYER, with a distance parameter, affecting all cities (possibly
> owned by same player) within specified distance of the city with improvement.
> Could make for some "offensive" wonders, like maybe "Voice Of America" (or
> whatever your favorite "propaganda" wing is), that causes EFT_MAKE_HAPPY with
> value -1 for  any city in range with Communist, Despotic, or Monarchist?
> governments?

It may be useful, but a nightmare to code. In fact there was a discussion
on this point in October. Take a look in the archives. Although Davide is
against it, I'm convinced that a player-oriented island-numbering system is
the way to go. since he won't code it for me, I'll have to do it myself...

> 
> 5) I am currently hitting problems deciding about additivity and redundancy
> of effects.  I am currently leaning towards looking at a list of all effects
> of a given type affecting the city in question, and then looking if the 
> improvements causing the effect are listed as obsoleting/making redundant one
> of the improvements causing a similar effect, and then choosing the "best"
> effect for the player.  After reducing the effects list by these groupings, 
> we "add" the remaining "best" effects together.  E.g, if we define the
> Great Wall to give time 3 defense, but a normal wall to be time 4 defense,
> then a ciy with a normal wall for a player with the Great Wall will have
> two EFT_UNIT_DEFENDS, with amounts of 300 and 400 respectively, but because
> one improvement makes the other redundant/obsolete, count that as one
> EFT_UNIT_DEFENDS of value 400 (the better value for the city owner).  If
> some other improvement, like "Minefield" also grants a EFT_UNIT_DEFENDS of
> amount 200, and is not obsoleted/made redundant by the walls, that gets added
> for a total of EFT_UNIT_DEFENDS of 600.

no, if great wall, suppresses the city wall's effect, then it will be 300.
as to the addition and multiplication rules and order of operations,
perhaps Ben would speak up. decisions on what is "best" should not need to
be made.

-mike


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