Freeciv
Advertisement

This document describes how to convert freeciv 2.6 compatible ruleset to development version (one that will become freeciv 3.0) compatible ones. Currently this goes up to compatibility with freeciv trunk revision 30974

Capability

Capability string of each ruleset file must be changed. Also a new format_version field needs to be added. For 3.0 rulesets the format version is 10.

[datafile]
options="+Freeciv-ruleset-Devel-2015.January.14"
format_version=10

Effect name no longer accepted

For backward compatibity reasons, loading of effects from a ruleset has supported giving effect type as name instead in previous versions. This is no longer possible, but only type is being supported. Change all remaining names to type

[effect_granary]
name	= "Growth_Food"
value	= 50
reqs	=
    { "type", "name", "range"
      "Building", "Granary", "City"
    }

->

[effect_granary]
type	= "Growth_Food"
value	= 50
reqs	=
    { "type", "name", "range"
      "Building", "Granary", "City"
    }

Resource Extra

Resources are now a kind of Extra. Parts of a resource, like the name field, now lives in its extra section. The rest of it still lives in its resource section. The resource is tied to its extra via its extra field. The category of an extra is "Resource". The causes of an extra is "Resource". The extra section's graphic, activity_gfx and rmact_gfx fields aren't used yet.

How to upgrade a resource

Say you have the following 2.6 resource:

[resource_gold]
name        = _("Gold")
graphic     = "ts.gold"
graphic_alt = "-"
identifier  = "$"
trade       = 6
# glacier, hills, mountains.

Add an extra section for it. Move the name field from the resource section to the extra section. Add the field extra to the resource section with the corresponding extra. Set the extra category field to "Resource" and the extra causes field to "Resource". Add the fields graphic, activity_gfx and rmact_gfx with the value "None" to the extra section.

[resource_gold]
extra       = "Gold"
graphic     = "ts.gold"
graphic_alt = "-"
identifier  = "$"
trade       = 6
# glacier, hills, mountains.
[extra_gold]
name           = _("Gold")
category       = "Resource"
causes         = "Resource"
;rmcauses       = ""
graphic        = "None"
graphic_alt    = "-"
activity_gfx   = "None"
act_gfx_alt    = "-"
rmact_gfx      = "None"
rmact_gfx_alt  = "-"

Caravan one time bonus

The one time bonus when a unit performs the actions "Enter Marketplace" and "Establish Trade Route" is less hard coded.

The one time bonus for entering the marketplace is no longer a third of the one time bonus for establishing a new trade route. If you want to keep the old rule add it back using the Trade_Revenue_Bonus effect like:

[effect_enter_marketplace_bonus_reduction]
type	= "Trade_Revenue_Bonus"
value	= -1585
reqs	=
    { "type", "name", "range"
      "Action", "Enter Marketplace", "Local"
    }

One time bonuses aren't tripled to resemble Civ 2 any more. If you want to keep the old rule add it back using the Trade_Revenue_Bonus effect like:

; Fudge factor to more closely approximate Civ2 behavior. (Civ2 is
; really very different -- this just fakes it a little better)
[effect_bonus_fudge_factor]
type	= "Trade_Revenue_Bonus"
value	= 1585

Have_Embassies split

Have_Embassies effect has been split to two separate effects. Now Have_Embassies itself provides embassies only with those players one has had contact with. New Have_Contacts effect provides contact with all the players. To keep old behavior of getting contact and embassy with all the players, just add Have_Contacts effects with exactly same requirements for each Have_Embassies. Those Have_Contacts effects will provide contacts for Have_Embassies to get embassy with everyone.

New Action Enablers

Found City

Old hardcoded unit type flag Cities has been retired and city founding is now controlled with Found City action enabler. To preserve old behavior reintroduce Cities as user unit type flag and make that an requirement for Found City action enablers.

[actionenabler_build_city_pioneer]
action = "Found City"
actor_reqs    =
    { "type",   "name", "range"
      "UnitFlag", "Cities", "Local"
      "UnitState", "OnLivableTile", "Local"
      "MinMoveFrags", "1", "Local"
    }
target_reqs    =
    { "type",   "name", "range", "present"
      "CityTile", "Claimed", "Local", FALSE
    }

