The effects of buildings and non-theoretical techs are scripted in their respective building or tech FOCS file, with some values (user-defined constants) included from extern files and some others only defined in the own file. E.g., the boost from Algorithmic Elegance is calculated as Target.Population * 0.5 * [[RESEARCH_PER_POP]], where 0.5 is defined only in that file and RESEARCH_PER_POP is included from /scripting/common/base_prod.macros.
I've been fiddling with research/production techs/buildings to mitigate the snowball effect. The changes in a (say) tech file will not be reflected on the pedia (documentation) unless you also edit the corresponding descriptions on all the stringtable files (one for each language), and to be sure to cover everything related to a given meter you have to review many files in different folders.
I'm suggesting here to move all those 0.5, 1, 2.5, etc. constant values used in the tech/building files to a macro file in the common folder to be referenced from stringtables (can this be done?) and FOCS files.
Advantages:
- Group all values relevant to a given meter (e.g. research) in a single file, which eases any rebalancing and is less prone to buggy omissions.
- Immediate updating of documentation when some values are changed for rebalance.
If developers see this as an improvement, and since this only implies FOCS changes, I could try to make a PR for this (after proper discussion/guidance).
Move tech/building values to a single macro file
Moderators: Oberlus, Committer
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Move tech/building values to a single macro file
I don't think so. You can look up stringtable entries in a FOCS script, and there are tag substitutions in some strings that can make links to objects or content or substitute the name of an in-game object (eg. [[metertype METER_STEALTH]]), and there are the numbered substitutions which match up with substitutions in the C++ code (like %18%), and strings can include macros to other stingtable keys. But there is no way to access a scripting macro from within a stringtable entry directly. It probably wouldn't be difficult to add the ability to #include macros within the stringtable (treating the macros as stringtable entries), which might be enough to do what you want, but the feature doesn't currently exist. It might get tricky to do this though, as you'd need to be sure that there are no duplicate macros included from different macro files, and that none of the string keys conflict with macro keys.
Re: Move tech/building values to a single macro file
From a maintainability standpoint: it would be good to have base values used in FOCS defined in single place for all three of the following uses, so they are always in sync: AI, encyclopedia, and of course FOCS
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Look, ma... four combat bouts!
Look, ma... four combat bouts!
Re: Move tech/building values to a single macro file
The keys imported from scripts could have a commonc prefix (like FOCS_ or SCRIPT_) or even be prefixed with the script name that contains them.Geoff the Medio wrote: ↑Tue Aug 14, 2018 2:33 pm It might get tricky to do this though, as you'd need to be sure that there are no duplicate macros included from different macro files, and that none of the string keys conflict with macro keys.
https://github.com/mmoderau
[...] for Man has earned his right to hold this planet against all comers, by virtue of occasionally producing someone totally batshit insane. - Randall Munroe, title text to xkcd #556
[...] for Man has earned his right to hold this planet against all comers, by virtue of occasionally producing someone totally batshit insane. - Randall Munroe, title text to xkcd #556
Re: Move tech/building values to a single macro file
I believe that's already possible, and is essentially the same thing I did when I added content_specific_parameters.txt and common_user_customizations.txt (at least it is my vague recollection I added those lol).Geoff the Medio wrote: ↑Tue Aug 14, 2018 2:33 pmIt probably wouldn't be difficult to add the ability to #include macros within the stringtable (treating the macros as stringtable entries)
If I provided any code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0
- Geoff the Medio
- Programming, Design, Admin
- Posts: 13603
- Joined: Wed Oct 08, 2003 1:33 am
- Location: Munich
Re: Move tech/building values to a single macro file
Appears so: https://github.com/freeorion/freeorion/ ... txt#L18769Dilvish wrote: ↑Thu Nov 15, 2018 9:34 amI believe that's already possible...Geoff the Medio wrote: ↑Tue Aug 14, 2018 2:33 pmIt probably wouldn't be difficult to add the ability to #include macros within the stringtable (treating the macros as stringtable entries)