Creating a map using blueprint

From Spring
Jump to navigationJump to search
172px-Symbol comment vote.svg.png Deletion! This page is marked for deletion! If you think it does not belong deleted, please remove this template, and state your reasoning in the edit summary, or on the talk page.


172px-Symbol comment vote.svg.png this page is deprecated, use Map_development instead


What you will need to get started (The Tools)

Blueprint: https://github.com/jk3064/Map-Blueprint 

The only other tool really needed is "Mapconv". The other tools available are there simply to make your life easier. A list of common mapping tools are as follows:

Mapconv

SMFED (Deprecated, no longer useful)

Grout (Deprecated, no longer useful unless texture was generated with L3dt utilizing tiles)

SMD Creator (Deprecated, no longer useful)

Start Position Editor

Das Bruce's Mapconv frontend

These tools have been compiled into a zip available here: http://springfiles.com/spring/tools/mapping-tools

Keep in mind that mapconv is still being developed, so it may be necessary to update the included Mapconv to a later version, located here: http://springrts.com/phpbb/viewtopic.php?f=56&t=21458

Creating a Texture Map

Texture map size is related in pixels and in spring map size. 2x2 MapSquares in spring are equal to 1024x1024 Pixels. Texture maps mus be in multiples of 2. I.E. 2x2, 6x10, 12x16, 16x16, etc. No odd sizes are allowed (Example: 15x10).

This tutorial assumes that you understand how to make a texture map and it also assumes that you know how to use terrain generation software. 

Commonly used terrain generation programs are:

Spring Map Edit (Does not work on 64bit machines)

L3DT

WorldMachine

Bryce3D

Carrara


Example Texture Map (generated by Carrara):

exampletexturemap.jpg

Creating a Heightmap

Height Maps are Texture Map size / 8 + 1 pixel. In other words, if your texture map is 8192x8192 (16x16), 8192 / 8 + 1 = 1025x1025

You will need a good image editing program to make heightmaps. Many of the aforementioned terrain generation programs will also generate heightmaps as well, but you can draw them by hand. They can be either 8bit or 16bit greyscale PNG. If you have photoshop or the gimp, you can use these programs to help you create your heightmap.


Here is an example of a 16bit heightmap:

heightmapexample.png

Heightmaps work upon the idea of height according to color values. Black is the lowest, white is the heighest. In spring mapping, the waterline is defined by a negative height value. In other words, you define the heights of the map,  anything below 0 is under water. So on this heightmap, you might use -50 for the lowest value and 300 for the highest height value. The aforementioned tool "Mapconv Gui (a.k.a Das Bruce's MapConv Gui) has a waterline calculator that will help you calculate the correct waterline for your map.

Creating a Metal Map

Metal Map dimensions are Texture Map size / 8 + 1 pixel. In other words, if your texture map is 8192x8192 (16x16), 8192 / 8 + 1 = 1025x1025

In Spring, metal maps are used for the built in resourcing scheme (Metal/Energy). You do not have to use this scheme. In fact, there are several games for Spring who use their own resourcing systems added on using Lua. If you are creating this map for one of those games, a metal map is not strictly necessary (in other words you can just us a black image), however, it is always nice if you can make your maps as compatible with other games as possible, but this is a choice left entirely up to you.

Metalmaps show metal areas on a map based upon the amount of red on the image (make sure red is the only color used!). On this map you can see that the "Patch Technique" is used, which is pretty common among spring maps, but you are not limited to using this scheme.

If you do want perfect metal patches, use a 6x6 pixel pencil in your image editor with a red value of 255. This combined with setting the "MaxMetal" tag in the definitions to 1, will result in a perfect 2.0 metal generation per patch (using Balanaced Annihilation values). The game use isn't the point however. The fact is that if you can predict how much each spot will output (typically), using the "MaxMetal" parameter, you can easily scale the values up and down. As an example of another extreme, Evolution RTS dictates that all metal patches will output 0.5 metal regardless of the map settings. So whether you need to put a lot of thought into your metal map values depends entirely upon the game for which you are creating the map.


Example Metal Map:

examplemetal.jpg

Creating a Feature Map

Feature Map dimensions are Texture Map size / 8. In other words, if your texture map is 8192x8192 (16x16), 8192 / 8 = 1024x1024

Feature maps used to be quite complicated, but all that changed with the advent of Smoth's FeaturePlacer (short featuremap history below).

