Modrules.lua: Difference between revisions

From Spring
Jump to navigationJump to search
Flozi (talk | contribs)
 
(47 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:
===capture===
{{tag
|name = energyCostFactor
|type = float
|default = 0.0
|description = How much of the original energy cost it requires to capture something.
}}
===construction===
{{tag
|name = constructionDecay
|type = bool
|default = true
|description = Do uncompleted building frames begin to decay if no builder is working on them?
}}
{{tag
|name = constructionDecayTime
|type = float
|default = 6.66
|description = The time in seconds before abandoned building frames begin to decay.
}}
{{tag
|name = constructionDecaySpeed
|type = float
|default = 0.03
|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}}.
}}
===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.
}}
{{tag
|name = powerScale
|type = float
|default = 1.0
|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>.
}}
{{tag
|name = healthScale
|type = float
|default = 0.7
|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>.
}}
{{tag
|name = reloadScale
|type = float
|default = 0.4
|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>.
}}
===featureLOS===
{{tag
|name = featureVisibility
|type = int
|default = 3
|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===
{{tag
|name = fireAtKilled
|type = bool
|default = false
|description = Will units continue to target and fire on enemies which are running their <code>Killed()</code> animation? (See [[Animation-LuaCallins#Generic]])
}}
{{tag
|name = fireAtCrashing
|type = bool
|default = false
|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===
===movement===
Line 16: Line 159:
|type = bool
|type = bool
|default = true
|default = true
|description = Are (gunship) aircraft allowed to fly outside the bounds of the map?}}
|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?
}}


{{tag
{{tag
|name = allowPushingEnemyUnits
|name = allowPushingEnemyUnits
|type = bool
|type = bool
|default = false </code>{{new|83.0}}<code>
|default = false
|description = Can enemy ground units push each other during collisions?}}
|special = {{new|83.0}}
|description = Can enemy ground units push each other during collisions?
}}


{{tag
{{tag
|name = allowCrushingAlliedUnits
|name = allowCrushingAlliedUnits
|type = bool
|type = bool
|default = false </code>{{new|85.0}}<code>
|default = false
|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]].}}
|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 = allowUnitCollisionDamage
|name = allowUnitCollisionDamage
|type = bool
|type = bool
|default = false </code>{{new|85.0}}<code>
|default = false
|description = Do unit-unit (skidding) collisions cause damage?}}
|special = {{new|85.0}}
|description = Do unit-unit (skidding) collisions cause damage?
}}


===nanospray===
{{tag
{{tag
|name = allow_team_colors
|name = allowUnitCollisionOverlap
|type = bool
|type = bool
|default = true
|default = true
|description = Are players allowed to use teamcolour nanospray? Set by the <code>TeamNanoSpray</code> key in the [[Springrc|config file]].}}
|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'.
}}


===construction===
{{tag
{{tag
|name = constructionDecay
|name = allowGroundUnitGravity
|type = bool
|type = bool
|default = true
|default = true
|description = Do uncompleted building frames begin to decay if no builder is working on them?}}
|special = {{new|92.0}}
|description = Allows fast moving mobile units to 'catch air' as they move over terrain.
}}
 
{{tag
|name = allowHoverUnitStrafing
|type = bool
|default = true if using QTPFS pathfinder
|special = {{new|92.0}}
|description = Allows hovercraft units to slide in turns.
}}


{{tag
{{tag
|name = constructionDecayTime
|name = useClassicGroundMoveType
|type = float
|type = bool
|default = 6.66
|default = false
|description = The time in seconds before abandoned building frames begin to decay.}}
|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.
}}


===paralyze===
{{tag
{{tag
|name = constructionDecaySpeed
|name = paralyzeOnMaxHealth
|type = float
|type = bool
|default = 0.03
|default = true
|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 = Are units paralyzed when the level of emp is greater than their current health or their maximum health?
}}
 


===reclaim===
===reclaim===
Line 67: Line 240:
|type = int
|type = int
|default = 0
|default = 0
|description = Can multiple units reclaim a feature or only one? <code>0</code> implies the latter, all other values the former.}}
|description = Can multiple units reclaim a feature or only one? <code>0</code> implies the latter, all other values the former.
}}


{{tag
{{tag
Line 73: Line 247:
|type = int
|type = int
|default = 1
|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.}}
|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.
}}


{{tag
{{tag
Line 79: Line 254:
|type = int
|type = int
|default = 1
|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.}}
|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.
}}


