Freeciv
Advertisement

This document describes how to convert freeciv 3.0 compatible ruleset to development version (one that will become freeciv 3.1) compatible ones. Currently this goes up to compatibility with freeciv master commit 9c7607db53, 11-Nov-19.

Capability

Capability string and format_version of each ruleset file must be updated. For 3.1 rulesets the format version is 20.

[datafile]
options="+Freeciv-ruleset-Devel-2017.Jan.02"
format_version=20

parser.lua

New parser.lua lua script is needed in the ruleset. Empty file by that name is enough when not wanting any new features from it but only to update ruleset with existing functionality.

Unit vision layer

Add vision_layer entry for unit types requiring it. You don't need to define it for units on default layer, but only for those units that have had Partial_Invis flag. Remove the flag and set vision_layer="Stealth" for them.

Bridge rules

Any extra can now require bridge building tech, not only roads. Each extra lists other extras that, if present, make it to require a bridge technology. Road flags RequiresBridge and PreventsOtherRoads are removed as obsolete. For each road that had RequiresBridge add bridged_over list of extras to equivalent extra section. That list should contain all the extras that formerly had PreventsOtherRoads in their road section. Once you've done that, remove the flags from all road sections.

[road_road]
extra = "Road"
...
flags = "RequiresBridge"

[road_rail]
extra = "Railroad"
...
flags = "RequiresBridge"

[road_river]
extra = "River"
...
flags = "PreventsOtherRoads"

[road_canal]
extra = "Canal"
...
flags = "PreventsOtherRoads"

->

[extra_road]
name = _("Road")
...
bridged_over = "River", "Canal"

[extra_rail]
name = _("Railroad")
...
bridged_over = "River", "Canal"

Convert effects to Action Enablers

Some boolean effects have been replaced by Action Enablers.

Transform_Possible effect to Transform_Terrain Enabler

Replace any Transform_Possible effect with equivalent Transform_Terrain Action Enabler.

[effect_transform]
type    = "Transform_Possible"
value   = 1
reqs    =
    { "type", "name", "range"
      "Tech", "Fusion Power", "Player"
      "UnitFlag", "Transform", "Local"
    }

->

[actionenabler_transform_terrain]
action        = "Transform Terrain"
actor_reqs    =
    { "type",          "name",         "range"
      "Tech",          "Fusion Power", "Player"
      "UnitFlag",      "Transform",    "Local"
    }

Irrig_Possible effect to Build Irrigation Enabler

Replace any Irrig_Possible effect with equivalent Build Irrigation Action Enabler. Add explicit requirement of Settlers unit to them.

[effect_irrigate_src_irrigation]
type    = "Irrig_Possible"
value   = 1
reqs    =
    { "type", "name", "range"
      "Extra", "Irrigation", "CAdjacent"
    }

->

[actionenabler_irrigate_src_irrigation]
action        = "Build Irrigation"
actor_reqs    =
    { "type",          "name",         "range"
      "UnitFlag",      "Settlers",     "Local"
    }
target_reqs    =
    { "type",    "name",       "range"
      "Extra",   "Irrigation", "CAdjacent"
    }

Mining_Possible effect to Build Mine Enabler

Replace any Mining_Possible effect with equivalent Build Mine Action Enabler. Add explicit requirement of Settlers unit to them.

[effect_mining]
type    = "Mining_Possible"
value   = 1
reqs    =
    { "type", "name", "range", "present"
      "TerrainFlag", "Oil", "Local", FALSE
    }

->

[actionenabler_mining]
action        = "Build Mine"
actor_reqs    =
    { "type",          "name",         "range"
      "UnitFlag",      "Settlers",     "Local"
    }
target_reqs    =
    { "type",        "name", "range", "present"
      "TerrainFlag", "Oil",  "Local", FALSE
    }

Irrig_TF_Possible effect to Cultivate Enabler

Replace any Irrig_TF_Possible effect with equivalent Cultivate Action Enabler. Add explicit requirement of Settlers unit to them.

[effect_irrig_tf]
type    = "Irrig_TF_Possible"
value   = 1

->

[actionenabler_cultivate]
action        = "Cultivate"
actor_reqs    =
    { "type",          "name",         "range", "present"
      "UnitFlag",      "Settlers",     "Local", TRUE
    }

Mining_TF_Possible effect to Plant Enabler

Replace any Mining_TF_Possible effect with equivalent Plant Action Enabler. Add explicit requirement of Settlers unit to them.

[effect_mining_tf]
type    = "Mining_TF_Possible"
value   = 1

->

[actionenabler_plant]
action        = "Plant"
actor_reqs    =
    { "type",          "name",         "range", "present"
      "UnitFlag",      "Settlers",     "Local", TRUE
    }

New action enablers

Suicide Attack action enabler

Missiles' attack of unit getting used in attack has been split to action enabler of its own. The Missile unit class flag is gone. For keeping missiles to work as they used to, add back Missile as a user unit class flag, exclude them from any existing attack related action enablers by present=FALSE requirements, and add a new Suicide Attack action enabler for them.

[actionenabler_explode_missile]
action = "Suicide Attack"
actor_reqs    =
    { "type",          "name",    "range", "present"
      "UnitFlag",      "NonMil",  "Local", FALSE
      "UnitClassFlag", "Missile", "Local", TRUE
      "MinMoveFrags",  "1",       "Local", TRUE
      "DiplRel",       "War",     "Local", TRUE
    }

Pillage action enabler