Now featuremaps are use simply for the purpose of placing grass. Grass coverage is defined by blue pixels on the feature map. The more blue the pixel is (the closer to blue 255 it is), the thicker grass will be at that location. Grass is entirely optional, but can be customized via map parameters and adds a nice touch to your map.


Example Feature Map:

examplefeature.jpg

A brief history of featuremaps

Feature maps were (and still are) a single RGB image where features such as grass, geothermal vents and trees, as well as structures, etc were "placed" using pixels on the image. This method was extremely imprecise and involved recompiling the map many times in order to simply move a tree from one location to another.

Thankfully, features can now be placed via LUA, ingame and in realtime using FeaturePlacer.

Compiling your map

Texture Specifications

Texture map size is related in pixels and in spring map size. 2x2 MapSquares in spring are equal to 1024x1024 Pixels. Texture maps must be in multiples of 2. I.E. 2x2, 6x10, 12x16, 16x16, etc. No odd sizes are allowed (Example: 15x10).


Height Map dimensions are Texture Map size / 8 + 1 pixel. In other words, if your texture map is 8192x8192 (16x16), 8192 / 8 + 1 = 1025x1025


Metal Map dimensions are Texture Map size / 8 + 1 pixel. In other words, if your texture map is 8192x8192 (16x16), 8192 / 8 + 1 = 1025x1025


Feature Map dimensions are Texture Map size / 8. In other words, if your texture map is 8192x8192 (16x16), 8192 / 8 = 1024x1024

Using MapConv

MapConv is a command line program that is generally started via a batch file .

Below is an example set of parameters given to mapconv:

MapConv -i -l -c 0 -x 101 -n 100 -o EvoRTS-Craggy_Creek-v01.smf -t terrain.png -a height6.png -m metal.png -f feature.png -z "nvdxt.exe -dxt1a -nmips 4 -Sinc -quality_highest -file"

Once compiled, you will get 2 new files: <mapname.smt> and <mapname.smf>

Incorporating your map into Blueprint

Unzip the blueprint archive into your Spring Maps folder.

mapcontainer.jpg

You will notice a new folder called "mapcontainer.sdd". The .sdd ending on the folder name is very important for testing as <foldername>.sdd tells spring to load map files from that folder. This way you can work on your maps without having to zip them up over and over again.

mapcontainer.sdd

Inside the map container folder you have the following file/folder structure.


LuaGaia
mapconfig
maphelper
maps
mapinfo.lua
mapoptions.lua

Now, copy your compiled map files into the "maps" folder.

Adding SSMF details

SSMF mapping is adding detail textures all over the map based upon specified distribution areas. This will make your map infinitely more detailed and beautiful.

Adding SSMF to a map consists of the following steps:

Distribution Map

Splat Textures

Specular Maps

Grass Shading Map (optional)

Distribution Map

The Distribution map is essentially an atlas telling spring where to spread your detail textures. Lets have a look at an example distribution map:

examplesplatdistribution.jpg

Each channel corresponds to a different texture referenced in the detail texture map. These areas are set using the channels of the image and are generally saved using the Targa format ( .tga ), sized at 1024x1024.

examplechannels.jpg

Save your distribution map as splatdistribution.tga, and place it in the maps folder alongside the smf and smt files.

Once you have your distribution map, you need to set up your detail textures

Detail Textures

Detail textures are made by adding a texture to each channel of an image.

examplesplattex.jpg

There are a total of 4 texture slots available. One for R, G, B, and one for the Alpha Channel. When you have your detail textures ready, save the file as splattex.tga (Targa - 1024x1024) and place it in the maps folder alongside splatdistribution.tga

Specular Map

A specular map controls brightness and "shinyness" of your map. The more light you add to a particular portion of your specular map, the brighter and more reflective that portion of the map will be. Specular maps should be 1024x1024 and saved as specularmap.bmp. Of course placed in the maps folder with the other ssmf maps.

examplespecularmap.jpg

Grass Shading Map (Optional)

A grass shading map will allow you to control the overall intensity of the grass on your map

[This portion needs expanding and an example image]

Placing Features

As previously mentioned, features can now be placed via LUA based upon a coordinate system that looks similar to this:

local features = { 
unitlist = {
},
buildinglist = {
},
objectlist = {
{ name = 'btreeclo_4', x = 7760, z = 112, rot = "0" },
{ name = 'btreea_3', x = 2520, z = 6904, rot = "0" },
{ name = 'btreeblo_5', x = 7736, z = 536, rot = "0" },
{ name = 'btreeclo_1', x = 2504, z = 7112, rot = "0" },
{ name = 'geovent', x = 177, z = 192, rot = "0" },
},
}
return features

