Movedefs.lua: Difference between revisions

From Spring
Jump to navigationJump to search
Flozi (talk | contribs)
→What is a movetype?: add link to source
Smoth (talk | contribs)
No edit summary
Line 28: Line 28:
=== tank&kbot only tags ===
=== tank&kbot only tags ===
*DepthMod
*DepthMod
** how much to slow down amphibian speed when they're underwater
** how much a slope will slow a unit, 0 means no slowdown
 


=== ship only tags ===
=== ship only tags ===
Line 45: Line 46:
** default feature: mass = metal * 0.4 + maxHealth * 0.1
** default feature: mass = metal * 0.4 + maxHealth * 0.1
** default unit: mass = metalCost
** default unit: mass = metalCost
* Slope/Depth mod
** This value applies directly based on the slope/depth, meaning the deeper or higher the slope, the MORE it slows a unit down.


==How slope is determined.==
==How slope is determined.==

Revision as of 20:30, 31 January 2012

What is a movetype?

Spring uses base movetypes to determine pathing for units.

What classes of movetypes do exist?

  • Bot
  • Tank
  • Ship
  • Hover

Source

The engine source code which loads the tags from this file is viewable here: rts/Sim/MoveTypes/MoveInfo.cpp

Known Tags

  • Name
  • FootprintX
  • FootprintZ (ignored in pre0.83 releases!)
  • CrushStrength
    • power of unit to crush features
  • SlopeMod
    • how much a slope will slow a unit, 0 means no slowdown
  • MaxSlope

Heat tags(used in unit avoidance)

  • HeatMapping
  • HeatMod
  • HeatProduced

tank&kbot only tags

  • DepthMod
    • how much a slope will slow a unit, 0 means no slowdown


ship only tags

  • MinWaterDepth
  • MaxWaterDepth
  • SubMarine

Special notes

  • Hover movetypes require "HOVER" in the name to work
  • Ship movetypes require "SHIP" or "BOAT" in the name to work
  • Tank movetypes require "TANK" in the name to work
  • KBot movetype is default
  • depth is measured in elmos
  • Slope is not measured in degrees.
  • CrushStrength uses mass to determine if a feature can be crushed by a unit.
    • default feature: mass = metal * 0.4 + maxHealth * 0.1
    • default unit: mass = metalCost
  • Slope/Depth mod
    • This value applies directly based on the slope/depth, meaning the deeper or higher the slope, the MORE it slows a unit down.

How slope is determined.

Spring doesn't represent terrain slopes in degrees, internally it uses (1.0 - the terrain normal's y-component) so the slope of vertical faces is 1 and that of horizontal ones 0. A unit's maxSlope value (which is in degrees in its movedef) is converted so that the "can we go here?" (ie "maxSlope > terrainSlope?") comparisons are meaningful, the formula is 1.0 - cos(DEG2RAD(maxSlope * 1.5)). If you want to know the terrain angle in degrees, compute RAD2DEG(arccos(1.0 - terrainSlope)). For a kbot with a maxSlope of 36 degrees (~0.41221 in "Spring format"), the maximum tolerable terrain angle is approximately

RAD2DEG(arccos(1.0 - 0.41221))

or 54 degrees. If maxSlope was 30, the MTTA would be 45, and if it was 60 (the highest sensible value due to that 1.5 scalar and the absence of overhanging cliffs) the kbot could mount any terrain. In other words you do not need the long mathematical derivation, just remember that maxTerrainAngle = maxSlope * 1.5 -kloot, Thu Jul 31, 2008