Feature XX Towns/Cities
This specification is at Draft stage. There is no current effort to actually implement it. The goals of this feature is the control of town growth and town appearance (influence house types to build).
- Different growth requirements for different cities wrt. cargos.
- Different towns wrt. present industries and stations.
- Different growth speeds, including keeping small suburbs in coverage of big towns.
- Inform AIs about fundamental town growth requirements.
- This spec is not about controlling individual houses or industries. That is the task of NewHouses and NewIndustries. These features may communicate at some level, but they shall not be required to know each other. Picking house grfs, industry grfs and towncontrol grfs independently should be the main case.
Many people envisioned altenative townbehaviours. The goal of a NewGRF should be to cover them, so they can be done via NewGRF rather than patches.
latest patch, Peter/Korenn Towngrowth Challenge, (Talk), ancient patch, even more ancient patch
Minimal implementation requirements for these would be:
- callback to decide town growth rate, with var 82 and either 60, or 61 with the ability to add new town effects
- Cargo requirement information callback
- Minimal implementation requirements for these would be:
- Andy's IRC log
- Some clustering idea (somewhat different)
- TTDPatch's New Town Growth: Mechanism, Details, Subset of switches
|40||Larger town effect|
Distance and size of nearest town: DDDDPPPP
|43||Same as 42, but for nearest "larger" town. Identical to 42 if there are no larger towns.|
Number of industries associated to the town: SSSSTTTT
|45||Same as 44, but only primary/raw industries.|
|46||Same as 44, but only secondary/processing industries.|
|47||Same as 44, but for stations. (sum of all players)|
|60||Land info of nearby tiles (relative to townsign). Can be used to detect desert and such, also within a certain area -8 .. 7.|
Cargo delivered last month to any station in the town (Parameter = translated cargo bit).
|62||Same as 61, but with towneffect instead of cargobit. The amounts are multiplied with the town-effect-multiplier as well.|
|63||Same as 61, but for produced cargo of any house or industry in the town.|
|64||Same as 62, but for produced cargo of any house or industry in the town.|
|65||Same as 61, but for transported cargo of any house or industry in the town.|
|66||Same as 62, but for transported cargo of any house or industry in the town.|
Number of industries that accept/produce a given cargo (Parameter = translated cargo bit): AAAAPPPP
|68||Same as 67, but with towneffect instead of cargobit.|
|B6||Number of buildings|
|D4||Remaining months of Road Reconstruction|
|D5||Remaining months of Funded Buildings|
All callbacks are generic callbacks, and are chained across all Grfs. That is if one Grf returns "callback failed", the next Grf is tried. If all callbacks fail, the default behaviour kicks in.
Decide town growth:
- Called periodically, returns some growth speed (signed! :p ).
- Variable 10: Random bits
Decide town radius:
- Called periodically. Defines the radii of the town zones, and thus the type of houses which will be build.
- Variable 18: Zone to return radius for.
- Variable 10: Random bits (same for all zones in one call-series)
- Result: Radius (squared euclidian) for the zone.
- The radii should be strictly monoton. Therefore a NewGRF should always define all radii or none.
Decide town found cost and size:
- Called when founding a town.
- Variable 18: Randomly generated town or manually founded. (Both in game and in scenario editor.)
- Variable 10: Random bits
- Not sure about the exact result. Also the size is actually already set by the GUI when manually founding.
- Nevertheless, var 40, 42, 43 and 60 should be accessible.
Additonal text in town window:
- The text callback is chained slightly different to the other callbacks. While for the other callbacks the chaining stops once there is a result, this callback is always called for all implementing Grfs. The returned texts are then concatenated in the GUI.
- Result: Usual offset (0-3FF) for a D0xx text.
Cargo requirement information callback:
- This callback makes the town GUI display the delivered and/or transported cargo class month and can optionally display a text behind the amounts. Like the additional text callback, this callback is also chained across multiple Grfs. However, only one Grf can display an additional text.
Variable 18: xxxxTTCC
- CC translated cargo bit
- TT towneffect
- Note: There variable 18 cannot be passed to the 60+ variable easily (as 60+ parameters are only constant). But this is likely no needed as Grfs need to know about their cargos/towneffects for other callbacks anyway.
Register 100: TTTTDDDD
- DDDD: D0xx text for delivered cargo.
- TTTT: D0xx text for transported cargo.
|0 - 1||0||Show delivered cargo amounts if climate defaults require this.|
|1||Hide the amounts, unless another Grf wants to display them.|
|2||Show the amounts.|
|3||Show the amounts including an additional text from register 100.|
|2||4||The cargo is required regulary for growth.|
|3||8||The cargo is required in big amounts for growth.|
|4||10||The cargo requirement is very important.|
|8 - 12||Same as bit 0-4, but for transport instead of delivery.|
|13 - 14||(reserved)|
Persistent storage for towns has been implemented. See http://newgrf-specs.tt-wiki.net/wiki/Storages#Persistent_storage_accessed_by_GRFID