---------------------------------------------------------------------- Freeciv Rulesets ---------------------------------------------------------------------- (Originally by David Pfitzner, dwp@mso.anu.edu.au) Quickstart: ----------- Rulesets allow modifiable sets of data for units, advances, terrain, improvements, wonders, nations, cities, governments and miscellaneous game rules, without requiring recompilation, in a way which is consistent across a network and through savegames. (In the future there could be other categories of rulesets.) - To play Freeciv normally: don't do anything special; the new features all have defaults which give the standard Freeciv behaviour. - To play a game with rules more like Civ1, start the server with: ./ser -r data/civ1.serv (and any other command-line arguments you normally use; depending on how you have Freeciv installed you may have to give the installed data directory path instead of "data"). Start the client normally. The client must be network-compatible (usually meaning the same or similar version) but otherwise nothing special is needed. (However some third-party rulesets may potentially require special graphics to work properly, in which case the client should have those graphics available and be started with an appropriate '--tiles' argument.) As well as a Civ1 style as above, Freeciv now has a Civ2 style similary, although currently it is almost identical to standard Freeciv rules. Note that the Freeciv AI might not play as well with rules other than standard Freeciv. (See notes below.) The rest of this file contains: - More detailed information on creating and using custom/mixed rulesets. - Information on implementation, and notes for further development. ---------------------------------------------------------------------- Using and modifying rulesets: ----------------------------- Rulesets are specified using new server options. The command above of "./ser -r data/civ1.serv" just reads a file which sets these options (as well as a few of the standard server options). The new server options are: techs, governments, units, buildings, terrain, nations, cities, game. They are special server options in that they take string values, but otherwise the behave like normal server options. Eg, try the server command "explain techs". For each of these options, the value of the option specifies a subdirectory of the Freeciv data directory, containing a file name techs.ruleset, units.ruleset, buildings.ruleset, etc. Eg, the commands: set techs default set governments default set units civ1 set buildings custom set terrain civ2 set nations default set cities default set game custom would specify the files: data/default/techs.ruleset data/default/governments.ruleset data/civ1/units.ruleset data/custom/buildings.ruleset data/civ2/terrain.ruleset data/default/nations.ruleset data/default/cities.ruleset data/custom/game.ruleset (This is just an example, and may not give very sensible rules; the directory data/custom and the file data/custom/buildings.ruleset do not exist in standard Freeciv.) 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). It is suggested that you _don't_ edit the existing files in the "default", "classic", "civ1" and "civ2" directories, but rather 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. The format used in the ruleset files should be fairly self-explanatory. A few points: - The files are not all independent, since eg, units depend on advances specified in the techs file. - Wonders and city improvements have a new field, "variant". This allows limited changes to the effects of specific wonders and improvements, where such changes have been implemented. See the "TODO Variants" section below for which variant effects which have been implemented so far. - Units have a new 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 - The [units_adjust] section of the units file deserves some explanation. It contains the entries: max_hitpoints, max_firepower, firepower_factor. The first two entries (unless zero) override the hitpoints and firepower entries for individual units, as a convenience. The value of firepower_factor is used when combat is resolved: All combat firepower values are multiplied by firepower_factor, which means that the effective hitpoints of any unit is really (hitpoints/firepower_factor). Actually, it is these effective hitpoints which are report to the client for all hitpoint values. (This complicated setup is so that the AI calculations don't blow up when using Civ1 rulesets.) - The cities section of the nations ruleset files deserves some explanation. At first glance, it simply contains a comma- separated list of quoted city names. However, this list can also be used to label cities by their preferred terrain type. Cities can be labeled as matching or not matching a particular type of terrain, which will make them more (or less) likely to show up as the "default" name. The exact format of the list entry is "<cityname> (<label>, <label>, ...)" where the cityname is just the name for the city (note that it may not contain quotes or parenthesis), and each "label" matches (case-insensitive) a terrain type for the city (or "river"), with a preceeding ! to negate it. The terrain list is optional, of course, so the entry can just contain the cityname if desired. A city name labeled as matching a terrain type will match a particular map location if that map location is on or adjacent to a tile of the named terrain type; in the case of the "river" label (which is a special case) only the map location itself is considered. A complex example: "Wilmington (ocean, river, swamp, forest, !hills, !mountains, !desert)" will cause the city of Wilmington to match ocean, river, swamp, and forest tiles while rejecting hills, mountains, and deserts. Although this degree of detail is probably unnecessary to achieve the desired effect, the system is designed to degrade smoothly so it should work just fine. (A note on scale: it might be tempting to label London as !ocean, i.e. not adjacent to an ocean. However, on a reasonably-sized FreeCiv world map, London will be adjacent to the ocean; labeling it !ocean will tend to give bad results. This is a limitation of the system, and should be taken into account when labelling cities.) Also note that a city earlier in the list has a higher chance of being chosen than later cities. Properties of units and advances are now fairly well generalised. Properties of buildings are still rather inflexible. NOTE: There is much in the rulesets that is not completely implemented. Be sure to read Restrictions and Limitations, below. ---------------------------------------------------------------------- The civstyle option: -------------------- The server option civstyle still exists, but its only current use is to determine how much of the map is revealed when the Apollo Program id built. The civstyle option will be removed in the near future. ---------------------------------------------------------------------- The AI: ------- An important caveat regarding rulesets is that while rulesets allow considerable flexibility, the AI has been designed and tested using "standard Freeciv" (effectively Civ2) rules. So the AI may not do as well with modified rules. Some changes to the AI have been made to try to take some of the ruleset changes into account, and the combat calculations have been fudged to try to avoid core dumps, but in general you should not expect the AI to work as well with non-default options (where Civ1 is definitely included in "non-default"). Examples of problems which have not been fixed: - Units not having hitpoints in Civ1 can make a big difference to appropriate combat strategies. - City walls are sufficiently different (increased build cost, and upkeep; and effect vs sea) to require different handling? - Without the Harbour and Offshore Platform improvements, cities with many ocean squares are much more limited in Civ1. - Wonders which only work on a single continent are not given special consideration by the AI. Hopefully this situation can be improved in the future, but the more flexible the rules, the harder to write a good AI... ---------------------------------------------------------------------- Restrictions and Limitations: ----------------------------- units.ruleset: Unused entries: - uk_gold Restrictions: - At least one unit with role "FirstBuild" must be available from the start (i.e., tech_req = "None"). - There must be units for these roles: - "Explorer" - "FerryBoat" - "Hut" - "Barbarian" - "BarbarianLeader" - "BarbarianBuild" - "BarbarianBoat" (move_type must be "Sea") - "BarbarianSea" - There must be at least one unit with flag "Cities". Limitations: - These unit flag combinations won't work: - "Diplomat" and "Caravan" buildings.ruleset: Unused entries: - terr_gate - spec_gate - sabotage - effect nations.ruleset: Unused entries: - attack - expand - civilized - advisors - tech_goals - wonder - government ---------------------------------------------------------------------- Implementation details: ----------------------- This section and following section will be mainly of interested to developers who are familiar with the Freeciv source code. Rulesets are mainly implemented in the server. The server reads the files, and then sends information to the clients. Mostly rulesets are used to fill in the basic data tables on units etc, but in some cases some extra information is required. For units and advances, all information regarding each unit or advance is now captured in the data tables, and these are now "fully customizable", with the old enumeration types completely removed. For improvements and wonders, each one has a largely unique effect, so the effects themselves are still hardwired in the code. The "variant" field now allows some flexibility, though the effects themselves must still be hard-coded. There are some plans to improve this situation. ---------------------------------------------------------------------- TODO: ----- - More improvement and wonder variants for Civ1 (see next section). - Other alternative (non-Civ1) variants? (If desired.) - Better: Scrap variants completely and do something more general... - Fix up AI dynamic government choice code. - Work on making the AI handle non-default cases better. - Could have other information to help the AI? Eg, scores for units/techs/buildings, to help the AI know which ones to prefer? - Rulesets for: time progression, ...? ---------------------------------------------------------------------- TODO Variants: -------------- First, those variants which have been implemented: (Note Variant=0 should always be "standard Freeciv" effect.) Barracks: Variant=0: just works for ground units (Civ2) Variant=1: works also for air and sea units (Civ1) Barracks II, Barracks III, Sun Tzu: These use the same variant value and effect as Barracks. City Walls: Variant=0: only applies against land and heli units Variant=1: applies against sea units too Police Station: This uses the same variant value and effect as Women's Suffrage (see below). Pyramids: Variant=0: counts as Granary in every city (Civ2) Variant=1: allows all government types and there is no transition anarchy (Civ1) United Nations: Variant=0: units regain extra hp per turn (Freeciv) Variant=1: allows all government types and there is no transition anarchy (Civ1) (see note(*)) Hoover Dam: Variant=0: works on all cities owned Variant=1: only works for cities on the same continent as where the wonder is built J.S. Bach: Variant=0: works on all cities owned Variant=1: only works for cities on the same continent as where the wonder is built Women's Suff.: Variant=0: -1 unit-unhappy per City (-2 under Democracy) (Freeciv) Variant=1: -1 unit-unhappy per Unit (Civ1) Magellan's Exp.: Variant=0: gives sea units 2 extra move points Variant=1: gives sea units only 1 extra move point Great Wall: Uses same variant and effect as City Walls. Leo's Workshop: Variant=0: Upgrades one obsolete unit per game turn. Variant=1: Upgrades all obsolete units each turn. Michelangelo's: Variant=0: same as a Cathedral in every city Variant=1: doubles effect of cathedrals Other differences between Civ1 and Civ2/Freeciv which have not been implemented as variants: Copernicus' Obs.: Freeciv: science output +50% in a city Civ1: doubles knowledge production in city, after all other effects. Isaac Newton's: Freeciv: science output +100% in a city Civ1: "increases effects of Libraries and Universities" - by how much?? There are other more minor Civ1/Civ2/Freeciv differences, which could be handled using variants, for: Courthouse Cure For Cancer Hanging Gardens Lighthouse Notes: Aqueduct and Sewer System: The maximum sizes for cities without these improvements is handled separately, without using variants. This leaves variants available if some other effects are desired. Colosseum, Cathedral, Temple: Note that the technology effects on the effectiveness of these buildings are not handled by variants, but by specially noting the techs; see game.rtech fields cathedral_plus, cathedral_minus, colosseum_plus, and temple_plus. (Also applies to Michelangelo's.) (*) United Nations: I'm not sure what to do here: the diplomatic effect of Civ1,Civ2 isn't appropriate for multiplayer Freeciv, and the hp effect of Freeciv isn't appropriate for Civ1 (no hitpoints). The govchange effect seems reasonable -- note there is no Statue of Liberty in Civ1, and Pyramids, which has the same effect in Civ1, becomes obsolete. Alternatively a Suffrage-like effect would seem sensible: your population is more willing to go to war if it has the sanction of the United Nations! ----------------------------------------------------------------------