Expanding on "Special"-type buildings

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
User avatar
Caedo
Elite
Posts: 494
Joined: Sun Feb 10, 2013 10:21 pm
Location: Stuttgart, Germany

Expanding on "Special"-type buildings

Postby Caedo » Fri Apr 03, 2015 2:09 pm

Let's face it ─ right now, the "Special" genus really can't be used for much more than Coinage and spaceship parts. Sure, you can make a special that gives you an immediate advance when built, or perhaps one that makes all units in the city regenerate a few health points (Note: I didn't test either of these), but what about turning production into science? Also, shouldn't there perhaps be a way to build multiple spaceship parts at once? I mean, if my city generates 200 Shields per turn, why do they only manage to build one space structural?

Now, I have no idea how hard these ideas will be to implement. I haven't looked at the source code much, and didn't find much about how "Special" buildings work in the parts of code that I looked at. However, I'm assuming that there isn't much about them and they're basically regular buildings that disappear after they're built.

So, without further ado, let's get to the ideas.
Build Slots
Right now, there can only be multiple build slots for units. I suggest adding a "build_slots" option to buildings, as in:

Code: Select all

[building_space_component]
name      = _("Space Component")
genus      = "Special"
; stuff and things
build_slots = 2

A positive integer would mean that there's that amount of build slots, regardless of anything else. A value of 0 would mean that the amount of build slots is regulated by the City_Build_Slots effect (which could potentially be split up into two effects, one for units and one for buildings); a value of -1 stands for infinite build slots.
This would allow big cities in rulesets like the experimental ruleset to build spaceship parts more quickly ─ and I think that while it's logical for a city to not be able to build more than one Module a turn, there should be enough space in the factory to build multiple structurals per turn.

An alternate approach to this would be to allow "Building"-, "Unit"-, "UnitFlag"- and "UnitClass"-type requirements at "Local" range for effects of the type "City_Build_Slots", or perhaps a new "CityProduction" range for stuff like that, to regulate how many build slots are available for a specific kind of production, though I guess this would be more difficult to implement, since build slots would have to be checked more dynamically.

Special effects other than Gold
Currently, the only thing that can be done based on how much production the city has is to turn all of it into gold with factor 1. However, that could be changed.
Firstly, the Coinage improvement could be changed to cost one shield and have infinite build slots, and the "Gold" improvement flag could simply be changed to "Gives one Gold when completed". This would also make a weaker Coinage possible, which only gives a gold for every second or third shield, simply by costing more.
The "Gold" flag could also be replaced by a "gold" field ─ an integer designating how much gold is gained when the production is completed. This would allow improved Coinages that give two or three gold per shield, or three gold per two shields et cetera.
Lastly, there could be ─ perhaps you guessed it ─ "Science", "Luxury", "Trade" and "Food" flags or the respective integer fields; note that the "Luxury" one would probably be impractical or overpowered in most cases, unless the ruleset is changed to require more luxury points to satisfy a single citizen.

An alternate approach to this one would be to move all of the "Gold" flag to effects.ruleset too, and add an effect type akin to "Specialist_Output", except that it's applied after all bonuses (just like the Coinage is); basically an effect that gives amount of OutputType to the city (and thus, player, if it's gold or science). Of course, this would probably make it even more complicated to calculate it for the total income. Also, this would, like building multiple spaceship parts in one turn, require the possibility to apply the effect multiple times in the same city if the special was completed multiple times in a single turn.


Again, I realize most of this will probably be rather complicated to implement as the stuff seems to be scattered in a bunch of different files, but I hope that at least part of it is considered.