Probably stupid question how to use server command in 2.6

Contribute, display and discuss rulesets and modpacks for use in Freeciv here.
Post Reply
Jacew
Posts: 32
Joined: Thu Apr 30, 2015 8:45 am

Probably stupid question how to use server command in 2.6

Post by Jacew »

I can't get traitdistribution command to work on server setup.

/set tratdistribution is recognised, but no matter what I write after it for an argument, game won't recognise it.

Only place I've been able to find anything about that server command is Freeciv wiki about Traits, which says:
Players can choose whether to have AI traits randomly chosen between '_min' and '_max', or fixed value '_default', using the 'traitdistribution' server setting (which defaults to 'FIXED'). (Ruleset authors can override or force the default in the usual way.)
Doesn't help much.

And under that are ruleset syntax help:
"_default" is optional; if not specified, the midpoint of "_min" and "_max" will be used.

Default trait values applicable for all nations are defined in nations.ruleset section default_traits.

[default_traits]
expansionist_min = 50
expansionist_max = 50
expansionist_default = 50
trader_min = 50
trader_max = 50
trader_default = 50
aggressive_min = 50
aggressive_max = 50
aggressive_default = 50
But none of them: min, max, aggressive_min 10 etc... Do not work as argument for /set traitdistribution?

What I'm supposed to give for an argument there to set the minimum and maximum values of traitdistribution?
Molo_Parko
Hardened
Posts: 200
Joined: Fri Jul 02, 2021 4:00 pm

Re: Probably stupid question how to use server command in 2.6

Post by Molo_Parko »

traitdistribution is a per scenario/game setting which only accepts two values EVEN or FIXED, which can be set in the game options prior to starting the game.
[16:36:07] Dove: 'set traitdistribution "FIXED"'
[16:36:07] Console: 'traitdistribution' has been set to "Fixed" (FIXED).
[16:36:13] Dove: 'set traitdistribution "EVEN"'
[16:36:13] Console: 'traitdistribution' has been set to "Even" (EVEN).
To change an individual player's trait values in console/Chat pane, use:

To see the current value for player 0 (or use "print" instead of log.error but that won't work in scripts):
/lua log.error(find.player(0):trait("Expansionist"))

To change the amount for player 0:
/lua edit.trait_mod(find.player(0),"Expansionist",-50)
Jacew
Posts: 32
Joined: Thu Apr 30, 2015 8:45 am

Re: Probably stupid question how to use server command in 2.6

Post by Jacew »

So what does traitdistribution EVEN setting do? It sounds intuitively as the same setting as FIXED. I understand FIXED means every nation has the same fixed default value.

This is really badly documented. Only info I can find is that quote I added above, which refers to traitdistribution setting in 2.6 being able to randomly pick traits for each nation, which is the setting I want. How do I turn it on?
Molo_Parko
Hardened
Posts: 200
Joined: Fri Jul 02, 2021 4:00 pm

Re: Probably stupid question how to use server command in 2.6

Post by Molo_Parko »

I looked for better documentation on the web but you're right, I couldn't find any.

"FIXED" uses the value listed as "default"

"EVEN" will also use the same value listed as default if the min / max settings are the same as the default setting.

"EVEN" will get a different value only if the min/max settings are different as in min=100 and max=200 in which case a random value between the two would be the actual value of the trait.

The value for the "FIXED" "default", and the min and max values are defined in the nations.ruleset as [default_traits] which applies to all nations, unless the nation has a specific entry such as "[nation_mongol]" which could change that particular nation from the generic "[default_traits]" setting such as:
[nation_mongol]
trait_expansionist_default=250
^ That overrides the generic "[default_traits]" for all nations with the specific setting for the mongol nation.

Or the custom entry for the nation could omit default and instead set:
trait_expansionist_min = 100
trait_expansionist_max = 300
In which case the two values are added to get 400 / 2 = 200 each for the "FIXED" default value, or if "EVEN" is used, each trait will get a random value between min and max.
Jacew
Posts: 32
Joined: Thu Apr 30, 2015 8:45 am

Re: Probably stupid question how to use server command in 2.6

Post by Jacew »

Thank you! This explains a lot.

I still have couple of follow up questions:

If I have different min/max settings in [default_traits] in nations.ruleset, and set traitdistribution EVEN, does it pick different random value between min and max for each nation, or pick one random value and use it for every nation?

Also, if latter is true, and I want every nation in my game to have unique random value (but perhaps same min/max), does that mean I have to list them all like [nation.mongol] in your example in nations.ruleset and copy-paste min/max values under each?
^ That overrides the generic "[default_traits]" for all nations with the specific setting for the mongol nation.
I assume there is either typo, or I don't understand it correctly? Adding specific setting for mongol nation only affects Mongols, with other nations still getting [default_traits]. Adding [nation_mongol] wouldn't override the use of [default_traits] setting for all the other nations, right?
Molo_Parko
Hardened
Posts: 200
Joined: Fri Jul 02, 2021 4:00 pm

Re: Probably stupid question how to use server command in 2.6

Post by Molo_Parko »

Yes, the actual value of the traits varies by player randomly when the min/max is set to different numbers (50 and 100 for instance ) and the game's traitdistribution option is "EVEN".

No, you don't have to have a different entry per nation in the nations.ruleset to get different values -- in fact, even if you choose the "FIXED" option you can still alter the values of each player's traits via the lua command edit.trait_mod(), either from the chat pane command line, or by adding a lua script in the game's scenario .sav file (which is a plain text file that can be edited by any plain text editor such as TextEdit on Macs, or Notepad on Windows.)

Code: Select all

/lua edit.trait_mod(find.player(0),"Expansionist",-50)
Yes, the settings for a specific nation only override the [default_traits] for that nation.
Jacew
Posts: 32
Joined: Thu Apr 30, 2015 8:45 am

Re: Probably stupid question how to use server command in 2.6

Post by Jacew »

Thanks again. That's great to know.
cazfi
Elite
Posts: 3335
Joined: Tue Jan 29, 2013 6:54 pm

Re: Probably stupid question how to use server command in 2.6

Post by cazfi »

The command to get information about server settings is explain

Code: Select all

> help explain
Command: explain  -  Explain server options.
Synopsis: explain
          explain <option-name>
Level: info
Description:
  The 'explain' command gives a subset of the functionality of 'help',
  and is included for backward compatibility. With no arguments it gives
  a list of options (like 'help options'), and with an argument it gives
  help for a particular option (like 'help <option-name>').
> explain traitdistribution
Option: traitdistribution  -  AI trait distribution method
Description:
  How trait values are given to AI players.
Status: changeable
Possible values:
- FIXED: "Fixed"
- EVEN: "Even"
Value: "Fixed" (FIXED), Default: "Fixed" (FIXED)
Post Reply