Mapdev:Tutorial Simple: Difference between revisions

From Spring
Jump to navigationJump to search
m →Download example: cleaned slightly.
m incoorperating feedback from review.
Line 6: Line 6:
* [http://www.7-zip.org/ 7zip]
* [http://www.7-zip.org/ 7zip]
* [[MapConvNG]]
* [[MapConvNG]]
* a copy of the [https://github.com/jk3064/Map-Blueprint/archive/master.zip map blueprint]
* a copy of the map blueprint [https://github.com/jk3064/Map-Blueprint/archive/master.zip archive]


There are a multitude of other tools you can use to make maps, however for the purposes of this beginners tutorial, these are the only ones you will need. Check the [[Mapdev:Main#Tools|tools]] section for more information.
There are a multitude of other tools you can use to make maps, however for the purposes of this beginners tutorial, these are the only ones you will need. Check the [[Mapdev:Main#Tools|tools]] section for more information.
Line 37: Line 37:


= Create Height map =
= Create Height map =
For this tutorial we will be creating a 4x4 size map, which is relatively small.
For this tutorial we will be creating a 4x4 size map, which is relatively small. Typically maps will be 8x8 (for a 1v1) or larger, but entirely depends on the game you are targeting.
<ol>
<ol>
<li>Check the [[Mapdev:height|height]] page to get our image dimensions. In our case a 4x4 map yields a image resolution of 257x257 pixels
<li>Check the [[Mapdev:height|height]] page to get our image dimensions. In our case a 4x4 map yields a image resolution of 257x257 pixels
<li>Create a 257x257 greyscale image
<li>Create a 257x257 greyscale image using your image editor
<li>Draw the terrain</li>
<li>Draw the terrain</li>
<li>Save the image to your working directory, call it heightmap.png
<li>Save the image to your working directory, call it heightmap.png
Line 56: Line 56:
<ol>
<ol>
<li>Open the mapinfo.lua file in a text editor
<li>Open the mapinfo.lua file in a text editor
<li>Change the <code>minHeight</code> and <code>maxHeight</code> variables to <code>10</code> and <code>512</code> respectively
<li>Change the <code>minHeight</code> and <code>maxHeight</code> variables to <code>10</code> and <code>512</code> respectively<br>
: The resulting portion of code should appear like this:
These values control the overall height of the terrain, and will be unique to your map. After loading up the map in game you may want to revisit and tweak these values to get the best result.<br>
The resulting portion of code should appear like this:
<code><pre>local mapinfo = {
<code><pre>local mapinfo = {
   ...
   ...
Line 74: Line 75:
<ol>
<ol>
<li>Check the [[Mapdev:metal|metal]] page to get our image dimensions. In our case a 4x4 map yields an image resolution of 257x257 pixels
<li>Check the [[Mapdev:metal|metal]] page to get our image dimensions. In our case a 4x4 map yields an image resolution of 257x257 pixels
<li>Create a 257x257 greyscale image
<li>Create a 257x257 greyscale image using your image editor
<li>Paint full white spots a couple of pixels wide on the places where metal will appear in game
<li>Paint the whole image black
<li>Paint full white spots 6 or so pixels in diameter on the places where you want metal to appear in game.
<li>Save the image to your working directory, call it metalmap.png
<li>Save the image to your working directory, call it metalmap.png
</ol>
</ol>
Line 86: Line 88:
|}</center>
|}</center>


= Create Texture Map =
= Create Diffuse Texture =
<ol>
<ol>
<li>Check the [[Mapdev:diffuse|diffuse]] page to get our image dimensions. In our case a 4x4 map yields an image resolution of 2048x2048 pixels
<li>Check the [[Mapdev:diffuse|diffuse]] page to get our image dimensions. In our case a 4x4 map yields an image resolution of 2048x2048 pixels
<li>Create a 2048x2048 RGB image
<li>Create a 2048x2048 RGB image using your image editor
<li>Paint your ground colour in such a way that it compliments the height of the terrain, and metal spots.
<li>Paint your ground colour in such a way that it compliments the height of the terrain, and metal spots.
<li>Save the image to your working directory, call it diffuse.png
<li>Save the image to your working directory, call it diffuse.png
Line 104: Line 106:


= Create Mini Map =
= Create Mini Map =
The [[Mapdev:minimap|mini-map]] is a thumbnail image of the the whole map displayed in lobbies when selecting maps.
<ol>
<ol>
<li>Load up your diffuse.png image
<li>Load up your diffuse.png image

Revision as of 02:40, 31 December 2012

Beginners Tutorial Stage 1

This beginners tutorial is aimed at getting you from nothing, to something simple which you can build upon.

What you will need

There are a multitude of other tools you can use to make maps, however for the purposes of this beginners tutorial, these are the only ones you will need. Check the tools section for more information.

Download

  • Download the finished working files
  • FIXME: Download the completed map archive

Preparation

  1. Extract the mapcontainer.sdd folder from the blueprint archive into your working directory.
  2. Your directory structure should look like this:
    working directory
      |-mapcontainer.sdd/
        |-LuaGaia/
        |-mapconfig/
        |-maphelper/
        |-maps/
        |-mapinfo.lua
        |-mapoptions.lua
    
  3. Rename the mapcontainer.sdd folder to the name of your map, eg. mymap.sdd
  4. Edit the following variables in the mapinfo.lua file, ignore the rest for now.
    • name
    • shortname
    • description
    • author
    • version (just put like v1 or something in here)

Create Height map

For this tutorial we will be creating a 4x4 size map, which is relatively small. Typically maps will be 8x8 (for a 1v1) or larger, but entirely depends on the game you are targeting.

  1. Check the height page to get our image dimensions. In our case a 4x4 map yields a image resolution of 257x257 pixels
  2. Create a 257x257 greyscale image using your image editor
  3. Draw the terrain
  4. Save the image to your working directory, call it heightmap.png
Tip
Black represents the lowest elevation on the map, white represents the highest, in between lies all the shades of grey. Hard edges in the image will be cliffs, and smooth gradients will be ramps.
Example
Example Height Map Ingame Result

Edit mapinfo.lua

  1. Open the mapinfo.lua file in a text editor
  2. Change the minHeight and maxHeight variables to 10 and 512 respectively
    These values control the overall height of the terrain, and will be unique to your map. After loading up the map in game you may want to revisit and tweak these values to get the best result.
    The resulting portion of code should appear like this:
    local mapinfo = {
       ...
       smf = {
          minHeight = 10,
          maxHeight = 256,
          ...
       },
       ...
    }

Create Metal Map

Caution
There are several games for Spring which use their own resourcing system. If you are creating a map for one of those games, a metal map may not be necessary, 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.
  1. Check the metal page to get our image dimensions. In our case a 4x4 map yields an image resolution of 257x257 pixels
  2. Create a 257x257 greyscale image using your image editor
  3. Paint the whole image black
  4. Paint full white spots 6 or so pixels in diameter on the places where you want metal to appear in game.
  5. Save the image to your working directory, call it metalmap.png
Example
Example Metal Map Ingame Result

Create Diffuse Texture

  1. Check the diffuse page to get our image dimensions. In our case a 4x4 map yields an image resolution of 2048x2048 pixels
  2. Create a 2048x2048 RGB image using your image editor
  3. Paint your ground colour in such a way that it compliments the height of the terrain, and metal spots.
  4. Save the image to your working directory, call it diffuse.png
Tip
It may be useful to use the heightmap.png and metalmap.png images as a starting points, scaling them up to size, and then painting over the top.
Example
Example Diffuse Map Ingame Result

Create Mini Map

The mini-map is a thumbnail image of the the whole map displayed in lobbies when selecting maps.

  1. Load up your diffuse.png image
  2. Scale the image to exactly 1024x1024 pixels
  3. Save the image to your working directory, call it minimap.png

Define Start Positions

considering the small size of the map we will only define two teams

  1. Open the mapinfo.lua file in a text editor
  2. Locate the teams subtable and delete the lines for teams 2 and 3
  3. Edit the x and z coordinate for each team to define their start location

The coordinates for spring relate 1:1 with the pixels in the diffuse map. Starting at the top left of the image at (0,0). x increases horizontally to the right, z increases vertically downwards.

Coordinates

The code should look similar to this:

local mapinfo = {
  ...
  teams = {
    [0] = {startPos = {x = 256, z = 1024}},
    [1] = {startPos = {x = 1792, z = 1024}},
  },
  ...
}

Review

From the tutorial we have learned how to make the:

  • Height map
  • Diffuse texture
  • Metal map
  • Mini map
  • Start locations

Your directory structure should look similar to this:

working directory
  |-mymapname.sdd/
  | |-LuaGaia/
  | |-mapconfig/
  | |-maphelper/
  | |-maps/
  | |-mapinfo.lua
  | |-mapoptions.lua
  |-heightmap.png
  |-metalmap.png
  |-diffuse.png
  |-minimap.png

Now we need to get the map loaded into the game

Finalizing

Continue to this page to compile and archive your map for play.

I want more

Continue to stage two