Modrules.lua: Difference between revisions

From Spring
Jump to navigationJump to search
Flozi (talk | contribs)
 
(59 intermediate revisions by 10 users not shown)
Line 6: Line 6:


==Source==
==Source==
The engine source code which parses the data from this file is viewable here:{{sourcelink|file=rts/Sim/Misc/ModInfo.cpp}}
The engine source code which parses the data from this file is viewable here:
 
* {{sourcelink|file=rts/Sim/Misc/ModInfo.cpp}}
 
==Data Types==
{{DataTypes}}


==Details==
==Details==
<code>Modrules.lua</code> is divided into several sub-tables containing tags specific to each section, as follows:
<code>Modrules.lua</code> is divided into several sub-tables containing tags specific to each section, as follows:


===movement===
{{tag
|name = allowAirPlanesToLeaveMap
|type = bool
|default = true
|description = Are aircraft allowed to fly outside the bounds of the map?}}


===capture===
{{tag
{{tag
|name = allowPushingEnemyUnits
|name = energyCostFactor
|type = bool
|type = float
|default = false
|default = 0.0
|description = Can enemy units push each other out of the way?}}
|description = How much of the original energy cost it requires to capture something.
 
}}
{{tag
|name = allowCrushingAlliedUnits
|type = bool
|default = false
|description = Can allied units crush each other? Units still have to be explicitly set as crushable using the <code>crushable</code> parameter of [[Lua_SyncedCtrl#Unit_Control|Spring.SetUnitBlocking]].}}


{{tag
|name = allowUnitCollisionDamage
|type = bool
|default = false
|description = Do unit-unit collisions cause damage?}}
===nanospray===
{{tag
|name = allow_team_colors
|type = bool
|default = true
|description = Are players allowed to use teamcolour nanospray? Set by the <code>TeamNanoSpray</code> key in the [[Springrc|config file]].}}


===construction===
===construction===
Line 48: Line 31:
|type = bool
|type = bool
|default = true
|default = true
|description = Do uncompleted building frames begin to decay if no builder is working on them?}}
|description = Do uncompleted building frames begin to decay if no builder is working on them?
}}


{{tag
{{tag
Line 54: Line 38:
|type = float
|type = float
|default = 6.66
|default = 6.66
|description = The time in seconds before abandoned building frames begin to decay.}}
|description = The time in seconds before abandoned building frames begin to decay.
}}


{{tag
{{tag
Line 60: Line 45:
|type = float
|type = float
|default = 0.03
|default = 0.03
|description = How fast build progress decays for abandoned building frames. Note that the rate is inversely proportional to the <code>buildtime</code> i.e. a building with a larger <code>buildtime</code> will decay more slowly for a given <code>constructionDecaySpeed</code> than a building with a shorter <code>buildtime</code>.}}
|description = How fast build progress decays for abandoned building frames. Note that the rate is inversely proportional to the {{xtaglink|Gamedev:UnitDefs|buildtime}} i.e. a building with a larger {{xtaglink|Gamedev:UnitDefs|buildtime}} will decay more slowly for a given value of this tag than a building with a shorter {{xtaglink|Gamedev:UnitDefs|buildtime}}.
}}
 


===reclaim===
===experience===
{{tag
|name = experienceMult
|type = float
|default = 1.0
|description = Controls the amount of experience gained by units engaging in combat. The formulae used are:
::<code>xp for damage = 0.1 * experienceMult * damage / target_HP * target_power / attacker_power</code>
::<code>xp for kill = 0.1 * experienceMult * target_power / attacker_power</code>.
: Where {{xtaglink|Gamedev:UnitDefs|power}} can be set by the UnitDef tag.
}}


===repair===
{{tag
{{tag
|name = energyCostFactor
|name = powerScale
|type = float
|type = float
|default = 0.0
|default = 1.0
|description = How much of the original cost it requires to repair something.}}
|description = Controls how gaining experience changes the relative {{xtaglink|Gamedev:UnitDefs|power}} of the unit. The formula used is <code>Power multiplier = powerScale * (1 + xp / (xp + 1))</code>.
}}


