Freeciv
Register
Advertisement
Freeciv-modpack

Modpack UI icon

This page partially describes the contents of a ruleset collection. It is intended as developer reference and for people wanting to create/compile alternative rulesets for Freeciv.

Overview of Editing a Ruleset[]

Most clients provide simple list of available rulesets to choose from for local games. They handle sending correct commands to their internal server - most ruleset users need not to be concerned about below server-side setup.
Rulesets are specified using the server command "rulesetdir". The command "./freeciv-server -r data/civ1.serv" just reads a file which uses this command (as well as a few of the standard server options). The server command specifies in which directory the ruleset files are to be found.
The ruleset files in the data directory are user-editable, so you can modify them to create modified or custom rulesets without having to recompile Freeciv. You should **not** edit the existing files in the "civ2civ3", "classic", "civ1", "civ2", or other directories part of freeciv distribution. Instead you should copy them to another directory and edit the copies. This is so that its clear when you are using modified rules and not the standard ones.
Some specific notes on the format:
  • Some rule files have dependencies on other files. For example: units depend on advances specified in the techs file.
  • Units have a field, "roles", which is like "flags", but determines which units are used in various circumstances of the game (rather than intrinsic properties of the unit). See comments in common/unit.h
  • Properties of units and advances are now fairly well generalized.
  • Properties of buildings are still rather inflexible.
Check the ruleset forum for asking questions.

The ruleset collection files[]

A Ruleset consists of a collection of configuration files. The components of the ruleset collection are:
actions (new in freeciv-3.2)
buildings       cities       effects       game
governments     nations      styles        techs         
terrain         units        script        serv

How to introduce your ruleset collection[]

... more details will follow soon.

How to create a new ruleset - step by step[]

These instructions are for a Unix or Linux installation. These are quick and dirty instructions; it is better to store successive versions of your ruleset in a suitable development area, then install them in the Freeciv data directory when they are ready, but such complexities are outside the scope of this note.
  • Decide on a name for your new ruleset. This should be a single word. For example, seawolf.
  • Locate the Freeciv data directory. For example, on my Debian GNU/Linux computer this is /usr/share/games/freeciv. That directory will have a sub directory called civ2civ3 and a file named civ2civ3.serv.
  • Copy the content of that default sub directory to a new directory that has the same name as yor ruleset, and is in the Freeciv data directory. For example, if creating the seawolf ruleset on my Debian GNU/Linux computer, this would create files such as /usr/share/games/freeciv/seawolf/buildings.ruleset and /usr/share/games/freeciv/seawolf/cities.ruleset.
  • Copy the civ2civ3.serv script to create a new file in the Freeciv data directory, but with the name of yor ruleset instead of 'civ2civ3'. For example, /usr/share/games/freeciv/seawolf.serv.
  • Add a 'rulesetdir' command to the end of that script to select your ruleset. For example, rulesetdir seawolf
  • You have now created a new ruleset, with your chosen name, having the same rules as the default (civ2civ3) ruleset.
  • Your ruleset should now appear in the menu of available rulesets, if you are using the client to start a local server. You will probably have to restart your client first, however.
  • Examine and modify the files in your new ruleset directory, and the .serv script if necessary, to implement your changes to the rules.
Alternatively, copy the files to a directory named ~/.freeciv/3.1 (substitute the version number of freeciv you are using for 3.1), instead of /usr/share/games/freeciv/ (creating, for example, ~/.freeciv/3.1/seawolf/buildings.ruleset).
That has the advantage that you will not have to login in as the root user to create the ruleset, but the new ruleset will not be available to other users of your computer.

How to test your ruleset for errors[]

Use the command prompt and navigate to the freeciv server, e.g.:

cd /opt/bin/freeciv-2.1.9

Run the freeciv server, e.g.:

FREECIV-SERVER

Define the ruleset file, e.g.:

rules alien

The server will then display any errors or warnings.

See also[]

Game Anatomy & Modding
ServerClientsSecfilesRulesetsTilesetsSoundsMusicScenariosThemesArt
Event ScriptingEditing RulesetsEditing TilesetsMore RulesetsMore Tilesets
Editing Rulesets
Editing BuildingsEditing CitiesEditing EffectsEditing GameEditing Governments
Editing NationsEditing StylesEditing TechsEditing TerrainEditing Units
Advertisement