Tutorial:CreateMaps(Fnordia et al): Difference between revisions

From Spring
Jump to navigationJump to search
No edit summary
mNo edit summary
Line 221: Line 221:


We can only hope this has been helpful! Any questions, or things you think we have missed, please ask us in the maps section.
We can only hope this has been helpful! Any questions, or things you think we have missed, please ask us in the maps section.
[[Category:Maps]]

Revision as of 05:21, 6 September 2005

Original by aGorm, with help from LathanStanley


The Idea

First of all you need an idea. There is no point (OK, there is some point for test purposes) in making a map just like another one that already exists. You need to think of certain things before you make your map.

  1. Is this map idea different, not just a copy of someone else's?
  2. Does my map idea give each player a fair share of the cover and high ground?
  3. Is my map idea possible to make?
  4. Is it possible with the amount of time I'm willing to spend?

If you answered yes to the above, then you are 25% of the way towards making your map!

You should probably doodle it on a piece of paper to act as a guide later.

The Tools

With your idea hopefully sketched out, it's time to get the tools to make the map! (You can skip this if you already have them.)

For all your map compiling needs you should first download the newest MapConv program.

You will also need some image editing software. Favorites are Photoshop, the GIMP, And Paintshop Pro. The GIMP, however, is the only one that's free! (I'm going to have to assume you know how to use the program you choose. If you can't there are loads of tutorials on the net.)

You may also want to check out Terragen for generating terrain. But as you have to pay to render anything of a good size, I won't mention it other than here. Another tool for generating terrain is the freeware tool TerrTexGen. "It generates a terraintexture on the base of a grayscale heightmap und uses five surfacetextures that are distributed over the heightmap."

Preparing your map

This is the fun part! And also, often, the longest part.

For a map you will need several different things:

  1. a texture map
  2. a height map
  3. a metal map

They all have certain needs! Read this bit carfully!

Texture Map

All maps are based on a texture image. This image's width and height must be an exact multiple of 1024 pixels. So, for instance, you can have a "4096 by 8192" image, but not a "4096 by 4608" image, as 4608 does not divide by 1024. It, like all three maps, must be saved as a 24 bit BMP.

It may look like whatever you want! Find a texture (preferably, one that you can tile seamlessly) and fill your texture map with it. You could, for instance, fill the whole image with a sand texture. This would make your whole world look like sand. You could then decide to add a few patches of grass to it by finding a suitable grass texture and adding it on in patches. So you'd have a map that was mostly sand with a few patches of green.

Height Map

Next is the height map. This must be exactly one eighth (1/8) of the size of the texture map + 1 pixel! For instance, if the dimensions of your texture map are "4096 by 8192", divide 4096 and 8192 each by 8 and add one to the result of each. The result for this example would be "513 by 1025". The height map is a black and white BMP. Only use black and white, no colour! (well its better to work it as a greyscale image, and when saving to process, convert to rgb and save as bmp, that way you get a 24 bit bmp)

White areas are the tops of mountains; black areas are the sea floor or the bottom of valleys. The shades of grey between are the different heights between! When you draw your heightmap, make sure the white blends into the black with greys. I suggest you use the blur tool. If you have a white splodge in a patch of black you will have a very tall pillar that won't look natural at all!

Metal Map

Finally, you need a metal map. This is the same size as the height map, one eighth (1/8) of the size of the texture map + 1 pixel. On this one you paint down red (in verying degrees) to represent metal. So a red spot that is RGB(50,0,0) will provide about a 5th of the metal patch of red RGB(255,0,0) will give.

On this map you can also place green pixels. Each green pixel will create 1 geothermal vent. If you put down a green splodge you will get a cluster of geo vents! Only place 1 pixel.

Ensure you have all three saved as 24 bit BMPs and you're ready to convert it all to a map!

MapConv.exe

Instuctions pulled from the newest MapConv program.

USAGE:

  mapconv  [-l] [-i] [-c <compression>] -x <max height> -n <min height> [-o 
  <Output file>] [-e <tile file>] [-y <Typemap file>] -m <Metalmap file> -a 
  <Heightmap file> -t <Texture file> [--] [-v] [-h]