===resurrect===
{{tag
{{tag
|name = energyCostFactor
|name = healthScale
|type = float
|type = float
|default = 0.5
|default = 0.7
|description = How much of the original cost it requires to resurrect something.}}
|description = Controls how gaining experience increases the {{xtaglink|Gamedev:UnitDefs|maxDamage}} (total hitpoints) of the unit. The formula used is <code>Health multiplier = healthScale * (1 + xp / (xp + 1))</code>.
}}


===capture===
{{tag
{{tag
|name = energyCostFactor
|name = reloadScale
|type = float
|type = float
|default = 0.0
|default = 0.4
|description = How much of the original cost it requires to capture something.}}
|description = Controls how gaining experience decreases the {{xtaglink|Gamedev:UnitDefs|reloadTime}} of the unit's weapons. The formula used is <code>Rate of fire multiplier = reloadScale * (1 + xp / (xp + 1))</code>.
}}
 


===paralyze===
===featureLOS===
{{tag
{{tag
|name = paralyzeOnMaxHealth
|name = featureVisibility
|type = bool
|type = int
|default = true
|default = 3
|description = Are units paralyzed when the level of emp is greater than their current health or their maximum health?}}
|description = Controls the visibility of features. Can be <code>0</code> - no default LOS for features, <code>1</code> - Gaia features always visible, <code>2</code> - allyteam & Gaia features always visible, or <code>3</code> - all features always visible.
}}
 


