You are not logged in

Improved messages about new extra building technologies.
- If there's just one extra type automatically built to city centers, mention
that extra type in the message
- Omit "New hope sweeps..." -message if less than 75% of city centers get updated

Improved messages about new extra building technologies.
- If there's just one extra type automatically built to city centers, mention
that extra type in the message
- Omit "New hope sweeps..." -message if less than 75% of city centers get updated

Mm, it's true that this proposed bit of the script API sticks out like a sore thumb.

However, in general, I'd like to find a sustainable way for ruleset authors to override automatic help text where it isn't helpful or could use more description. I think this has to be in a bit of the ruleset that allows expressive specification of conditions. The two places we have like that are the effects system (which is better suited to specifying combinatorial conditions, rather than transitions like this) and Lua scripting. So this proposal was a concrete example of that sort of thought.

I'm still a bit sceptical that we can come up with automatic text that encompasses both "WOW all your cities have free railroads" from "The two of your thirty cities that happened to be on rivers got free bridges" (the latter doesn't really warrant talking excitedly about new hope sweeping like fire), without it ending up rather specific to our existing rulesets.

However, I think it probably is too late to do anything for 2.5 (I have no candidate patch).

> If we're to do anything about this for 2.5, it blocks the data
> file format, freeze, I think?

Frankly, the solution you have proposed seems very bad hack to me. I much prefer keeping it as it is in 2.5, at least what comes to datafile format. I think we can improve it for the most common cases (just one kind of roads added) quite easily without touching datafile formats, leaving current messages as fallback for more exotic rulesets where single tech discovery enables multiple AutoOnCityCenter extras. If that's not enough, we have to make format changes in a sustainable way (something that is consistent with our other developments) in future versions.

That's my opinion, don't take it as law. If you disagree, we've got votes 1-1, so other people should say their opinion too.

> I had not noticed that we'd got rid of free city bridges in the
> classic ruleset by not having AlwaysOnCityCenter, although now
> I see it was discussed extensively in patch #3522 and
> patch #3826. We should remember to put that in NEWS.

Story actually begins from patch #3007, later patches just ported that behavior to new formats (and stripped it from most ruleset when it became possible to control via ruleset)

> Don't know if it matters, but remember that it's not
> necessarily exactly "new tech made one new road generally
> possible".

Indeed, it's not necessarily a tech that triggers it any more (although I think that's all we'll handle at the moment?)
Would probably need to iterate over each road/base type and then cities inside that.

> Even classic ruleset has Bridge Building technology that
> doesn't allow new road types, but one to build existing roads
> on river tiles.

Playing on trunk, I had noticed getting one of these messages when I learned Bridge Building, and wondered why.
I had not noticed that we'd got rid of free city bridges in the classic ruleset by not having AlwaysOnCityCenter, although now I see it was discussed extensively in patch #3522 and patch #3826. We should remember to put that in NEWS.
In fact this is an example of where a ruleset custom message would be really useful -- I can't see it being practical to have the core game engine come up with a sensible description of this.

I'm now thinking a signal like:

bool city_infrastructure_upgraded(extra, reason, cause)

"extra" somehow describes which base/road has been enabled. Could be just a string, or we could add bases/roads/extras as first-class Lua types and pass one of those.

"reason" textually describes what triggered the upgrade:

Techs: similar set to tech_researched, but qualified by "tech_": "tech_researched", "tech_traded", "tech_stolen", "tech_hut" -- allows "discovery" to be distinguished

Others: another plausible place we should be calling upgrade_all_city_extras() is on building wonders, to enable a wonder/building tech. (Should this even be limited to the current player? -- this is a new ticket, anyway) We'd have "building_*" (or just "building") reason for that.

"cause" is the specific tech, building, etc that triggered the upgrade (this can be a first class Lua type).

So for the classic ruleset our signal handler would go something like:

Is reason "tech_*" with cause "Bridge Building": print a new message "Discovery of Bridge Building leads workers to build bridges in all your river cities".

Else, if reason is "tech_*", print the traditional "new hope" or "the people are pleased" message, either switching on tech/extra names or just using a default fallback in default.lua which mentions extra names.

Don't know if it matters, but remember that it's not necessarily exactly "new tech made one new road generally possible". Even classic ruleset has Bridge Building technology that doesn't allow new road types, but one to build existing roads on river tiles. In theory one could even get Railroad first (by diplomacy or stealing) and then discovery of Bridge Building would give both roads and railroads on river city centers.

"New hope sweeps like fire through the country as the discovery of railroad is announced.
"Workers spontaneously gather and upgrade all cities with railroads."

(from upgrade_city_rails())

But now we have gen_roads this message is forced to be the rather more clumsy:

"New hope sweeps like fire through the country as the discovery of new road building technology is announced.
"Workers spontaneously gather and upgrade all possible cities with better roads."

and similar for bases.

If we emitted a Lua signal in this circumstance (AlwaysOnCityCenter/AutoOnCityCenter), rulesets could override the message with a more appropriate one. We could keep the current messages as a fallback in default.lua. (Or possibly messages which mention the base/road name.)

(The existing "tech_researched" signal isn't far off being usable for this, but wouldn't be able to distinguish whether any cities were in fact upgraded.)

Copyright (C) 2004-2006, the Gna! people. Posted items are owned by whoever posted them.
Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.