Of course, features can be placed by editing the set.lua file in a text editor, but that would take an extremely long time. Enter FeaturePlacer.

FeaturePlacer

At this point, it is very strongly recommended that you go download "Spring Features" ( http://springfiles.com/spring/tools/spring-features ) and place it in your games folder. Spring features is an archive that contains all the map features ever made for spring mapping. The total number is somewhere around 500 features, so it will give you quite a bit of power when it comes time to spice up your map.


Feature placer is available for use in two different games currently. Gundam RTS and Evolution RTS. It is worth noting that Gundam RTS limits itself to a much smaller feature set, so that the current time it is recommended that you use feature placer in Evolution RTS. It should also be mentioned that you could simply call Spring Features as a dependency (which you will do anyway) in your map which will allow you access to all the features in Spring Features, however, Evolution RTS has some random spawners specifically targeting towards foliage in Spring Features that is not currently in Gundam RTS.


Eventually, Feature Placer will be it's own independent module, but currently, it is only available via Evolution RTS or Gundam RTS.


If you use Evolution RTS for feature placer, once ingame be sure to disable the "Integral Menu" widget (f11 - Widget Menu), as the menu does not support paging.


You will need to go into the multiplayer lobby (one that supports modoptions and hosing your own games). Create a new game (not using a relay slave). In the modoptions set the game type to "Featureplacer" and add a NullAI.


When the game starts up you will be presented with a tree that is sparkling green. Select it and you will have the option to build an entire host of features. There are also placement options on the menu such as "Jitter" and "Clustering", etc. Set these as desired.


Once you have placed all the features on your map and are ready to export the placement, press F11 to bring up the widget menu, and select "Dump All Units Features". Click it 3 times. At this point, before exiting the game, alt+tab out to your spring install folder and look for a file called dumpedunitsfeatures.txt to make sure that the file was written properly. Once you have verified this, you may go ahead and close the game.


Open dumpedunitsfeatures.txt in a text editor and copy the entire contents. Then navigate to

mapcontainer.sdd/mapconfig/set.lua

Open up set.lua in a text editor, and paste the contents of dumpedunitsfeatures.txt into it. Be sure to remove any entries in the unitlist or buildinglist sections.

Configuring Map Parameters (Mapinfo.lua)

Admittedly, the default values used in blueprint mapinfo are awful. It may be wise for you to download another map that has used blueprint and copy and paste it's mapinfo contents into yours. However, you are also free to use the default or use the provided example.

In time, the mapinfo tags will be documented and this will like to that page. As it is the tags and values are pretty easy to figure out for the most part.


--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- mapinfo.lua
--

local mapinfo = {
name        = "EvoRTS - Craggy Creek -",
shortname   = "",
description = "",
author      = "",
version     = "v08",
--mutator   = "deployment";
--mapfile   = "", --// location of smf/sm3 file (optional)
modtype     = 3, --// 1=primary, 0=hidden, 3=map
depend      = {"Map Helper v1", "Spring Features 1.0"},
replace     = {},

--startpic   = "", --// deprecated
--StartMusic = "", --// deprecated

maphardness     = 800,
notDeformable   = false,
gravity         = 130,
tidalStrength   = 0,
maxMetal        = 1,
extractorRadius = 150,
voidWater       = false,
autoShowMetal   = true,


smf = {
minheight = -100,
maxheight = 900,
--smtFileName0 = "",
--smtFileName1 = "",
--smtFileName.. = "",
--smtFileNameN = "",
},

sound = {
--// Sets the _reverb_ preset (= echo parameters),
--// passfilter (the direct sound) is unchanged.
--//
--// To get a list of all possible presets check:
--//
--// Hint:
--// You can change the preset at runtime via:
--//   /tset UseEFX [1|0]
--//   /tset snd_eaxpreset preset_name   (may change to a real cmd in the future)
--//   /tset snd_filter %gainlf %gainhf  (may    "   "  "  "    "  "   "    "   )
preset = "default",

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.
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.
--density
--diffusion
--gain
--gainhf
--gainlf
--decaytime
--decayhflimit
--decayhfratio
--decaylfratio
--reflectionsgain
--reflectionsdelay
--reflectionspan
--latereverbgain
--latereverbdelay
--latereverbpan
--echotime
--echodepth
--modtime
--moddepth
--airabsorptiongainhf
--hfreference
--lfreference
--roomrollofffactor
},
},

resources = {
grassBladeTex    = "grassbladetex.bmp",
--grassShadingTex  = "grassshading.bmp",
--detailTex = "",
specularTex = "specularmap.bmp",
splatDetailTex = "splattex.tga",
splatDistrTex = "splatdistribution.tga",
--skyReflectModTex = "",
--detailNormalTex = "detailtex.bmp",
--lightEmissionTex = "",
},

splats = {
TexScales={ 0.006, 0.006, 0.006, 0.0005 },
TexMults={ 0.3, 0.3, 0.2, 0.1 },
},

atmosphere = {
minWind      = 1.0,
maxWind      = 30.0,

fogStart     = 0.7,
fogEnd       = 1.0,
fogColor     = {0.8, 1, 1},

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 = {
bladeWaveScale = 1.0,
bladeWidth  = 0.5,
bladeHeight = 6.0,
bladeAngle  = 1.57,
bladeColor  = {0.59, 0.81, 0.57}, --// does nothing when `grassBladeTex` is set
},

lighting = {
--// dynsun
sunStartAngle = 0.0,
sunOrbitTime  = 1440.0,
sundir        = { 0, 0.50, -1 },

--// unit & ground lighting
         groundambientcolor            = { 0.8, 0.8, 0.85 },
         grounddiffusecolor            = { 1.0, 0.9, 0.8 },
         groundshadowdensity           = 1.3,
         unitambientcolor           = { 0.5, 0.5, 0.5 },
         unitdiffusecolor           = { 1.0, 0.9, 0.8 },
         unitshadowdensity          = 0.8,
specularsuncolor           = { 0.6, 0.7, 0.9 },
specularExponent    = 100.0,
},
water = {
damage =  0.0,

repeatX = 0.0,
repeatY = 0.0,

absorb    = { 0.05, 0.05, 0.05 },
basecolor = { 0.5, 1, 0.5 },
mincolor  = { 0.1, 0.1, 0.10 },

ambientFactor  = 1.0,
diffuseFactor  = 1.0,
specularFactor = 1.0,
specularPower  = 20.0,

planeColor = {0.0, 0.5, 0.0},

surfacecolor  = { 0.5, 0.9, 0.5 },
surfaceAlpha  = 0.1,
diffuseColor  = {1.0, 1.0, 1.0},
specularColor = {0.8, 0.7, 0.65},

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 = {
--"",
--"",
--},
},

teams = {
[0] = {startPos = {x = 7779, z = 2147}},
[1] = {startPos = {x = 353, z = 1982}},
},

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

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',
},
},
}

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Helper