[actionenabler_build_city_domestic]
action = "Found City"
actor_reqs    =
    { "type",   "name", "range", "present"
      "UnitFlag", "Cities", "Local", TRUE
      "UnitState", "OnLivableTile", "Local", TRUE
      "MinMoveFrags", "1", "Local", TRUE
      "DiplRel", "Is foreign", "Local", FALSE
    }

Add ui name for the action:

ui_name_found_city = _("%sBuild City%s")

Also, to avoid illegal action movement penalty getting paid for failed city founding attempt, make sure that no Illegal_Action_Move_Cost effect applies to Found City action.

[effect_illegal_action_move_cost_base]
type    = "Illegal_Action_Move_Cost"
value   = 1
reqs    =
    { "type", "name", "range", "present"
      "Action", "Found City", "Local", FALSE
      "Action", "Join City", "Local", FALSE
    }

Join City

Old hardcoded unit type flag AddToCity has been retired and growing a city is now controlled with Join City action enabler. To preserve old behavior reintroduce AddToCity as user unit type flag and make that an requirement for Join City action enabler.

 [actionenabler_join_city]
action = "Join City"
actor_reqs    =
    { "type",   "name", "range", "present"
      "Unitflag", "AddToCity", "Local", TRUE
      "DiplRel", "Is foreign", "Local", FALSE
      "MinMoveFrags", "1", "Local", TRUE
    }

Add ui name for the action:

ui_name_join_city = _("%sAdd to City%s")

Also, to avoid illegal action movement penalty getting paid for failed city founding attempt, make sure that no Illegal_Action_Move_Cost effect applies to Join City action. See Found City above.

Capture Units

Old hardcoded unit type flags Capturer and Capturable have been retired and capture is now controlled with Capture Units action enabler. To preserve old behavior reintroduce Capturer and Capturable as user unit type flags and make former an requirement for Capture Units action enabler actor, and latter for target.

 [actionenabler_capture]
action = "Capture Units"
actor_reqs    =
    { "type",   "name", "range"
      "Unitflag", "Capturer", "Local"
    }
target_reqs   =
    { "type",   "name", "range"
      "UnitFlag", "Capturable", "Local"
    }

Add ui name for the action:

ui_name_capture_units = _("%sCapture Units%s")

By default "Bombard", "Explode Nuclear" and regular attacks are available even when there would be possible to capture the units at a tile in stead. To force the old behavior of making those impossible when "Capture Units" is possible:

force_capture_units = TRUE

Bombard

Old hardcoded unit type flag Bombarder has been retired and bombardment is now controlled with the Bombard action enabler. To preserve old behavior reintroduce Bombarder as user unit type flag and make it a requirement for the actor in a Bombard action enabler.

 [actionenabler_bombard]
action = "Bombard"
actor_reqs    =
    { "type",   "name", "range", "present"
      "UnitFlag", "Bombarder", "Local", TRUE
      "UnitState", "Transported", "Local", FALSE
      "MinMoveFrags", "1", "Local", TRUE
    }
target_reqs    =
    { "type",   "name", "range", "present"
      "TerrainClass", "Oceanic", "Local", FALSE
    }

Add ui name for the action:

ui_name_bombard = _("%sBombard%s")

By default "Explode Nuclear" and regular attacks are available even when there would be possible to bombard a tile in stead. To force the old behavior of making those impossible when "Bombard" is possible:

force_bombard = TRUE

Explode Nuclear

Old hardcoded unit type flag Nuclear has been retired and detonating nukes is now controlled with the Explode Nuclear action enabler. To preserve old behavior reintroduce Nuclear as user unit type flag and make it a requirement for the actor in an Explode Nuclear action enabler.

 [actionenabler_nuke]
action = "Explode Nuclear"
actor_reqs    =
    { "type",   "name", "range", "present"
      "UnitFlag", "Nuclear", "Local", TRUE
    }

Add ui name for the action:

ui_name_explode_nuclear = _("Explode %sNuclear%s")

By default regular attacks are available even when there would be possible to detonate a nuke at a tile in stead. Force the old behavior of making it impossible when "Explode Nuclear" is possible:

force_explode_nuclear = TRUE

Disbanding a Unit

Letting the player disband a unit is now controlled by action enablers. The Recycle Unit action enabler controls disbanding a unit in a city to have 50% of its shield cost added to the city's current production. The Disband Unit action enabler controls disbanding it without getting anything in return. (Disbanding a unit in a city to have 100% of its shield cost added to the city's current production has been controlled by the Help Wonder action enabler since 2.6)