{{tag
{{tag
Line 85: Line 261:
|type = float
|type = float
|default = 0.0
|default = 0.0
|description = How much energy should reclaiming a feature cost? Multiplier against the fraction of the features' ''<code>metal</code>'' content reclaimed. (See [[Units-FeatureDefs#Reclaim_&_Resources]])}}
|description = How much energy should reclaiming a feature cost? Multiplier against the fraction of the features' {{xtaglink|Gamedev:FeatureDefs|metal}} content reclaimed.
}}


{{tag
{{tag
Line 91: Line 268:
|type = float
|type = float
|default = 0.0
|default = 0.0
|description = How much energy should reclaiming a unit cost? Multiplier against the fraction of the unit's <code>buildCostEnergy</code> reclaimed. (See [[Units-UnitDefs#General]])}}
|description = How much energy should reclaiming a unit cost? Multiplier against the fraction of the unit's {{xtaglink|Gamedev:UnitDefs|buildCostEnergy}} reclaimed.  
}}


{{tag
{{tag
Line 97: Line 275:
|type = float
|type = float
|default = 1.0
|default = 1.0
|description = How much metal should reclaiming a unit return? Multiplier against the unit's <code>buildCostMetal</code>. (See [[Units-UnitDefs#General]])}}
|description = How much metal should reclaiming a unit return? Multiplier against the unit's {{xtaglink|Gamedev:UnitDefs|buildCostMetal}}.
}}


{{tag
{{tag
Line 103: Line 282:
|type = bool
|type = bool
|default = true
|default = true
|description = Can enemy units be reclaimed?}}
|description = Can enemy units be reclaimed?
}}


{{tag
{{tag
Line 109: Line 289:
|type = bool
|type = bool
|default = true
|default = true
|description = Can allied units be reclaimed?}}
|description = Can allied units be reclaimed?
}}
 


===repair===
===repair===
Line 116: Line 298:
|type = float
|type = float
|default = 0.0
|default = 0.0
|description = How much of the original cost it requires to repair something.}}
|description = How much of the original energy cost it requires to repair something.
}}
 


===resurrect===
===resurrect===
Line 123: Line 307:
|type = float
|type = float
|default = 0.5
|default = 0.5
|description = How much of the original cost it requires to resurrect something.}}
|description = How much of the original energy cost it requires to resurrect something.
}}


===capture===
{{tag
|name = energyCostFactor
|type = float
|default = 0.0
|description = How much of the original cost it requires to capture something.}}