local function lowerkeys(ta)
local fix = {}
for i,v in pairs(ta) do
if (type(i) == "string") then
if (i ~= i:lower()) then
fix[#fix+1] = i
end
end
if (type(v) == "table") then
lowerkeys(v)
end
end
for i=1,#fix do
local idx = fix[i]
ta[idx:lower()] = ta[idx]
ta[idx] = nil
end
end

lowerkeys(mapinfo)

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Map Options

do
local function tmerge(t1, t2)
for i,v in pairs(t2) do
if (type(v) == "table") then
t1[i] = t1[i] or {}
tmerge(t1[i], v)
else
t1[i] = v
end
end
end

getfenv()["mapinfo"] = mapinfo
local files = VFS.DirList("mapconfig/mapinfo/", "*.lua")
table.sort(files)
for i=1,#files do
local newcfg = VFS.Include(files[i])
if newcfg then
lowerkeys(newcfg)
tmerge(mapinfo, newcfg)
end
end
getfenv()["mapinfo"] = nil
end

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

return mapinfo

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------

Creating an archive of your map

Spring reads two different archive formats, 7zip and zip. Both archives are named sd7 and sdz, respectively. 7zip files are made by The 7zip archive program, available at http://www.7-zip.org/

Navigate to your mapcontainer.sdd folder and zip it's contents into either a .7z file or .zip (7zip format is HIGHLY RECOMMENDED!), usually naming schemes follow the actual mapname (<mapname.sd7>, such as EvoRTS-Craggy_Creek-v08.sd7

examplearchivewith7zip.jpg

Once completed, copy the sd7/sdz file to your maps folder. At this point, be sure to remove the .sdd ending from your mapcontainer.sdd folder (or change the map name/version contained withing), otherwise you might get sync errors because spring is reading from the wrong archive source.


br/>