To preserve old behavior add the following action enablers:

[actionenabler_disband_unit]
action = "Disband Unit"
actor_reqs    =
    { "type",   "name", "range", "present"
      "UnitFlag", "Undisbandable", "Local", FALSE
    }

[actionenabler_recycle_unit]
action = "Recycle Unit"
actor_reqs    =
    { "type",   "name", "range", "present"
      "UnitFlag", "Undisbandable", "Local", FALSE
    }

Home City

Changing a unit's home city is now controlled with the Home City action enabler. The rule that the player can't give away a unit by moving it to an allied city and change its home city is no longer hard coded. To preserve old behavior add the following action enabler:

[actionenabler_change_home_city]
action = "Home City"
actor_reqs    =
    { "type",   "name", "range", "present"
      "DiplRel", "Is foreign", "Local", FALSE
    }

Add ui name for the action:

ui_name_home_city = _("Set %sHome City%s")

Upgrade Unit

Commanding a unit to upgrade is now controlled with the Upgrade Unit action enabler. To preserve old behavior add the following action enabler:

[actionenabler_upgrade_unit]
action = "Upgrade Unit"

Add ui name for the action:

ui_upgrade_unit = _("%sUpgrade Unit%s")

Paradrop Unit

Old hardcoded unit type flag Paratroopers has been retired and paradropping is now controlled with the Paradrop Unit action enabler. To preserve old behavior reintroduce Paratroopers as a user unit type flag and make it a requirement for the actor in a Paradrop Unit action enabler.

[actionenabler_paradrop]
action = "Paradrop Unit"
actor_reqs    =
    { "type",   "name", "range"
      "UnitFlag", "Paratroopers", "Local"
    }

Add ui name for the action:

ui_paradrop_unit = _("Drop %sParatrooper%s")

New in 3.0

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

  • "Steal Maps" - steal parts of the owner of the target city's map
  • "Suitcase Nuke" - cause a nuclear explosion in the target city
  • "Destroy City" - destroys the target city
  • "Expel Unit" - expels the target unit to its owner's capital.

Action enabler changes

Help Wonder target

A city can produce ("build") a unit or a building. The "Help Wonder" caravan action helps a city's production by adding 100% of the unit's shield cost to it. Disbanding a unit only adds 50% of the unit's shield cost to the city production.

The old, hard coded, rule was that wonders, great or small, could benefit from "Help Wonder". This rule has been replaced with an ability to specify what items can receive help in "Help Wonder" action enablers.

The old rules requires two action enablers for each 2.6 "Help Wonder" action enabler. Copy each "Help Wonder" action enabler in your ruleset. Remember to rename the copy. Add a local BuildingGenus requirement to the target requirement vector of both the original and the copy. Make one allow helping small wonders and the other allow helping great wonders.

So this 2.6 action enabler

[actionenabler_help_build_wonder]
action = "Help Wonder"
actor_reqs    =
    { "type",   "name", "range", "present"
      "UnitFlag", "HelpWonder", "Local", TRUE
      "DiplRel", "Is foreign", "Local", FALSE
    }

becomes

[actionenabler_help_build_great_wonder]
action = "Help Wonder"
actor_reqs    =
    { "type",   "name", "range", "present"
      "UnitFlag", "HelpWonder", "Local", TRUE
      "DiplRel", "Is foreign", "Local", FALSE
    }
target_reqs    =
    { "type",   "name", "range"
      "BuildingGenus", "GreatWonder", "Local"
    }

[actionenabler_help_build_small_wonder]
action = "Help Wonder"
actor_reqs    =
    { "type",   "name", "range", "present"
      "UnitFlag", "HelpWonder", "Local", TRUE
      "DiplRel", "Is foreign", "Local", FALSE
    }
target_reqs    =
    { "type",   "name", "range"
      "BuildingGenus", "SmallWonder", "Local"
    }

in 3.0.

Incidents caused by actions

An action may cause a diplomatic incident. The incident provides a valid casus belli against the actor player. A casus beli can be taken to the senate when declaring war.

The new effects Casus_Belli_Success and Casus_Belli_Caught controls action incident causing. The first is checked when an action is performed. The secound is checked when an action was prevented. 0 causes no incident. 1 causes an incident with the victim. 1000 causes an incident to every other player.