Where:

  -l,  --lowpass
    Lowpass filters the heightmap
  -i,  --invert
    Inverts the height map vertically (not the height values but the height map 
    (uhm someone rewrite this))
  -c <compression>,  --compress <compression>
    (value required)  How much we should try to compress the texture file. 
    Default value 0.8 . (lower=higher quality, larger file)
  -x <max height>,  --maxheight <max height>
    (required)  (value required)  What altitude in spring the max(0xffff) level 
    of the height map should represent
  -n <min height>,  --minheight <min height>
    (required)  (value required)  What altitude in spring the min(0) level of 
    the height map should represent
  -o <Output file>,  --outfile <Output file>
    (value required)  The name of the created map
  -e <tile file>,  --externaltilefile <tile file>
    (value required)  External tile file that will be used for finding tiles, 
    tiles not found in this will be added in a new tile file
  -y <Typemap file>,  --typemap <Typemap file>
    (value required)  Type map to use, uses the red channel to decide type, 
    types are defined in the .smd, if this argument is skipped the map will be 
    all type 0
  -m <Metalmap file>,  --metalmap <Metalmap file>
    (required)  (value required)  Metal map to use, red channel is amount of 
    metal, green=255 is where to place geos (one pixel=one geo). Is resized to 
    fit the mapsize
  -a <Heightmap file>,  --heightmap <Heightmap file>
    (required)  (value required)  Input heightmap to use for the map, this 
    should be in 16 bit raw format (.raw extension) or an image file. Must be 
    xsize*128+1 x ysize*128+1 in size.
  -t <Texture file>,  --intex <Texture file>
    (required)  (value required)  Input bitmap to use for the map. Must be 
    xsize*1024 x ysize*1024 in size. (xsize,ysize integers determined from this 
    file)
  --,  --ignore_rest
    Ignores the rest of the labeled arguments following this flag.
  -v,  --version
    Displays version information and exits.
  -h,  --help
    Displays usage information and exits.


  Convers a series of bmp/raw files to a spring map. This just creates the .smf 
  file, you will also have to create a .smd file using a text editor

Sharp Map (THIS NO LONGER WORKS USE MAPCONV^^)

Here's a easy run down of what to do:

First (you guessed it), open Sharp Map. This brings you a window with several fields that need filling, a few option boxes and two sliders. Fill in the top fields as required. (Click browse, locate the texture map, and click OK. Repeat for the height map and metal map.)

Type in a figure for MAX HEIGHT and MIN HEIGHT. The MAX HEIGHT should not exceed 500. Higher numbers can cause errors. If your minimum height is a negative number then you will have water on your map. Sea level is, naturally enough, at 0. To the right of these boxes is a grey level calculator. This will tell you aproximatly the level of grey on your height map that is under water and above water. The grey is described by it's RGB values.

Then adjust the tree and grass sliders. If you have a green map then I suggest you lower the tree slider, otherwise the map will be covered!

(Edit:) Example Usage:

The starting locations of the sliders are approximetly 75% trees and 80% grass. On a green portion of any map with any hue (>200 green <75 red <75 blue) it will end up completely full of trees on the default settings, reducing the sliders to around 20% (which is still kind of dense) or less will make the green areas much more playable, and still have a good quantity of trees in the deep green parts. However, you will lose almost all your trees in brown/green areas and areas without any green. It would seem the most suitable, for a green map, to be green everywhere, except for cliffsides, rocky patches, water, sand, and mud, if you want the trees to look pretty. Another idea would be to have the dirt brown, and have very thick green splotches of grass (30x30 pixels) where you want a few trees to be. (Edit by: LathanStanley)

Finally, you need to decide if you need to tick the inverse height map box or not. If you drew the height map by hand so that if you overlayed your height map over the texture the hills would line up with the hills, etc. then you will need to tick the box. This is because the image is read backwards, so its expecting the image to be upside-down. Ticking the check box makes it flip the image the way it wants it before conversion. If you exported your texture and height maps from Terragen, then you do not need to tick this box, as Terragen exports it upside-down already. If you were crazy and drew it upside-down, then you don't need to tick it either.

When you have completed all this click Create Map! This can take some time for a larger map, so start off with a small one.

An Error message similar to this one:

"System.IO.FileNotFoundException: Could not find file "C:\Program Files\TASpring\convert\strips\mini.dds".

