autogenerating ruleset files

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
eldritch_cookie
Posts: 22
Joined: Sat Mar 05, 2022 6:41 pm

autogenerating ruleset files

Post by eldritch_cookie »

I am writing a ruleset where nations have effects and aren't purely cosmetic, in this ruleset i want to have various groups of nations and each group of nations starts with a number of techs already researched depending on the group, but the only effect which gives techs is the Give_Imm_Tech effect which gives amount techs without allowing to specify which ones.
I would like to not have to use my user effects if i don't need to as there are a very limited number of those(4), a solution would be to make a template and copypaste it for each nation, however if i do that when i need to change something to rebalance the groups i would need to make the changes once for every nation which may be easy in the beginning but over time would become a significant amount of work(imagine if i add 15 nations to a group, i would need to change 15 files), so i thought about the following solution.
I create a group.ruleset file containing all the info for the individual nations and create a program which reads it and then outputs the files nation1.ruleset nation2.ruleset etc, i then only need to include the files to use them. I know for a fact that a .ruleset file parser already exists as rulesets are implemented as .ruleset files and the program needs to understand the .ruleset file to play the ruleset, can somebody point me to the code section where the parser for rule sets is? this seems as simple enough so that i could code it, provided i can find the source code of the parser.
Alternatively this could be solved with lua scripting if there were a way of iterating over all players and finding their nation group, but looking at the player object and the nation object there doesn't seem to currently exist a way of finding which nation group a player's nation is.
Post Reply