Freeciv
("Surgical Strike Building")
("Transport Board", "Transport Embark" and "Transport Disembark")
Line 2: Line 2:
 
ruleset to development version (one that will become freeciv 3.1)
 
ruleset to development version (one that will become freeciv 3.1)
 
compatible ones. Currently this goes up to compatibility with
 
compatible ones. Currently this goes up to compatibility with
freeciv master commit 6124fe8eff, 22-Nov-26.
+
freeciv master commit 0adbbc46b7, 30-Nov-26.
   
 
==Capability==
 
==Capability==
Line 215: Line 215:
   
 
===Transport entry and exit action enablers===
 
===Transport entry and exit action enablers===
Entering to and exiting from a transport unit is now action enabler controlled. "Transport Alight" covers cargo initiated unloading of the actor from a transport to the current tile. "Transport Unload" covers transporter initiated unloading of a target unit to the current tile.
+
Entering to and exiting from a transport unit is now action enabler controlled. "Transport Board" covers cargo initiated entering of the actor unit to a transport on the same tile. "Transport Embark" covers cargo initiated entering of the actor unit to a transport on an adjacent tile. "Transport Alight" covers cargo initiated unloading of the actor from a transport to the current tile. "Transport Unload" covers transporter initiated unloading of a target unit to the current tile. "Transport Disembark" covers cargo initiated transport exit of the actor unit to an adjacent tile.
   
 
To keep the old rules add the following action enablers:
 
To keep the old rules add the following action enablers:
Line 228: Line 228:
 
{ "type", "name", "range"
 
{ "type", "name", "range"
 
"UnitState", "Transporting", "Local"
 
"UnitState", "Transporting", "Local"
  +
}
  +
  +
[actionenabler_board]
  +
action = "Transport Board"
  +
actor_reqs =
  +
{ "type", "name", "range", "present"
  +
"DiplRel", "Armistice", "Local", FALSE
  +
"DiplRel", "War", "Local", FALSE
  +
"DiplRel", "Cease-fire", "Local", FALSE
  +
"DiplRel", "Peace", "Local", FALSE
  +
"DiplRel", "Never met", "Local", FALSE
 
}
 
}
   
Line 241: Line 252:
 
"UnitState", "Transported", "Local"
 
"UnitState", "Transported", "Local"
 
}
 
}
  +
</pre>
 
  +
[actionenabler_disembark]
  +
action = "Transport Disembark"
  +
actor_reqs =
  +
{ "type", "name", "range"
  +
"UnitState", "Transported", "Local"
  +
"MinMoveFrags", "1", "Local"
  +
}
  +
  +
[actionenabler_embark]
  +
action = "Transport Embark"
  +
actor_reqs =
  +
{ "type", "name", "range", "present"
  +
"MinMoveFrags", "1", "Local", TRUE
  +
"DiplRel", "Armistice", "Local", FALSE
  +
"DiplRel", "War", "Local", FALSE
  +
"DiplRel", "Cease-fire", "Local", FALSE
  +
"DiplRel", "Peace", "Local", FALSE
  +
"DiplRel", "Never met", "Local", FALSE
 
}</pre>
   
 
===New in 3.1===
 
===New in 3.1===

Revision as of 16:15, 12 February 2020

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 0adbbc46b7, 30-Nov-26.

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"
    }

Transport entry and exit action enablers

Entering to and exiting from a transport unit is now action enabler controlled. "Transport Board" covers cargo initiated entering of the actor unit to a transport on the same tile. "Transport Embark" covers cargo initiated entering of the actor unit to a transport on an adjacent tile. "Transport Alight" covers cargo initiated unloading of the actor from a transport to the current tile. "Transport Unload" covers transporter initiated unloading of a target unit to the current tile. "Transport Disembark" covers cargo initiated transport exit of the actor unit to an adjacent tile.

To keep the old rules add the following action enablers:

[actionenabler_alight]
action        = "Transport Alight"
actor_reqs    =
    { "type",      "name",          "range"
      "UnitState", "OnLivableTile", "Local"
      "UnitState", "Transported",   "Local"
    }
target_reqs    =
    { "type",      "name",         "range"
      "UnitState", "Transporting", "Local"
    }

[actionenabler_board]
action        = "Transport Board"
actor_reqs    =
    { "type",    "name",       "range", "present"
      "DiplRel", "Armistice",  "Local", FALSE
      "DiplRel", "War",        "Local", FALSE
      "DiplRel", "Cease-fire", "Local", FALSE
      "DiplRel", "Peace",      "Local", FALSE
      "DiplRel", "Never met",  "Local", FALSE
    }

[actionenabler_unload]
action        = "Transport Unload"
actor_reqs    =
    { "type",      "name",         "range"
      "UnitState", "Transporting", "Local"
    }
target_reqs    =
    { "type",      "name",          "range"
      "UnitState", "OnLivableTile", "Local"
      "UnitState", "Transported",   "Local"
    }

[actionenabler_disembark]
action        = "Transport Disembark"
actor_reqs    =
    { "type",         "name",        "range"
      "UnitState",    "Transported", "Local"
      "MinMoveFrags", "1",           "Local"
    }

[actionenabler_embark]
action        = "Transport Embark"
actor_reqs    =
    { "type",         "name",       "range", "present"
      "MinMoveFrags", "1",          "Local", TRUE
      "DiplRel",      "Armistice",  "Local", FALSE
      "DiplRel",      "War",        "Local", FALSE
      "DiplRel",      "Cease-fire", "Local", FALSE
      "DiplRel",      "Peace",      "Local", FALSE
      "DiplRel",      "Never met",  "Local", FALSE
    }

New in 3.1

Some brand new actions that didn't exist in 3.0 have been added. They are completely optional. To keep 3.0 behavior you shouldn't enable them at all.

  • "Surgical Strike Building" - destroy a player specified building.

Action move cost to the ruleset

The new effects Action_Success_Actor_Move_Cost and Action_Success_Target_Move_Cost have been added. Action_Success_Actor_Move_Cost subtracts move fragments from an actor unit after a successfully performed action. Action_Success_Target_Move_Cost does the same for a unit that is the target of an action.

Action_Success_Actor_Move_Cost

The actor 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". How many move fragments a single move is is defined in move_fragments in terrain.ruleset. 65535 is large enough to make Freeciv know that all remaining movement is gone when reasoning about an action's move cost. Assuming that move_fragments is 3 the below effects brings 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
    }

Action_Success_Target_Move_Cost

The actor move fragment price for successful "Expel Unit" has moved to the ruleset. It took all remaining move fragments. Assuming that move_fragments is 3 the below effects brings the old rules back:

[effect_action_success_move_cost_expelled]
type    = "Action_Success_Target_Move_Cost"
value   = 65535
reqs    =
    { "type", "name", "range", "present"
      "Action", "Expel 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