edit: It is basically exactly the same code etc as the mapconv from the spring trunk about version 0.69???
The image code has been changed, currently only BMP files are supported. edit: Raw heightmaps same as original mapconv.
The exe takes a filename of a lua script, which is basically just a table that contains all the info that used to be fed in the command line of mapconv. I use lua to create the SMD file from this table as well.
To try it out on the command line: mapc.exe mapname.map
For now I have put windows and linux builds (and source code) here:
http://code.google.com/p/mapc/
Here are the contents of an example map file.
Code: Select all
--[[
An example Spring map description file.
--]]
Map = {
id = 878212, -- a unique number that identifies the map
name = "chasmofchaos1",
description = [[Chasm of Chaos Version 1]],
max_height = 400,
min_height = 100,
metal_map = "metalmap.bmp",
height_map = "heightmap.bmp",
invert = true, -- normally true when height map is a BMP
compress = 0.7,
lowpass = true,
type_map = "",
feature_map = "",
texture_map = "texture.bmp",
smd = {
MAP = {
Description="A lot of metal in the chasm, but beware the chaos",
TidalString=20,
Gravity=130,
MaxMetal=1.0,
ExtractorRadius=100,
MapHardness=100,
ATMOSPHERE = {
FogColour="0.7 0.7 0.8",
FogStart=0.2,
CloudColor="0.9 0.9 0.9",
SkyColor="0.1 0.15 0.7",
SunColor="1.0 1.0 1.0",
CloudDensity="0.55",
MinWind=5,
MaxWind=20
},
WATER = {
WaterBaseColor="0.4 0.6 0.8", --color at water surface
WaterAbsorb="0.004 0.004 0.002", --how fast different colors are absorbed by the water
WaterMinColor="0.1 0.1 0.3", --the min value the water colors will go down to
WaterPlaneColor="0.1 0.1 0.3"
},
LIGHT = {
SunDir="0 1 2", -- direction of sun (spring will normalize it later)(y component is upward)
GroundAmbientColor="0.4 0.4 0.4", -- ambient (non sun lit) color of ground (and grass trees etc)
GroundSunColor="0.7 0.7 0.7", -- color of ground where fully sun lit (added to ambient)
GroundShadowDensity="0.8", -- how far from the non shadowed to the ambient color stuff in shadow will go
UnitAmbientColor="0.3 0.3 0.3", -- ambient (non sun lit) color of units (and wreckage etc)
UnitSunColor="0.8 0.8 0.8", -- color of units where fully sun lit (added to ambient)
UnitShadowDensity="0.8" -- how far from the non shadowed to the ambient color stuff in shadow will go
},
TERRAINTYPE0 = { -- which terrain type goes where on the map is determined by the typemap
name="default", -- human visible identifier of the terrain type
hardness=1, -- multiplier of the global maphardness value (default value=1)
tankmovespeed=1, -- multiplier of tank units speed after slope mods etc has been applied (default value=1)
kbotmovespeed=1, -- multiplier of kbot units speed after slope mods etc has been applied (default value=1)
hovermovespeed=1, -- multiplier of hover units speed after slope mods etc has been applied (default value=1)
shipmovespeed=1 --multiplier of ship units speed after slope mods etc has been applied (default value=1)
},
TEAM0 = {
StartPosX=128,
StartPosZ=512
},
TEAM1 = {
StartPosX=256,
StartPosZ=512
},
TEAM2 = {
StartPosX=384,
StartPosZ=512
},
TEAM3 = {
StartPosX=3968,
StartPosZ=512
},
TEAM4 = {
StartPosX=3840,
StartPosZ=512
},
TEAM5 = {
StartPosX=3712,
StartPosZ=512
}
}
}
}
if Map.smd then
dofile("smd.lua")
write_smd(Map)
end
If anyone can try compiling some maps with this compiler and let me know how they turn out, that would be great. All you have to do is change the value of height_map, texture_map, metal_map.
The advantage of these mapconv changes are:
- * libsquish is open source, and is builtin so there is no cost of executing an external process. I cannot find the source code for nvdxt.exe
* using lua allows putting in hooks and including other lua files to do some customized processing before writing the SMF and SMT. Also it is easy to serialize the SMD from a lua table.