===paralyze===
===sensors===
{{tag
{{tag
|name = paralyzeOnMaxHealth
|name = requireSonarUnderWater
|type = bool
|type = bool
|default = true
|default = true
|description = Are units paralyzed when the level of emp is greater than their current health or their maximum health?}}
|description = If <code>true</code> then when underwater, units only get LOS if they also have sonar.
 
}}
===fireAtDead===
{{tag
{{tag
|name = fireAtKilled
|name = alwaysVisibleOverridesCloaked
|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]])}}
|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
{{tag
|name = fireAtCrashing
|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.
 
{{tag
|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}}
 
{{tag
|name = allowTake
|type = bool
|type = bool
|default = false
|default = true
|description = Will units continue to target and fire on enemy aircraft which are in the 'crashing' state? (See [[Lua_SyncedCtrl#Unit_Control]])}}
|special = {{new|103.0}}
|description = Enables and disables the {{var|/take}} [[UI_commands|UI command]].}}


===transportability===
===transportability===
Line 157: Line 367:
|type = bool
|type = bool
|default = false
|default = false
|description = Can aircraft be transported?}}
|description = Can aircraft be transported?
}}


{{tag
{{tag
Line 163: Line 374:
|type = bool
|type = bool
|default = false
|default = false
|description = Can ships be transported?}}
|description = Can ships be transported?
}}


{{tag
{{tag
Line 169: Line 381:
|type = bool
|type = bool
|default = false
|default = false
|description = Can hovercraft be transported?}}
|description = Can hovercraft be transported?
}}


{{tag
{{tag
Line 175: Line 388:
|type = bool
|type = bool
|default = true
|default = true
|description = Can ground units be transported?}}
|description = Can ground units be transported?
 
}}
===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 gain for damaging a unit = 0.1 * experienceMult * damage / target's HP * target's power / attacker's power</code> and <code>XP gain for killing a unit = 0.1 * experienceMult * target's power / attacker's power</code>. Where <code>power</code> can be set by the UnitDef tag (See [[Units-UnitDefs#Other]]).}}
 
{{tag
|name = powerScale
|type = float
|default = 1.0
|description = Controls how gaining experience changes the relative <code>power</code> of the unit (See [[Units-UnitDefs#Other]]). The formula used is <code>Power multiplier = powerScale * (1 + xp / (xp + 1))</code>.}}
 
{{tag
|name = healthScale
|type = float
|default = 0.7
|description = Controls how gaining experience increases the <code>maxDamage</code> (total hitpoints) of the unit (See [[Units-UnitDefs#General]]). The formula used is <code>Health multiplier = healthScale * (1 + xp / (xp + 1))</code>.}}
 
{{tag
|name = reloadScale
|type = float
|default = 0.4
|description = Controls how gaining experience decreases the <code>reloadTime</code> of the unit's weapons (See [[Units-WeaponDefs]]). The formula used is <code>Rate of fire multiplier = reloadScale * (1 + xp / (xp + 1))</code>.}}
 
===flankingBonus===
For a deeper explanation of the flanking system, see [[Units:FlankingBonus]].


{{tag
{{tag
|name = defaultMode
|name = targetableTransportedUnits
|type = int
|default = 1
|description = The default <code>flankingBonusMode</code> 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. (See also [[Units-UnitDefs#Flanking]])}}
 
===featureLOS===
{{tag
|name = featureVisibility
|type = int
|default = 3
|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.}}
 
===sensors===
{{tag
|name = requireSonarUnderWater
|type = bool
|type = bool
|default = true
|default = false
|description = If <code>true</code> then when underwater, units only get LOS if they also have sonar.}}
|special = {{new|89.0}}
|description = Can transported units be targeted by weapons? <code>true</code> allows both manual and automatic targeting.
}}


====los====
{{tag
|name = losMipLevel
|type = int
|default = 1
|description = Controls the resolution of the LOS calculations. A higher <code>losMipLevel</code> 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
|description = Multiplies all unit's <code>sightDistance</code> (See [[Units-UnitDefs#Sensors]]) by this value. Generally speaking you should always use the default.}}
{{tag
|name = airMipLevel
|type = int
|default = 2
|description = Controls the resolution of the LOS vs. aircraft calculations. A higher <code>airMipLevel</code> 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.}}
{{tag
|name = airLosMul
|type = float
|default = 1.0
|description = Multiplies all unit's <code>airSightDistance</code> (See [[Units-UnitDefs#Sensors]]) by this value. Generally speaking you should always use the default.}}
===system===
{{tag
|name = luaThreadingModel
|type = int
|default = 2
|description = Controls which Lua MT optimizations the mod will use by default. Can be:
::<code>0</code> - No MT, single threaded;
::<code>1</code> - Single state;
::<code>2</code> - Single state, batching of unsynced events;
::<code>3</code> - Dual states for synced, batching of unsynced events, synced/unsynced communication via EXPORT table and SendToUnsynced;
::<code>4</code> - Dual states for synced, batching of unsynced events, synced/unsynced communication via SendToUnsynced only;
::<code>5</code> - Dual states for all, all synced/unsynced communication (widgets included) via SendToUnsynced only;
::<code>6</code> - Dual states for all, all synced/unsynced communication (widgets included) is unmanaged and via SendToUnsynced only.}}
{{tag
|name = pathFinderSystem
|type = int
|default = 0 </code>{{new|85.0}}<code>
|description = Which pathfinder does the game use? Can be <code>0</code> - The legacy default pathfinder or <code>1</code> - Quad-Tree Pathfinder System ([[QTPFS]]).}}


==Examples==
==Examples==
Line 274: Line 404:
===Empty===
===Empty===


modrules.lua can simply return an empty table like this:
<code>modrules.lua</code> can simply return an empty table like this:
<code><pre>
<pre>
return {}
return {}
</pre></code>
</pre>
if you do this, Spring will use the default values.
If you do this, Spring will use the default values.
 
===Configurable by modoptions===
Interestingly <code>modrules.lua</code> can read [[Modoptions.lua|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:
<pre>
  system = {
    pathFinderSystem = (Spring.GetModOptions() and (Spring.GetModOptions().qtpfs == "1") and 1) or 0,
  },
</pre>


===External Examples===
===External Examples===
[http://imolarpg.dyndns.org/trac/balatest/browser/trunk/gamedata/modrules.lua 'Balanced Annihilation' Modrules.lua]
[https://github.com/EvolutionRTS/Evolution-RTS/blob/master/Gamedata/modrules.lua 'Evolution RTS' Modrules.lua]
 
[http://trac.caspring.org/browser/trunk/mods/ca/gamedata/modrules.lua 'Complete Annihilation' Modrules.lua]
 
[http://code.google.com/p/conflictterra/source/browse/games/CT/gamedata/modrules.lua 'Conflict Terra' Modrules.lua]
 
[https://code.google.com/p/evolutionrts/source/browse/trunk/evolutiondev.sdd/Gamedata/modrules.lua 'Evolution RTS' Modrules.lua]
 
[http://spring1944.svn.sourceforge.net/viewvc/spring1944/trunk/S44Main.sdd/gamedata/modrules.lua?&view=markup 'Spring: 1944' Modrules.lua]
 
[http://code.google.com/p/zero-k/source/browse/trunk/mods/zk/gamedata/modrules.lua 'ZeroK' 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