Mapdev:terraintype

From Spring
Revision as of 07:14, 31 December 2012 by Enetheru (talk | contribs) (created page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Terrain Types

Type Maps or terrain Types allow altering the speed of units, and the mount of deformation.

(FIXME: Example typemap)
Example Typemap
Caution
The use of type maps for unit speed adjustment is discouraged; due to the way units are automatically assigned to categories and the invisible nature of the type map it makes game play unpredictable.

Spring already provides speed alteration, with pathing optimisation based on terrain incline. Units will always take the "road" if its completely flat and have to travel a fair distance along otherwise uneven terrain.

Type maps use in deformation can show distinction between terrains like sand, rock, etc. This will suffer from edges between hardness levels having different heights after deformation, however it can be somewhat mitigated by making transitional typemaps with multiple hardness levels.

Use sparingly, with obvious visual indicators in the texture image.

Specification

mapinfo.lua

The relevant sections of the mapinfo.lua file are in the terrainTypes subtable

local mapinfo = {
   ...
   terrainTypes = {
      [0] = {
         name = "Default",
         hardness = 1.0,
         receiveTracks = true,
         moveSpeeds = {
            tank  = 1.0,
            kbot  = 1.0,
            hover = 1.0,
            ship  = 1.0,
         },
      },
      [1]  = { 
         ...
      },
      ...
   },
   ...
}

Image File

An 8bpp greyscale image has 256 values for grey. each value represents a different terrain type, so you can have 256 different terrains, starting at zero(black)(default) to 255(white)

  • 8 bpp Greyscale
  • This image is an intermediary file compiled into the SMF file using MapConv or MapConvNG
Spring Map Size* pixels = Spring Map Size * 64 + 1
2 129
4 257
6 385
... ...
32 2049
* must be multiples of 2

Forum Discussions