Add new action enabler for Pillaging and add back the CanPillage unit class flag as a user unit class flag to keep it functioning like it used to.

[actionenabler_pillage]
action        = "Pillage"
actor_reqs    =
    { "type",          "name",         "range"
      "UnitClassFlag", "CanPillage",   "Local"
    }

Fortify action enabler

Add new action enabler for Fortifying to keep it functioning like it used to.

[actionenabler_fortify]
action        = "Fortify"
actor_reqs    =
    { "type",          "name",         "range", "present"
      "UnitClassFlag", "CanFortify",   "Local", TRUE
      "UnitFlag",      "Cant_Fortify", "Local", FALSE
    }

Road building action enabler

Add new action enabler for Road building to keep it functioning like it used to.

[actionenabler_road]
action        = "Road"
actor_reqs    =
    { "type",          "name",         "range"
      "UnitFlag",      "Settlers",     "Local"
    }

Base building action enabler

Add new action enabler for Base building to keep it functioning like it used to.

[actionenabler_base]
action        = "Build Base"
actor_reqs    =
    { "type",          "name",         "range"
      "UnitFlag",      "Settlers",     "Local"
    }

Action move cost to the ruleset

The new effect Action_Success_Actor_Move_Cost subtracts move fragments from a successfully performed action. The move fragment price for successful "Establish Embassy", "Investigate City", "Capture Units", "Expel Unit", "Bombard" and "Heal Unit" has moved to the ruleset. The old hard coded move fragment cost was 1 for "Establish Embassy" and "Investigate City", a single move for "Capture Units" and "Expel Unit" and all remaining movement for "Bombard" and "Heal Unit". You defined how many move fragments a single move is in move_fragments in terrain.ruleset. 65535 is large enough to make the Freeciv code know that all remaining movement is gone. Assuming that move_fragments is 3 the below effects should give you the old rules back:

[effect_action_success_move_cost_embassy]
type    = "Action_Success_Actor_Move_Cost"
value   = 1
reqs    =
    { "type", "name", "range", "present"
      "Action", "Establish Embassy", "Local", TRUE
    }

[effect_action_success_move_cost_investigate]
type    = "Action_Success_Actor_Move_Cost"
value   = 1
reqs    =
    { "type", "name", "range", "present"
      "Action", "Investigate City", "Local", TRUE
    }

[effect_action_success_move_cost_capture]
type    = "Action_Success_Actor_Move_Cost"
value   = 3
reqs    =
    { "type", "name", "range", "present"
      "Action", "Capture Units", "Local", TRUE
    }

[effect_action_success_move_cost_expel]
type    = "Action_Success_Actor_Move_Cost"
value   = 3
reqs    =
    { "type", "name", "range", "present"
      "Action", "Expel Unit", "Local", TRUE
    }

[effect_action_success_move_cost_bombard]
type    = "Action_Success_Actor_Move_Cost"
value   = 65535
reqs    =
    { "type", "name", "range", "present"
      "Action", "Bombard", "Local", TRUE
    }

[effect_action_success_move_cost_heal_unit]
type    = "Action_Success_Actor_Move_Cost"
value   = 65535
reqs    =
    { "type", "name", "range", "present"
      "Action", "Heal Unit", "Local", TRUE
    }

New settings in game.ruleset

Effects of happiness to Civil War chance

Add settings civil_war_bonus_celebrating and civil_war_bonus_unhappy to game.ruleset [civstyle] section. To keep old hardcoded behavior, use values -5 and 5, respectively, for them.

Output granularity

Add setting output_granularity to game.ruleset {civstyle] section. Use value 1 to keep old hardcoded behavior.

Nuke effects settings

Add settings nuke_pop_loss_pct and nuke_defender_survival_chance_pct to game.ruleset [combat_rules] section. To keep old hardcoded behavior, use values 50 and 0, respectively, for them.

History interest

Add setting history_interest_pml to game.ruleset [culture] section. Use value 0 to keep old behavior.

Configurable treaty clauses

Add sections for each enabled clause type to game.ruleset. To keep old behavior, enable them all

[clause_advance]
type = "Advance"

[clause_gold]
type = "Gold"

[clause_map]
type = "Map"

[clause_seamap]
type = "Seamap"

[clause_city]
type = "City"

[clause_ceasefire]
type = "Ceasefire"

[clause_peace]
type = "Peace"

[clause_alliance]
type = "Alliance"

[clause_vision]
type = "Vision"

[clause_embassy]
type = "Embassy"

Infrapoints

Extra infra cost

To completely disallow placing extras via infrapoints, like it used to be, set infracost of every extra type to 0.

Veterancy changes

Rename base chance settings

Some ruleset settings about veterancy gaining base chance have been renamed in units.ruleset. Replace veteran_raise_chance by veteran_base_raise_chance

Extra removal cause Enter

To keep old behavior of hut-type extras, add rmcause Enter for all of them.

AI trait builder has been added

The new AI trait "Builder" has been added. Add the following to nations.ruleset

; Value of trait "builder" defines how much AI wants to build buildings
builder_min = 30
builder_max = 90
builder_default = 50

See also

Editing Rulesets
Editing BuildingsEditing CitiesEditing EffectsEditing GameEditing Governments
Editing NationsEditing StylesEditing TechsEditing TerrainEditing Units
Update from 2.2 to 2.32.3 to 2.42.4 to 2.52.5 to 2.62.6 to 3.03.0 to 3.13.1 to 3.23.2 to 3.3
Advertisement