This means that there is a space character (as in "C:\Program Files\") in the path to the files used by Sharpmap. Put all the files in a path that doesn't contain a space character like "C:\map1set3\". If that doesn't work, contact Buggi or post it in the forum: somebody will always help.

Making your map work

This is the final push. Once Sharp map has finshed it will spit out a .sm2 file. This needs to be copyed to the MAPS folder in Spring. But you still need one more thing: an .smd file. Basically, this file tells the game things like the maximum metal, the light colours, the clouds, etc. (All the bits you were thinking that you hadn't done yet!)

I would suggest you copy the .smd of another map and fiddle with the settings until you get what you want. smd's can be opened in notepade or similar. Look at all the .smd's so you can get a jist of what each option does. Make sure both the .sm2 and .smd have the same file name then start up Spring (not the client!) in single-player mode and run the commanders script. Choose your map and away you go!

SMD Rundown

What follows is all that we (aGorm and LathanStanley) have figured out in the SMD's. Its by no means the be all and end all, but it's the next best thing.

General Map Information

  • Description is just a short description of your map. Keep it simple.
  • TidalStrength determines how much energy tidal generators will produce. A normal figure is around 20.
  • Gravity, as you would expect, affects ballisitcs and how far units fly after an explosion.
  • MaxMetal is the maximum amount of metal you will gain from one game square in 1 second from an area of metal that had a red value of 255 in your metal map. If making an old style metal deposit map, then this will be quite high: maybe 2 or 3. If you are making a new style metal-all-over-the-place-map, then it will be low: perhaps 0.2. Also for old style maps, you'll have to fiddle with the...
  • ExtractorRadius, which is the area that is harvested by 1 metal extractor. For old style maps make this very small, so as they only take from one deposit.

Atmosphere, Water Colours

Each value (it would appear this bit is by no means gospel) is a representation of the RGB values for that parameter. It would appear to be relative, i.e. you can put in what ever numbers you like and the game will work out what you want. The best way to go about it is to look at it as percentages. The numbers 1, 0.5, 0.2 refer to 100% red, 50% green and 20% blue. But 2, 1, 0.4, will get the same result. Using numbers below one for all the numbers will result in the colour being less bright.

This is all a bit confusing so an example will be given:

SkyColor=0.2 0.1 0.5;

In this example the sky is coloured with 20% red, 10% green, and 50% blue, approximatly RGB(51,25,127), resulting in a very deep night-time blue. Other colours are added to the initial sky colour. If you set your sun as being a pale yellow and it came out rather green, this is why.

One helpful tip is negative colour. That's right: you can type in a negative number for a colour and it will remove it from the base sky colour. Just be careful not to go below the original values or you may get a surprise.

The Sun System/Shadow System

The Sun System/Shadow System is quite a useful tool as well in making your maps look well done. Within the .smd file there is a line:

"SunDir=-1 1 -.5; //direction of sun" (The part of the "//" is a comment.)

The numbers "-1", "1", ".5" determine the angle and elevation of the sunlight system.

The first number is the X angle (East/West) (from -1 to 1) where any negative number means the sun is on the West (and therefore shadows will be cast east), and any positive number means the sun is on the East (and therefore shadows will be cast west), and if the number is 0 there are no east or west shadows, the sun is directly above you.

The second is its elevation, (0 to 1), this number is how far from the horizion the sun is, ignoring it's angle. Thus, 1 puts the sun directly overhead (while still casting angular shadows) and 0 putting it directly on the horizion.

The final number is the Z angle (North/South). (I know, I know, they wrote the engine with Y as elevation and Z as vertical. Don't blame me.) It is just like the East West positioning, where negative numbers put them on the North, and positive numbers put them on the South.

Example Usage: If you want the shadows in one of the boxes (your shadow casting surface is in the middle), use the numbers provided, or start from them and tweak the angle and sun height as seen fit.

                           N
     ----------------------------------------------
     |  ( 1 .5 -1)  |  ( 0 .5 -1)  |  (-1 .5 -1)  |
     ----------------------------------------------
  W  |  ( 1 .5  0)  |  ( 0  1  0)  |  (-1 .5  0)  |  E
     ----------------------------------------------
     |  ( 1 .5  1)  |  ( 0 .5  1)  |  (-1 .5  1)  |
     ----------------------------------------------
                           S

Note: on the current build, it will cast the shadows in the proper direction, etc. Negative direction numbers tend to make some maps unstable and cause crashes. The best solution would be to rotate or flip your map to where the shadows point up or right (North or West). I do believe these bugs are being worked on and will be fixed soon.

We can only hope this has been helpful! Any questions, or things you think we have missed, please ask us in the maps section.