Mapdev%3Amapinfo.lua - beyond-all-reason/springrts_engine_wiki_mirror GitHub Wiki
mapinfo.lua Reference
This file is the primary configuration file for maps, list many things including resources, attributes, ad properties.
Source
The engine source code which reads this file from the map is viewable here:
Example
Can be found in the map blueprint
File Location
relative to the root directory of the map
- ./mapinfo.lua
Formatting
check Lua Documentation for syntax etc.
In this wiki page, variables are organised as such:
Data Types
Sections
mapinfo
local mapinfo = {
name = "MyMap",
shortname = "",
description = "",
author = "",
version = "1.0",
--mutator = "deployment";
mapfile = "maps/mymap.smf", -- // location of smf/sm3 file
modtype = 3, --// 1=primary, 0=hidden, 3=map
depend = {"Map Helper v1"},
replace = {},
--startpic = "", --// deprecated
--StartMusic = "", --// deprecated
maphardness = 100,
notDeformable = false,
gravity = 130,
tidalStrength = 0,
maxMetal = 0.02,
extractorRadius = 500.0,
voidWater = false,
voidGround = false,
autoShowMetal = true,
smf = {
...
},
sound = {
...
},
resources = {
...
},
splats = {
...
},
atmosphere = {
...
},
grass = {
...
},
lighting = {
...
},
water = {
...
},
teams = {
...
},
terrainTypes = {
...
},
custom = {
...
},
}
. Additionally for this to work, the mapinfo.water.planeColor
variable
must not be specified in the mapinfo.lua file, delete or comment it out
if it exists.
.
.
smf
local mapinfo = {
...
smf = {
minHeight = 1000,
maxHeight = -300,
minimapTex = "",
smtFileName0 = "",
smtFileName1 = "",
smtFileName.. = "",
smtFileNameN = "",
},
...
}
sound
local mapinfo = {
...
sound = {
preset = "default",
passfilter = {
...
},
reverb = {
...
},
},
...
}
passfilter
Note, you likely want to set these tags due to the fact that they are not set by `preset`! So if you want to create a muffled sound you need to use them.
local mapinfo = {
...
sound = {
...
passfilter = {
gainlf = 1.0,
gainhf = 1.0,
},
...
},
...
}
reverb
Normally you just want use the `preset` tag but you can use handtweak a preset if wanted with the following tags. To know their function & ranges check the official OpenAL1.1 SDK document.
local mapinfo = {
...
sound = {
...
reverb = {
--density
--diffusion
--gain
--gainhf
--gainlf
--decaytime
--decayhflimit
--decayhfratio
--decaylfratio
--reflectionsgain
--reflectionsdelay
--reflectionspan
--latereverbgain
--latereverbdelay
--latereverbpan
--echotime
--echodepth
--modtime
--moddepth
--airabsorptiongainhf
--hfreference
--lfreference
--roomrollofffactor
},
},
...
}
resources
local mapinfo = {
...
resources = {
grassBladeTex = "",
grassShadingTex = "",
detailTex = "",
specularTex = "",
splatDetailTex = "",
splatDistrTex = "",
skyReflectModTex = "",
detailNormalTex = "",
lightEmissionTex = "",
parallaxHeightTex = "",
},
...
}
splats
local mapinfo = {
...
splats = {
texScales = {0.02, 0.02, 0.02, 0.02},
texMults = {1.0, 1.0, 1.0, 1.0},
},
...
}
atmosphere
local mapinfo = {
...
atmosphere = {
minWind = 5.0,
maxWind = 25.0,
fogStart = 0.1,
fogEnd = 1.0,
fogColor = {0.7, 0.7, 0.8},
sunColor = {1.0, 1.0, 1.0},
skyColor = {0.1, 0.15, 0.7},
skyDir = {0.0, 0.0, -1.0},
skyBox = "",
cloudDensity = 0.5,
cloudColor = {1.0, 1.0, 1.0},
},
...
}
}
grass
The shader for grass color at https://github.com/spring/spring/blob/266b51ad4c0301103e269a13f8e72f9c26511b4e/cont/base/springcontent/shaders/GLSL/GrassFragProg.glsl#L48 samples grassBladeTex, and multiplies it with grassShadingTex (which defaults to minimap)
local mapinfo = {
...
grass = {
bladeWaveScale = 1.0,
bladeWidth = 0.32,
bladeHeight = 4.0,
bladeAngle = 1.57,
bladeColor = {0.59, 0.81, 0.57},
maxStrawsPerTurf = 150,
},
...
}
Lighting
local mapinfo = {
...
lighting = {
--// dynsun
sunStartAngle = 0.0,
sunOrbitTime = 1440.0,
sunDir = {0.0, 1.0, 2.0, 1e9},
--// unit & ground lighting
groundAmbientColor = {0.5, 0.5, 0.5},
groundDiffuseColor = {0.5, 0.5, 0.5},
groundSpecularColor = {0.1, 0.1, 0.1},
groundShadowDensity = 0.8,
unitAmbientColor = {0.4, 0.4, 0.4},
unitDiffuseColor = {0.7, 0.7, 0.7},
unitSpecularColor = {0.7, 0.7, 0.7},
unitShadowDensity = 0.8,
specularExponent = 100.0,
},
...
}
water
local mapinfo = {
...
water = {
damage = 0.0,
repeatX = 0.0,
repeatY = 0.0,
absorb = {0.0, 0.0, 0.0},
baseColor = {0.0, 0.0, 0.0},
minColor = {0.0, 0.0, 0.0},
ambientFactor = 1.0,
diffuseFactor = 1.0,
specularFactor = 1.0,
specularPower = 20.0,
planeColor = {0.0, 0.4, 0.0},
surfaceColor = {0.75, 0.8, 0.85},
surfaceAlpha = 0.55,
diffuseColor = {1.0, 1.0, 1.0},
specularColor = {0.5, 0.5, 0.5},
fresnelMin = 0.2,
fresnelMax = 0.8,
fresnelPower = 4.0,
reflectionDistortion = 1.0,
blurBase = 2.0,
blurExponent = 1.5,
perlinStartFreq = 8.0,
perlinLacunarity = 3.0,
perlinAmplitude = 0.9,
windSpeed = 1.0, --// does nothing yet
shoreWaves = true,
forceRendering = false,
--// undefined == load them from resources.lua!
--texture = "",
--foamTexture = "",
--normalTexture = "",
--caustics = {
-- "",
-- "",
--},
},
...
}
will have to ask about those undefined tags
teams
local mapinfo = {
...
teams = {
[0] = {startPos = {x = 2033, z = 852}},
[1] = {startPos = {x = 10134, z = 852}},
[2] = {startPos = {x = 0, z = 0}},
[3] = {startPos = {x = 0, z = 0}},
...
},
...
}
Holds an array of start positions
terrainTypes
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] = {
...
},
...
},
...
}
Holds an array of start types where each element contains:
custom
local mapinfo = {
...
custom = {
fog = {
color = {0.26, 0.30, 0.41},
height = "80%", --// allows either absolue sizes or in percent of map's MaxHeight
fogatten = 0.003,
},
precipitation = {
density = 30000,
size = 1.5,
speed = 50,
windscale = 1.2,
texture = 'LuaGaia/effects/snowflake.png',
},
},
...
}