Nation Class

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
Post Reply
User avatar
GriffonSpade
Elite
Posts: 578
Joined: Mon Apr 29, 2013 4:41 pm

Nation Class

Post by GriffonSpade »

The fundament of this idea is to create a 'virtual object class' that would *include individual nations. It would be able to define some default values that would be inherited by all *included nations within that nation class. This would allow easier modding of nations without actually having to modify the individual nations, allowing modders to still use the many hundreds available in the distribution.

For example, one might take 16 nations that are packaged in a commercial Civilization game, and make a nation class for each of these, then add all the remaining nations to whatever nation class is best fitting.

I'm not aware how easy or hard this would be with Freeciv's code.

More:

It would be awesome if there was, I don't know, some kind of intermediary nation file set that could easily slot in the existing nations? I'll call it... Nation Class. Something that would allow use of init_techs, init_buildings, init_units, and init_flags. AFAIK, the first three must be in each individual nation; all "" ones would be removed and that would be reserved as an override. The last doesn't exist at all, and would have flags (like the list mentioned in the OP) that could likewise be overwritten.
I've specifically separated it from (nation) groups, as there would be either too many nation class files or they would get overwritten in every single nation.
The nation class files would be *included in nationlist, and the nations would be *included in the nation class files.

So instead of simply this setup:
nationlist.ruleset wrote: *include "nation/abkhaz.ruleset"
abkhaz.ruleset wrote: [nation_abkhaz]

name=_("Abkhaz")
...etc
...etc
It would be like this by default:
nationlist.ruleset wrote: [class_a]
init_techs = ""
init_buildings = ""
init_units = ""
init_flags = ""

*include "nation/abkhaz.ruleset"
abkhaz.ruleset wrote: [nation_abkhaz]

name=_("Abkhaz")
...etc
...etc
A more customized setup would not have a single nation class, but potentially several in their own files:
nationlist.ruleset wrote: *include "modname/class_a.ruleset"
class_a.ruleset wrote: [class_a]
init_techs = ""
init_buildings = ""
init_units = ""
init_flags = ""

*include "nation/abkhaz.ruleset"
abkhaz.ruleset wrote: [nation_abkhaz]

name=_("Abkhaz")
...etc
...etc
...etc
Last edited by GriffonSpade on Mon Jun 04, 2018 7:02 pm, edited 2 times in total.
drgerg
Veteran
Posts: 58
Joined: Sun Nov 15, 2015 4:05 pm

Re: Nation Class

Post by drgerg »

i agree with your thoughts, being a coder in my previous jobs. :geek: Also, I think it would be easier for non-technical folks to create new nations using objects, and changing only what is needed from the baseline. But I have never developed in C or one of its variants so I have no idea if the FreeCiv code is using a nation object.
User avatar
GriffonSpade
Elite
Posts: 578
Joined: Mon Apr 29, 2013 4:41 pm

Re: Nation Class

Post by GriffonSpade »

drgerg wrote:i agree with your thoughts, being a coder in my previous jobs. :geek: Also, I think it would be easier for non-technical folks to create new nations using objects, and changing only what is needed from the baseline. But I have never developed in C or one of its variants so I have no idea if the FreeCiv code is using a nation object.
Making a new nation is actually a fairly simple operation:
1) Copy an existing nation to override (and possibly create a nations sub-folder for it). change its filename and [nation_xxx] to something that no other nation uses, and change the name, rulers, cities, etc. as desired.
2) Edit override/nation.ruleset, adding *include reference pointing to your new nation.
(Format can be copied from default/nationlist.ruleset.
*include "nation/wuerttembergian.ruleset"
in nationlist.ruleset becomes ->
*include "override/nation/wuerttembergian.ruleset"
in override\nation.ruleset pointing to the file in /override/nation/ folder
)

Note that if you want to use a flag that is not in an extant tileset, you need to make it and also edit in tileset references, which is separate from the ruleset.

Now, the problem is that if you want to /edit/ nations to give them some property or other, say to give them an init_techs or two, the operations look like this:

1) Copy the nationlist.ruleset file from the default directory to your mod's directory.
2) Edit your mod's nations.ruleset file and change the nationlist.ruleset reference to point to the one in your mod's directory.
3) Copy all nations to your mod's directory
4) Edit your mod's nationlist.ruleset file and change the nations' references to point to the ones in your mod's directory.
5) Add the init_techs to a nation.
6) Repeat Step 5 for each of hundreds of nations.

And then they won't receive any updates that are done with the default versions automatically.

Adding Nation Classes would simplify this a great deal:

1) Copy the nationlist.ruleset file from the default directory to your mod's directory.
3) Edit your mod's nations.ruleset file and change the nationlist.ruleset reference to point to the one in your mod's directory.
4) Copy the nationclass.ruleset file, rename filename and [nationclass_xxx], including init_techs and references to each nation in the class.
5) Repeat Step 4 for each nation class
6) Edit your mod's nationlist.ruleset file, remove the default nation class reference, and add the new nationlists' references.

Most likely, there will be only a dozen or two nation classes. However, even if there are as many as hundreds, it would be an improvement, as the default nations would still be used, meaning they'd still be updated normally.
User avatar
vodot
Veteran
Posts: 81
Joined: Thu May 17, 2018 4:54 pm

Re: Nation Class

Post by vodot »

GriffonSpade wrote:Now, the problem is that if you want to /edit/ nations to give them some property or other, say to give them an init_techs or two, the operations look like this:

1) Copy the nationlist.ruleset file from the default directory to your mod's directory.
2) Edit your mod's nations.ruleset file and change the nationlist.ruleset reference to point to the one in your mod's directory.
3) Copy all nations to your mod's directory
4) Edit your mod's nationlist.ruleset file and change the nations' references to point to the ones in your mod's directory.
5) Add the init_techs to a nation.
6) Repeat Step 5 for each of hundreds of nations.

And then they won't receive any updates that are done with the default versions automatically.
Heyyy, that sounds familiar. :) I second this request, very muchly!
Post Reply