Modrules.lua: Difference between revisions
→movement: - add `allowAircraftToHitGround` tag (3199) |
Template:Xtaglink |
||
| Line 16: | Line 16: | ||
|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 | {{tag | ||
| Line 23: | Line 24: | ||
|default = true | |default = true | ||
|special = {{new|90.0}} | |special = {{new|90.0}} | ||
|description = Are aircraft allowed to hit the ground whilst manoeuvring?}} | |description = Are aircraft allowed to hit the ground whilst manoeuvring? | ||
}} | |||
{{tag | {{tag | ||
| Line 30: | Line 32: | ||
|default = false | |default = false | ||
|special = {{new|83.0}} | |special = {{new|83.0}} | ||
|description = Can enemy ground units push each other during collisions?}} | |description = Can enemy ground units push each other during collisions? | ||
}} | |||
{{tag | {{tag | ||
| Line 37: | Line 40: | ||
|default = false | |default = false | ||
|special = {{new|85.0}} | |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]].}} | |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 | ||
| Line 44: | Line 48: | ||
|default = false | |default = false | ||
|special = {{new|85.0}} | |special = {{new|85.0}} | ||
|description = Do unit-unit (skidding) collisions cause damage?}} | |description = Do unit-unit (skidding) collisions cause damage? | ||
}} | |||
{{tag | {{tag | ||
| Line 51: | Line 56: | ||
|default = true | |default = true | ||
|special = {{new|89.0}} | |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'.}} | |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'. | ||
}} | |||
{{tag | {{tag | ||
| Line 58: | Line 64: | ||
|default = false | |default = false | ||
|special = {{new|89.0}} | |special = {{new|89.0}} | ||
|description = A ticket back to unit movement circa 2009: no reversing, no | |description = A ticket back to unit movement circa 2009: no reversing, no {{xtaglink|Units-UnitDefs|turninplace|false}}, no smooth collision handling, no nothing. For comparison of pathfinding code. | ||
}} | |||
===nanospray=== | ===nanospray=== | ||
| Line 65: | Line 72: | ||
|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]].}} | |description = Are players allowed to use teamcolour nanospray? Set by the <code>TeamNanoSpray</code> key in the [[Springrc|config file]]. | ||
}} | |||
===construction=== | ===construction=== | ||
| Line 72: | Line 80: | ||
|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 78: | Line 87: | ||
|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 84: | Line 94: | ||
|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 | |description = How fast build progress decays for abandoned building frames. Note that the rate is inversely proportional to the {{xtaglink|Units-UnitDefs|buildtime}} i.e. a building with a larger {{xtaglink|Units-UnitDefs|buildtime}} will decay more slowly for a given value of this tag than a building with a shorter {{xtaglink|Units-UnitDefs|buildtime}}. | ||
}} | |||
===reclaim=== | ===reclaim=== | ||
| Line 91: | Line 102: | ||
|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 97: | Line 109: | ||
|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 103: | Line 116: | ||
|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 109: | Line 123: | ||
|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' | |description = How much energy should reclaiming a feature cost? Multiplier against the fraction of the features' {{xtaglink|Units-FeatureDefs|metal}} content reclaimed. | ||
}} | |||
{{tag | {{tag | ||
| Line 115: | Line 130: | ||
|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 | |description = How much energy should reclaiming a unit cost? Multiplier against the fraction of the unit's {{xtaglink|Units-UnitDefs|buildCostEnergy}} reclaimed. | ||
}} | |||
{{tag | {{tag | ||
| Line 121: | Line 137: | ||
|type = float | |type = float | ||
|default = 1.0 | |default = 1.0 | ||
|description = How much metal should reclaiming a unit return? Multiplier against the unit's | |description = How much metal should reclaiming a unit return? Multiplier against the unit's {{xtaglink|Units-UnitDefs|buildCostMetal}}. | ||
}} | |||
{{tag | {{tag | ||
| Line 127: | Line 144: | ||
|type = bool | |type = bool | ||
|default = true | |default = true | ||
|description = Can enemy units be reclaimed?}} | |description = Can enemy units be reclaimed? | ||
}} | |||
{{tag | {{tag | ||
| Line 133: | Line 151: | ||
|type = bool | |type = bool | ||
|default = true | |default = true | ||
|description = Can allied units be reclaimed?}} | |description = Can allied units be reclaimed? | ||
}} | |||
===repair=== | ===repair=== | ||
| Line 140: | Line 159: | ||
|type = float | |type = float | ||
|default = 0.0 | |default = 0.0 | ||
|description = How much of the original energy cost it requires to repair something.}} | |description = How much of the original energy cost it requires to repair something. | ||
}} | |||
===resurrect=== | ===resurrect=== | ||
| Line 147: | Line 167: | ||
|type = float | |type = float | ||
|default = 0.5 | |default = 0.5 | ||
|description = How much of the original energy cost it requires to resurrect something.}} | |description = How much of the original energy cost it requires to resurrect something. | ||
}} | |||
===capture=== | ===capture=== | ||
| Line 154: | Line 175: | ||
|type = float | |type = float | ||
|default = 0.0 | |default = 0.0 | ||
|description = How much of the original energy cost it requires to capture something.}} | |description = How much of the original energy cost it requires to capture something. | ||
}} | |||
===paralyze=== | ===paralyze=== | ||
| Line 161: | Line 183: | ||
|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 = Are units paralyzed when the level of emp is greater than their current health or their maximum health? | ||
}} | |||
===fireAtDead=== | ===fireAtDead=== | ||
| Line 168: | Line 191: | ||
|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 174: | Line 198: | ||
|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]]) | ||
}} | |||
===transportability=== | ===transportability=== | ||
| Line 181: | Line 206: | ||
|type = bool | |type = bool | ||
|default = false | |default = false | ||
|description = Can aircraft be transported?}} | |description = Can aircraft be transported? | ||
}} | |||
{{tag | {{tag | ||
| Line 187: | Line 213: | ||
|type = bool | |type = bool | ||
|default = false | |default = false | ||
|description = Can ships be transported?}} | |description = Can ships be transported? | ||
}} | |||
{{tag | {{tag | ||
| Line 193: | Line 220: | ||
|type = bool | |type = bool | ||
|default = false | |default = false | ||
|description = Can hovercraft be transported?}} | |description = Can hovercraft be transported? | ||
}} | |||
{{tag | {{tag | ||
| Line 199: | Line 227: | ||
|type = bool | |type = bool | ||
|default = true | |default = true | ||
|description = Can ground units be transported?}} | |description = Can ground units be transported? | ||
}} | |||
{{tag | {{tag | ||
| Line 206: | Line 235: | ||
|default = false | |default = false | ||
|special = {{new|89.0}} | |special = {{new|89.0}} | ||
|description = Can transported units be targeted by weapons? <code>true</code> allows both manual and automatic targeting.}} | |description = Can transported units be targeted by weapons? <code>true</code> allows both manual and automatic targeting. | ||
}} | |||
===experience=== | ===experience=== | ||
| Line 216: | Line 246: | ||
::<code>xp for damage = 0.1 * experienceMult * damage / target_HP * target_power / attacker_power</code> | ::<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>. | ::<code>xp for kill = 0.1 * experienceMult * target_power / attacker_power</code>. | ||
: Where | : Where {{xtaglink|Units-UnitDefs|power}} can be set by the UnitDef tag. | ||
}} | |||
{{tag | {{tag | ||
| Line 222: | Line 253: | ||
|type = float | |type = float | ||
|default = 1.0 | |default = 1.0 | ||
|description = Controls how gaining experience changes the relative | |description = Controls how gaining experience changes the relative {{xtaglink|Units-UnitDefs|power}} of the unit. The formula used is <code>Power multiplier = powerScale * (1 + xp / (xp + 1))</code>. | ||
}} | |||
{{tag | {{tag | ||
| Line 228: | Line 260: | ||
|type = float | |type = float | ||
|default = 0.7 | |default = 0.7 | ||
|description = Controls how gaining experience increases the | |description = Controls how gaining experience increases the {{xtaglink|Units-UnitDefs|maxDamage}} (total hitpoints) of the unit. The formula used is <code>Health multiplier = healthScale * (1 + xp / (xp + 1))</code>. | ||
}} | |||
{{tag | {{tag | ||
| Line 234: | Line 267: | ||
|type = float | |type = float | ||
|default = 0.4 | |default = 0.4 | ||
|description = Controls how gaining experience decreases the | |description = Controls how gaining experience decreases the {{xtaglink|Units-UnitDefs|reloadTime}} of the unit's weapons. The formula used is <code>Rate of fire multiplier = reloadScale * (1 + xp / (xp + 1))</code>. | ||
}} | |||
===flankingBonus=== | ===flankingBonus=== | ||
| Line 243: | Line 277: | ||
|type = int | |type = int | ||
|default = 1 | |default = 1 | ||
|description = The default | |description = The default {{xtaglink|Units-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. | ||
}} | |||
===featureLOS=== | ===featureLOS=== | ||
| Line 250: | Line 285: | ||
|type = int | |type = int | ||
|default = 3 | |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.}} | |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=== | ===sensors=== | ||
| Line 257: | Line 293: | ||
|type = bool | |type = bool | ||
|default = true | |default = true | ||
|description = If <code>true</code> then when underwater, units only get LOS if they also have sonar.}} | |description = If <code>true</code> then when underwater, units only get LOS if they also have sonar. | ||
}} | |||
====los==== | ====los==== | ||
| Line 264: | Line 301: | ||
|type = int | |type = int | ||
|default = 1 | |default = 1 | ||
|description = Controls the resolution of the LOS calculations. A higher | |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 | {{tag | ||
| Line 270: | Line 308: | ||
|type = float | |type = float | ||
|default = 1.0 | |default = 1.0 | ||
|description = Multiplies all unit's | |description = Multiplies all unit's {{xtaglink|Units-UnitDefs|sightDistance}} by this value. Generally speaking you should always use the default. | ||
}} | |||
{{tag | {{tag | ||
| Line 276: | Line 315: | ||
|type = int | |type = int | ||
|default = 2 | |default = 2 | ||
|description = Controls the resolution of the LOS vs. aircraft calculations. A higher | |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. | ||
}} | |||
{{tag | {{tag | ||
| Line 282: | Line 322: | ||
|type = float | |type = float | ||
|default = 1.0 | |default = 1.0 | ||
|description = Multiplies all unit's | |description = Multiplies all unit's {{xtaglink|Units-UnitDefs|airSightDistance}} by this value. Generally speaking you should always use the default. | ||
}} | |||
===system=== | ===system=== | ||
Revision as of 18:56, 27 October 2012
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:rts/Sim/Misc/ModInfo.cpp
Details
Modrules.lua is divided into several sub-tables containing tags specific to each section, as follows:
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
crushableparameter 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 useClassicGroundMoveType default: false New in version 89.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.
nanospray
bool allow_team_colors default: true
- Are players allowed to use teamcolour nanospray? Set by the
TeamNanoSpraykey in the config file.
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.
reclaim
int multiReclaim default: 0
- Can multiple units reclaim a feature or only one?
0implies 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 valuen- reclaim innchunks.
int unitMethod default: 1
- Controls how units are reclaimed. Can be
0- gradual reclaim,1- all reclaimed at end, any other positive valuen- reclaim innchunks.
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.
capture
float energyCostFactor default: 0.0
- How much of the original energy cost it requires to capture something.
paralyze
bool paralyzeOnMaxHealth default: true
- Are units paralyzed when the level of emp is greater than their current health or their maximum health?
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)
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?
trueallows both manual and automatic targeting.
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_powerxp 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)).
flankingBonus
For a deeper explanation of the flanking system, see Units:FlankingBonus.
int defaultMode default: 1
- The default flankingBonusMode for units. Can be
0- No flanking bonus. Mode1builds up the ability to move over time, and swings to face attacks, but does not respect the way the unit is facing. Mode2also can swing, but moves with the unit as it turns. Mode3stays with the unit as it turns and otherwise doesn't move, the ideal mode to simulate something such as tank armour.
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, or3- all features always visible.
sensors
bool requireSonarUnderWater default: true
- If
truethen when underwater, units only get LOS if they also have sonar.
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
0and6inclusive.
float losMul default: 1.0
- Multiplies all unit's sightDistance by this value. Generally speaking you should always use the default.
int airMipLevel default: 2
- 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
0and30inclusive.
float airLosMul default: 1.0
- Multiplies all unit's airSightDistance by this value. Generally speaking you should always use the default.
system
int luaThreadingModel default: 2
- Controls which Lua MT optimizations the mod will use by default, for a more detailed explanation see here. Can be:
0- No MT, single threaded;1- Single state;2- Single state, batching of unsynced events;3- Dual states for synced, batching of unsynced events, synced/unsynced communication via EXPORT table and SendToUnsynced;4- Dual states for synced, batching of unsynced events, synced/unsynced communication via SendToUnsynced only;5- Dual states for all, all synced/unsynced communication (widgets included) via SendToUnsynced only;6- Dual states for all, all synced/unsynced communication (widgets included) is unmanaged and via SendToUnsynced only.
int pathFinderSystem default: 0 New in version 85.0
- Which pathfinder does the game use? Can be
0- The legacy default pathfinder or1- Quad-Tree Pathfinder System (QTPFS).
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
'Balanced Annihilation' Modrules.lua