Here are effects matching the old hardcoded rules.

[effect_incident_caught_steal_tech]
type	= "Casus_Belli_Caught"
value	= 1
reqs	=
    { "type", "name", "range", "present"
      "Action", "Steal Tech", "Local", TRUE
      "DiplRel", "War", "Local", FALSE
    }

[effect_incident_success_steal_tech]
type	= "Casus_Belli_Success"
value	= 1
reqs	=
    { "type", "name", "range", "present"
      "Action", "Steal Tech", "Local", TRUE
      "DiplRel", "War", "Local", FALSE
    }

[effect_incident_caught_tgt_steal_tech]
type	= "Casus_Belli_Caught"
value	= 1
reqs	=
    { "type", "name", "range", "present"
      "Action", "Targeted Steal Tech", "Local", TRUE
      "DiplRel", "War", "Local", FALSE
    }

[effect_incident_success_tgt_steal_tech]
type	= "Casus_Belli_Success"
value	= 1
reqs	=
    { "type", "name", "range", "present"
      "Action", "Targeted Steal Tech", "Local", TRUE
      "DiplRel", "War", "Local", FALSE
    }

[effect_incident_success_bribe_unit]
type	= "Casus_Belli_Success"
value	= 1
reqs	=
    { "type", "name", "range", "present"
      "Action", "Bribe Unit", "Local", TRUE
      "DiplRel", "War", "Local", FALSE
    }

[effect_incident_success_sabotage_unit]
type	= "Casus_Belli_Success"
value	= 1
reqs	=
    { "type", "name", "range", "present"
      "Action", "Sabotage Unit", "Local", TRUE
      "DiplRel", "War", "Local", FALSE
    }

[effect_incident_success_incite]
type	= "Casus_Belli_Success"
value	= 1
reqs	=
    { "type", "name", "range", "present"
      "Action", "Incite City", "Local", TRUE
      "DiplRel", "War", "Local", FALSE
    }

[effect_incident_success_poison]
type	= "Casus_Belli_Success"
value	= 1
reqs	=
    { "type", "name", "range", "present"
      "Action", "Poison City", "Local", TRUE
      "DiplRel", "War", "Local", FALSE
    }

[effect_incident_success_sabotage_city]
type	= "Casus_Belli_Success"
value	= 1
reqs	=
    { "type", "name", "range", "present"
      "Action", "Sabotage City", "Local", TRUE
      "DiplRel", "War", "Local", FALSE
    }

[effect_incident_success_tgt_sabotage_city]
type	= "Casus_Belli_Success"
value	= 1
reqs	=
    { "type", "name", "range", "present"
      "Action", "Targeted Sabotage City", "Local", TRUE
      "DiplRel", "War", "Local", FALSE
    }

[effect_incident_success_explode_nuke]
type	= "Casus_Belli_Success"
value	= 1
reqs	=
    { "type", "name", "range", "present"
      "Action", "Explode Nuclear", "Local", TRUE
    }

Action risk

The new effect Action_Odds_Pct manipulates some actions' chance of success.

Targeted Sabotage City

The rule that the action Targeted Sabotage City is twice as difficult as Sabotage City isn't hard coded any more. If you want to keep the old rule add it back using the Action_Odds_Pct effect like:

[effect_tgt_sabotage_city_half_chance]
type	= "Action_Odds_Pct"
value	= -50
reqs	=
    { "type", "name", "range", "present"
      "Action", "Targeted Sabotage City", "Local", TRUE
    }

Missing unit upkeep consequences

When a player fails to pay the food, gold or shield upkeep of a unit it has consequences. The consequences for the unit is now configurable in the missing_unit_upkeep section of cities.ruleset. The following settings keep the old rules:

[missing_unit_upkeep]
food_protected    = "Undisbandable"
; food_unit_act   =
food_wipe         = TRUE

; gold_protected  =
; gold_unit_act   =
gold_wipe         = TRUE

shield_protected  = "Undisbandable"
shield_unit_act   = "Help Wonder", "Recycle Unit", "Disband Unit"
shield_wipe       = FALSE

Goods

Trade Goods are a new concept in 3.0. At least one goods type must be defined in game.ruleset

[goods_good]
name = _("Goods")

See also

Template:UpdateNavbox

Advertisement