===fireAtDead===
===fireAtDead===
Line 97: Line 96:
|type = bool
|type = bool
|default = false
|default = false
|description = Will units continue to target and fire on enemies which are running their <code>Killed()</code> animation? (See [[Animation-LuaCallins#Generic]])}}
|description = Will units continue to target and fire on enemies which are running their <code>Killed()</code> animation? (See [[Animation-LuaCallins#Generic]])
}}


{{tag
{{tag
Line 103: Line 103:
|type = bool
|type = bool
|default = false
|default = false
|description = Will units continue to target and fire on enemy aircraft which are in the 'crashing' state? (See [[Lua_SyncedCtrl#Unit_Control]])}}
|description = Will units continue to target and fire on enemy aircraft which are in the 'crashing' state? (See [[Lua_SyncedCtrl#Unit_Control]])
}}
 
 
===flankingBonus===
{{tag
|name = defaultMode
|type = int
|default = 1
|description = The default {{xtaglink|Gamedev:UnitDefs|flankingBonusMode}} for units. Can be <code>0</code> - No flanking bonus. Mode <code>1</code> builds up the ability to move over time, and swings to face attacks, but does not respect the way the unit is facing. Mode <code>2</code> also can swing, but moves with the unit as it turns. Mode <code>3</code> stays with the unit as it turns and otherwise doesn't move, the ideal mode to simulate something such as tank armour.
}}
 
 
===los===
{{tag
|name = losMipLevel
|type = int
|default = 1
|description = Controls the resolution of the LOS calculations. A higher value means lower resolution but increased performance. An increase by one level means half the resolution of the LOS map in both x and y direction. Must be between <code>0</code> and <code>6</code> inclusive.
}}
 
{{tag
|name = losMul
|type = float
|default = 1.0
|special = {{removed|101.0}}
|description = Multiplies all unit's {{xtaglink|Gamedev:UnitDefs|sightDistance}} by this value. Generally speaking you should always use the default.
}}
 
{{tag
|name = airMipLevel
|type = int
|default = 1
|description = Controls the resolution of the LOS vs. aircraft calculations. A higher value means lower resolution but increased performance. An increase by one level means half the resolution of the air-LOS map in both x and y direction. Must be between <code>0</code> and <code>30</code> inclusive. [http://springrts.com/mantis/view.php?id=4031#c11709] - jK describe for you what the value means.
}}
 
{{tag
|name = airLosMul
|type = float
|default = 1.0
|special = {{removed|101.0}}
|description = Multiplies all unit's {{xtaglink|Gamedev:UnitDefs|airSightDistance}} by this value. Generally speaking you should always use the default.
}}
 
{{tag
|name = radarMipLevel
|type = int
|default = 2
|description = Controls the resolution of the radar. See description of airMipLevel for details.
}}
 
===movement===
{{tag
|name = allowAirPlanesToLeaveMap
|type = bool
|default = true
|description = Are (gunship) aircraft allowed to fly outside the bounds of the map?
}}
 
{{tag
|name = allowAircraftToHitGround
|type = bool
|default = true
|special = {{new|90.0}}
|description = Are aircraft allowed to hit the ground whilst manoeuvring?
}}


===transportability===
{{tag
{{tag
|name = transportAir
|name = allowPushingEnemyUnits
|type = bool
|type = bool
|default = false
|default = false
|description = Can aircraft be transported?}}
|special = {{new|83.0}}
|description = Can enemy ground units push each other during collisions?
}}


{{tag
{{tag
|name = transportShip
|name = allowCrushingAlliedUnits
|type = bool
|type = bool
|default = false
|default = false
|description = Can ships be transported?}}
|special = {{new|85.0}}
|description = Can allied ground units crush each other during collisions? Units still have to be explicitly set as crushable using the <code>crushable</code> parameter of [[Lua_SyncedCtrl#Unit_Control|Spring.SetUnitBlocking]].
}}


{{tag
{{tag
|name = transportHover
|name = allowUnitCollisionDamage
|type = bool
|type = bool
|default = false
|default = false
|description = Can hovercraft be transported?}}
|special = {{new|85.0}}
|description = Do unit-unit (skidding) collisions cause damage?
}}


{{tag
{{tag
|name = transportGround
|name = allowUnitCollisionOverlap
|type = bool
|type = bool
|default = true
|default = true
|description = Can ground units be transported?}}
|special = {{new|89.0}}
|description = Can mobile units collision volumes overlap one another? Allows unit movement like [http://www.youtube.com/watch?v=mRtePUdVk2o this (video)] at the cost of more 'clumping'.
}}


===experience===
{{tag
|name = allowGroundUnitGravity
|type = bool
|default = true
|special = {{new|92.0}}
|description = Allows fast moving mobile units to 'catch air' as they move over terrain.
}}


===flankingBonus===
{{tag
The page [[Units:FlankingBonus]] explains the flanking bonus that can be set in this file.
|name = allowHoverUnitStrafing
|type = bool
|default = true if using QTPFS pathfinder
|special = {{new|92.0}}
|description = Allows hovercraft units to slide in turns.
}}


===featureLOS===
{{tag
|name = useClassicGroundMoveType
|type = bool
|default = false
|special = {{new|89.0}} {{removed|102.0}}
|description = A ticket back to unit movement circa 2009: no reversing, no {{xtaglink|Gamedev:UnitDefs|turninplace|false}}, no smooth collision handling, no nothing. For comparison of pathfinding code.
}}


===sensors===
===paralyze===
{{tag
|name = paralyzeOnMaxHealth
|type = bool
|default = true
|description = Are units paralyzed when the level of emp is greater than their current health or their maximum health?
}}


====los====


===system===
===reclaim===
{{tag
|name = multiReclaim
|type = int
|default = 0
|description = Can multiple units reclaim a feature or only one? <code>0</code> implies the latter, all other values the former.
}}


==Examples==
{{tag
|name = reclaimMethod
|type = int
|default = 1
|description = Controls how features are reclaimed. Can be <code>0</code> - gradual reclaim, <code>1</code> - all reclaimed at end, any other positive value <code>n</code> - reclaim in <code>n</code> chunks.
}}


===Empty===
{{tag
|name = unitMethod
|type = int
|default = 1
|description = Controls how units are reclaimed. Can be <code>0</code> - gradual reclaim, <code>1</code> - all reclaimed at end, any other positive value <code>n</code> - reclaim in <code>n</code> chunks.
}}


modrules.lua can simply return an empty table like this:
{{tag
<code><pre>
|name = featureEnergyCostFactor
return {}
|type = float
</pre></code>
|default = 0.0
if you do this, Spring will use its hardcoded default values.
|description = How much energy should reclaiming a feature cost? Multiplier against the fraction of the features' {{xtaglink|Gamedev:FeatureDefs|metal}} content reclaimed.
}}


{{tag
|name = unitEnergyCostFactor
|type = float
|default = 0.0
|description = How much energy should reclaiming a unit cost? Multiplier against the fraction of the unit's {{xtaglink|Gamedev:UnitDefs|buildCostEnergy}} reclaimed.
}}


===Complete===
{{tag
|name = unitEfficiency
|type = float
|default = 1.0
|description = How much metal should reclaiming a unit return? Multiplier against the unit's {{xtaglink|Gamedev:UnitDefs|buildCostMetal}}.
}}


This is the full modrules.lua of the [http://code.google.com/p/zero-k/ zeroK] game:
{{tag
|name = allowEnemies
|type = bool
|default = true
|description = Can enemy units be reclaimed?
}}


<code><pre>
{{tag
local modrules  = {
|name = allowAllies
|type = bool
|default = true
|description = Can allied units be reclaimed?
}}


  construction = {
    constructionDecay      = false; -- defaults to true
    constructionDecayTime  = 6.66;  -- defaults to 6.66
    constructionDecaySpeed = 0.03;  -- defaults to 0.03
  },


  reclaim = {
===repair===
    multiReclaim  = 1;    -- defaults to 0
{{tag
    reclaimMethod = 0;    -- defaults to 1
|name = energyCostFactor
    unitMethod    = 0;    -- defaults to 1
|type = float
|default = 0.0
|description = How much of the original energy cost it requires to repair something.
}}


    unitEnergyCostFactor    = 0;  -- defaults to 0
    unitEfficiency          = 0.5;  -- defaults to 1
    featureEnergyCostFactor = 0;  -- defaults to 0


    allowEnemies  = false;  -- defaults to true
===resurrect===
    allowAllies  = false;  -- defaults to true
{{tag
  },
|name = energyCostFactor
|type = float
|default = 0.5
|description = How much of the original energy cost it requires to resurrect something.
}}




  repair = {
===sensors===
    energyCostFactor = 1/3, -- defaults to 0
{{tag
  },
|name = requireSonarUnderWater
|type = bool
|default = true
|description = If <code>true</code> then when underwater, units only get LOS if they also have sonar.
}}
{{tag
|name = alwaysVisibleOverridesCloaked
|type = bool
|default = false
|special = {{new|101.0}}
|description = If <code>true</code> then units will be visible even when cloaked (probably?).
}}
{{tag
|name = separateJammers
|type = bool
|default = true
|special = {{new|101.0}}
|description = When <code>true</code> each allyTeam only jams their own units.
}}


===system===
{{tag
|name = pathFinderSystem
|type = int
|default = 0
|special={{new|85.0}}
|description = Which pathfinder does the game use? Can be <code>0</code> - The legacy default pathfinder, <code>1</code> - Quad-Tree Pathfinder System ([[QTPFS]])}} or <code>-1</code> - disabled.


  resurrect = {
{{tag
    energyCostFactor = 1.2,  -- defaults to 0.5
|name = pathFinderUpdateRate
  },
|type = float
|default = 0.007
|special={{new|98.0}}
|description = Controls how often the pathfinder updates; larger values means more rapid updates.}}


{{tag
|name = pathFinderRawDistMult
|type = float
|default = 1.25
|special={{new|105.+ BAR}}
|description = Engine does raw move with a limited distance, this multiplier adjusts that}}


  capture = {
{{tag
    energyCostFactor = 1,  -- defaults to 0
|name = allowTake
  },
|type = bool
 
|default = true
 
|special = {{new|103.0}}
  paralyze = {
|description = Enables and disables the {{var|/take}} [[UI_commands|UI command]].}}
    paralyzeOnMaxHealth = true, -- defaults to true
  },


  sensors = {
===transportability===
    requireSonarUnderWater = true,  -- defaults to true
{{tag
   
|name = transportAir
    los = {
|type = bool
      losMipLevel = 3,  -- defaults to 1
|default = false
      losMul      = 1,  -- defaults to 1
|description = Can aircraft be transported?
      airMipLevel = 4,  -- defaults to 2
}}
      airMul      = 1,  -- defaults to 1
    },
  },


{{tag
|name = transportShip
|type = bool
|default = false
|description = Can ships be transported?
}}


  transportability = {
{{tag
    transportGround = 1;  -- defaults to 1
|name = transportHover
    transportHover  = 1;  -- defaults to 0
|type = bool
    transportShip  = 0;  -- defaults to 0
|default = false
    transportAir    = 0;  -- defaults to 0
|description = Can hovercraft be transported?
  },
}}


{{tag
|name = transportGround
|type = bool
|default = true
|description = Can ground units be transported?
}}


  flankingBonus = {
{{tag
    -- defaults to 1
|name = targetableTransportedUnits
    -- 0: no flanking bonus 
|type = bool
    -- 1: global coords, mobile 
|default = false
    -- 2: unit coords, mobile 
|special = {{new|89.0}}
    -- 3: unit coords, locked
|description = Can transported units be targeted by weapons? <code>true</code> allows both manual and automatic targeting.
    defaultMode=0;
}}
  },




  experience = {
==Examples==
    experienceMult = 1.0; -- defaults to 1.0


    -- these are all used in the following form:
===Empty===
    --  value = defValue * (1 + (scale * (exp / (exp + 1))))
    powerScale  = 0.7;  -- defaults to 1.0
    healthScale = 0;  -- defaults to 0.7
    reloadScale = 0.5;  -- defaults to 0.4
  },


<code>modrules.lua</code> can simply return an empty table like this:
<pre>
return {}
</pre>
If you do this, Spring will use the default values.


  fireAtDead = {
===Configurable by modoptions===
    fireAtKilled  = false;  -- defaults to false
Interestingly <code>modrules.lua</code> can read [[Modoptions.lua|modoptions]], so these parameters can be scripted to be configurable from the lobby.
    fireAtCrashing = false;  -- defaults to false
For example to allow selecting either legacy default pathfinder or [[QTPFS]] via a modoption:
  },
<pre>
 
 
  nanospray = {
    allow_team_colors = true;  -- defaults to true
  },
 
  featureLOS = {
    -- 0 - no default LOS for features
    -- 1 - gaia features always visible
    -- 2 - allyteam/gaia features always visible
    -- 3 - all features always visible
    -- default 3
    featureVisibility = 1;
  },
 
  -- new in >84.0
  movement = {
    allowAirPlanesToLeaveMap = true;  -- defaults to true
    allowPushingEnemyUnits  = false; -- defaults to false
    allowCrushingAlliedUnits = false; -- defaults to false
    allowUnitCollisionDamage = false; -- defaults to false
  },
 
  -- new in >84.0
   system = {
   system = {
     luaThreadingModel = 2;
     pathFinderSystem = (Spring.GetModOptions() and (Spring.GetModOptions().qtpfs == "1") and 1) or 0,
    pathFinderSystem  = 0;
   },
   },
}
</pre>
 
return modrules
</pre></code>


===External Examples===
[https://github.com/EvolutionRTS/Evolution-RTS/blob/master/Gamedata/modrules.lua 'Evolution RTS' Modrules.lua]


[[Category:Game development]]
[[Category:gamedata]]
[[Category:gamedata]]

Latest revision as of 06:23, 5 July 2022

Location

modrules.lua is a file in the Gamedata/ directory of a Spring game.

Purpose

This file controls various global parameters of the game, for example how fast units gain experience, what unit types can be transported, how fine grained the LOS system is, etc.

Source

The engine source code which parses the data from this file is viewable here:

Data Types

int
An integer number. eg. 5
float
A number with decimals. eg 1.023
bool
A value which can be true or false. eg true
string
Text, or more precisely a string of alphanumeric characters. eg "string of characters"
rgb
Three float components, representing red, green and blue components, ranged from 0.0 to 1.0. eg {0.0, 0.0, 0.0}
float3
Three float components, eg {0.0, 0.0, 0.0}
float4
Four float components, eg {0.0, 0.0, 0.0, 0.0}

Details

Modrules.lua is divided into several sub-tables containing tags specific to each section, as follows:


capture

float energyCostFactor  default: 0.0 

How much of the original energy cost it requires to capture something.


construction

bool constructionDecay  default: true 

Do uncompleted building frames begin to decay if no builder is working on them?

float constructionDecayTime  default: 6.66 

The time in seconds before abandoned building frames begin to decay.

float constructionDecaySpeed  default: 0.03 

How fast build progress decays for abandoned building frames. Note that the rate is inversely proportional to the buildtime i.e. a building with a larger buildtime will decay more slowly for a given value of this tag than a building with a shorter buildtime.


experience

float experienceMult  default: 1.0 

Controls the amount of experience gained by units engaging in combat. The formulae used are:
xp for damage = 0.1 * experienceMult * damage / target_HP * target_power / attacker_power
xp for kill = 0.1 * experienceMult * target_power / attacker_power.
Where power can be set by the UnitDef tag.

float powerScale  default: 1.0 

Controls how gaining experience changes the relative power of the unit. The formula used is Power multiplier = powerScale * (1 + xp / (xp + 1)).

float healthScale  default: 0.7 

Controls how gaining experience increases the maxDamage (total hitpoints) of the unit. The formula used is Health multiplier = healthScale * (1 + xp / (xp + 1)).

float reloadScale  default: 0.4 

Controls how gaining experience decreases the reloadTime of the unit's weapons. The formula used is Rate of fire multiplier = reloadScale * (1 + xp / (xp + 1)).


featureLOS

int featureVisibility  default: 3 

Controls the visibility of features. Can be 0 - no default LOS for features, 1 - Gaia features always visible, 2 - allyteam & Gaia features always visible, or 3 - all features always visible.


fireAtDead

bool fireAtKilled  default: false 

Will units continue to target and fire on enemies which are running their Killed() animation? (See Animation-LuaCallins#Generic)

bool fireAtCrashing  default: false 

Will units continue to target and fire on enemy aircraft which are in the 'crashing' state? (See Lua_SyncedCtrl#Unit_Control)


flankingBonus

int defaultMode  default: 1 

The default flankingBonusMode for units. Can be 0 - No flanking bonus. Mode 1 builds up the ability to move over time, and swings to face attacks, but does not respect the way the unit is facing. Mode 2 also can swing, but moves with the unit as it turns. Mode 3 stays with the unit as it turns and otherwise doesn't move, the ideal mode to simulate something such as tank armour.


los

int losMipLevel  default: 1 

Controls the resolution of the LOS calculations. A higher value means lower resolution but increased performance. An increase by one level means half the resolution of the LOS map in both x and y direction. Must be between 0 and 6 inclusive.

float losMul  default: 1.0 Removed from version 101.0

Multiplies all unit's sightDistance by this value. Generally speaking you should always use the default.

int airMipLevel  default: 1 

Controls the resolution of the LOS vs. aircraft calculations. A higher value means lower resolution but increased performance. An increase by one level means half the resolution of the air-LOS map in both x and y direction. Must be between 0 and 30 inclusive. [1] - jK describe for you what the value means.

float airLosMul  default: 1.0 Removed from version 101.0

Multiplies all unit's airSightDistance by this value. Generally speaking you should always use the default.

int radarMipLevel  default: 2 

Controls the resolution of the radar. See description of airMipLevel for details.

movement

bool allowAirPlanesToLeaveMap  default: true 

Are (gunship) aircraft allowed to fly outside the bounds of the map?

bool allowAircraftToHitGround  default: true New in version 90.0

Are aircraft allowed to hit the ground whilst manoeuvring?

bool allowPushingEnemyUnits  default: false New in version 83.0

Can enemy ground units push each other during collisions?

bool allowCrushingAlliedUnits  default: false New in version 85.0

Can allied ground units crush each other during collisions? Units still have to be explicitly set as crushable using the crushable parameter of Spring.SetUnitBlocking.

bool allowUnitCollisionDamage  default: false New in version 85.0

Do unit-unit (skidding) collisions cause damage?

bool allowUnitCollisionOverlap  default: true New in version 89.0

Can mobile units collision volumes overlap one another? Allows unit movement like this (video) at the cost of more 'clumping'.

bool allowGroundUnitGravity  default: true New in version 92.0

Allows fast moving mobile units to 'catch air' as they move over terrain.

bool allowHoverUnitStrafing  default: true if using QTPFS pathfinder New in version 92.0

Allows hovercraft units to slide in turns.

bool useClassicGroundMoveType  default: false New in version 89.0 Removed from version 102.0

A ticket back to unit movement circa 2009: no reversing, no turninplace = false, no smooth collision handling, no nothing. For comparison of pathfinding code.

paralyze

bool paralyzeOnMaxHealth  default: true 

Are units paralyzed when the level of emp is greater than their current health or their maximum health?


reclaim

int multiReclaim  default: 0 

Can multiple units reclaim a feature or only one? 0 implies the latter, all other values the former.

int reclaimMethod  default: 1 

Controls how features are reclaimed. Can be 0 - gradual reclaim, 1 - all reclaimed at end, any other positive value n - reclaim in n chunks.

int unitMethod  default: 1 

Controls how units are reclaimed. Can be 0 - gradual reclaim, 1 - all reclaimed at end, any other positive value n - reclaim in n chunks.

float featureEnergyCostFactor  default: 0.0 

How much energy should reclaiming a feature cost? Multiplier against the fraction of the features' metal content reclaimed.

float unitEnergyCostFactor  default: 0.0 

How much energy should reclaiming a unit cost? Multiplier against the fraction of the unit's buildCostEnergy reclaimed.

float unitEfficiency  default: 1.0 

How much metal should reclaiming a unit return? Multiplier against the unit's buildCostMetal.

bool allowEnemies  default: true 

Can enemy units be reclaimed?

bool allowAllies  default: true 

Can allied units be reclaimed?


repair

float energyCostFactor  default: 0.0 

How much of the original energy cost it requires to repair something.


resurrect

float energyCostFactor  default: 0.5 

How much of the original energy cost it requires to resurrect something.


sensors

bool requireSonarUnderWater  default: true 

If true then when underwater, units only get LOS if they also have sonar.

bool alwaysVisibleOverridesCloaked  default: false New in version 101.0

If true then units will be visible even when cloaked (probably?).

bool separateJammers  default: true New in version 101.0

When true each allyTeam only jams their own units.

system

int pathFinderSystem  default: 0 New in version 85.0

Which pathfinder does the game use? Can be 0 - The legacy default pathfinder, 1 - Quad-Tree Pathfinder System (QTPFS) or -1 - disabled.

float pathFinderUpdateRate  default: 0.007 New in version 98.0

Controls how often the pathfinder updates; larger values means more rapid updates.

float pathFinderRawDistMult  default: 1.25 New in version 105.+ BAR

Engine does raw move with a limited distance, this multiplier adjusts that

bool allowTake  default: true New in version 103.0

Enables and disables the /take UI command.

transportability

bool transportAir  default: false 

Can aircraft be transported?

bool transportShip  default: false 

Can ships be transported?

bool transportHover  default: false 

Can hovercraft be transported?

bool transportGround  default: true 

Can ground units be transported?

bool targetableTransportedUnits  default: false New in version 89.0

Can transported units be targeted by weapons? true allows both manual and automatic targeting.


Examples

Empty

modrules.lua can simply return an empty table like this:

return {}

If you do this, Spring will use the default values.

Configurable by modoptions

Interestingly modrules.lua can read modoptions, so these parameters can be scripted to be configurable from the lobby. For example to allow selecting either legacy default pathfinder or QTPFS via a modoption:

  system = {
    pathFinderSystem = (Spring.GetModOptions() and (Spring.GetModOptions().qtpfs == "1") and 1) or 0,
  },

External Examples

'Evolution RTS' Modrules.lua