Mapdev:terraintype: Difference between revisions

From Spring
Jump to navigationJump to search
created page
 
m →Image File: added overrides
 
(6 intermediate revisions by 2 users not shown)
Line 8: Line 8:
|}
|}
</center>
</center>
{{infobox|title=Caution|color=rgba(255,0,0,0.1)|icon-size=48
{{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.}}
|body=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.
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.
Line 23: Line 22:
<code><pre>local mapinfo = {
<code><pre>local mapinfo = {
   ...
   ...
  smf = {
        ....
        typemapTex = "",
        ....
    },
    ...
   terrainTypes = {
   terrainTypes = {
       [0] = {
       [0] = {
Line 45: Line 50:
== Image File ==
== 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)
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
{| class="wikitable" width="100%"
* This image is an intermediary file compiled into the SMF file using [[MapConv]] or [[MapConvNG]]
! width="15%" | File Location
<center>
| The metal map is an intermediary file compiled into the SMF file using [[MapConv]] or [[MapConvNG]], it can also be specified in the mapinfo.lua
|-
! File Format
| Any that the Mapconv programs support
|-
! Colour Depth
| 8bpp
|-
! Channels
| Greyscale
|-
! Resolution
| <center>
{| class="wikitable" style="text-align: center;"
{| class="wikitable" style="text-align: center;"
!Spring Map Size<sup>*</sup>
!Spring Map Size<sup>*</sup>
!pixels = Spring Map Size * 64 + 1
!pixels = Spring Map Size * 32
|-
|-
| 2
| 2
| 129
| 64
|-
|-
| 4
| 4
| 257
| 128
|-
|-
| 6
| 6
| 385
| 192
|-
|-
| ...
| ...
Line 65: Line 82:
|-
|-
| 32
| 32
| 2049
| 1024
|-
|-
| colspan="2" | ''&#42; must be multiples of 2''
| style="text-align: left;font-style:italic" colspan=2 | &#42; must be multiples of 2
|}</center>
|}</center>
|}


= Forum Discussions =
= Forum Discussions =
* [http://springrts.com/phpbb/viewtopic.php?f=13&t=21669 Typemap rant thread.]
* [http://springrts.com/phpbb/viewtopic.php?f=13&t=21669 Typemap rant thread.]


[[Category:Development]]
[[Category:Map Dev]]
[[Category:Mapdev]]

Latest revision as of 05:05, 19 April 2015

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 = {
   ...
   smf = {
        ....
        typemapTex = "",
        ....
    },
    ...
   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)

File Location The metal map is an intermediary file compiled into the SMF file using MapConv or MapConvNG, it can also be specified in the mapinfo.lua
File Format Any that the Mapconv programs support
Colour Depth 8bpp
Channels Greyscale
Resolution
Spring Map Size* pixels = Spring Map Size * 32
2 64
4 128
6 192
... ...
32 1024
* must be multiples of 2

Forum Discussions