How to make a minimap

Discussion in 'Mapping' started by Jcw87, Dec 9, 2007.

  1. Jcw87

    Jcw87 Member

    Messages:
    1,676
    Likes Received:
    0
    Trophy Points:
    0
    I found the task of creating minimaps incredibly easy (except for certain cases where the engine doesn't want to render certain things.)

    For this example, I'll be using emp_isle. Before you start, copy an existing minimap script file from another map. You can find the minimap script file in Empires/resource/maps. Just copy emp_canyon.txt and name it <mapname>.txt

    Start up Empires, join both teams, and recycle their refineries. This is so you can find and mark them easier later on. Use "cl_drawhud 0" and "hidepanel all" to remove annoying HUD elements, and other console commands to manipulate the rendered image to something that is fitting to a minimap. For instance, we don't want the dust effects in emp_isle, so use "r_drawparticles 0" For a map the size of emp_isle, you will want to set cl_leveloverview to 32, and then position the camera to see the whole map, like this:

    [​IMG]

    (Yeah, I forgot to use "r_drawparticles 0" before taking the screenshot. So sue me.)

    Take a screenshot by using the "screenshot" command. I have "screenshot" bound to f10 for example. You will then need to open the screenshot in an image editor, and crop out the non-map sections.

    [​IMG]

    Resize the image to a power of 2, so that it can be converted into a texture. Most Empires minimaps are 1024x1024.

    [​IMG]

    Use an editing tool like photoshop to add finishing touches, such as marking the refineries so that new players know where they are.

    [​IMG]

    Now, you need to use VTex. This is a bit tricky, as it involves the command line. First, create a directory called "materialsrc/maps" and put the TGA image in there. This directory can be anywhere, as long as it has this structure. Create a txt file with the same name as the TGA, and put the following in it:

    Code:
    "nonice" "1"
    "nolod" "1"
    "nomip" "1"
    
    This will make the minimap look the same on all texture detail settings. Next, you select your Hammer configuration for Empires in the SDK launcher tool. This is very important, as VTex uses this in addition to the folder you put the TGA in to determine where to stick the compiled *.vtf. Now we run VTex from the command line. Navigate to your sourcesdk/bin/ep1/bin folder in the command prompt, and type the following:

    Code:
    vtex "<insert path to materialsrc folder here>/maps/<insert TGA filename here>"
    
    Tip: The lazy man who absolutely hates the command line can drag the TGA onto vtex, just make sure that the TGA is still in the correct folder.

    If done correctly, the VTF file will appear in the Empires/materials/maps folder.
    Now, you need to create the following *.vmt.

    Code:
    "UnlitGeneric"
    {
    	"$baseTexture" "maps/<insert vtf filename here>"
    	"$vertexcolor" 1
    	"$vertexalpha" 1
    	"$no_fullbright" 1
    	"$ignorez" 1
    
    	"%keywords" "empires"
    }
    
    Go to the Empires/resource/maps folder, and edit the txt file you copied earlier (<mapname>.txt) You will see a line like this:

    Code:
    	"image"		"maps/emp_canyon"
    
    Change this to match the name of the *.vmt file. Next, you will see the following:

    Code:
    	//the top left corner of the image which equals the top left corner of the map coordinate below
    	"min_image_x"	"23"
    	"min_image_y"	"0"
    
    	//the bottom right corner of the image which equals the bottom right corner of the map coordinate below
    	"max_image_x"	"1001"
    	"max_image_y"	"1024"
    
    These define the area of the image that should be mapped to real game space. Since Isle is perfectly square, and the whole image contains the map, you should set the top left bounds to (0,0) and the bottom right bounds to (1024,1024) assuming that the image is 1024x1024 pixels big. Next, you will see this:

    Code:
    	//the top left corner of the map
    	"min_bounds_x"	"-12288"
    	"min_bounds_y"	"15360"
    
    	//the bottom right corner of the map
    	"max_bounds_x"	"14848"
    	"max_bounds_y"	"-13056"
    
    You need to find the real game coordinates for the top left and bottom right corners of the map, and fill them in. I like to go to the very corner of the map, type "status" in console, and use the coordinates given there. Do this in both locations, and update the txt file. Assuming you've done everything right up to this point, all you have to do is restart Empires to see your new minimap working.

    Now, a small bit on map distributing. When creating a map with cutom content, you must create a <mapname>.res file inside the Empires/maps folder that tells the server what files need to be sent to clients who need to download the map. The minimap, and related files, are considered custom content, and as such, you must create a *.res file for all custom Empires maps. An example *.res file:

    Code:
    "resources"
    {
    "resource/maps/emp_mapname.txt" "file"
    "materials/maps/emp_mapname.vmt" "file"
    "materials/maps/emp_mapname.vtf" "file"
    "maps/emp_mapname.res" "file"
    }
    
    Change the lines to point to your actual minimap files. Only include the line that refers to the *.res file itself when you are 100% sure that the *.res file is working properly.
     
    Last edited: Dec 9, 2007
  2. dizzyone

    dizzyone I've been drinking, heavily

    Messages:
    5,771
    Likes Received:
    0
    Trophy Points:
    0
    Nice guide :)
     
  3. Chris0132'

    Chris0132' Developer

    Messages:
    9,482
    Likes Received:
    0
    Trophy Points:
    0
    How handy.

    I was going to ask about this when I was done with my map, but now I won't need to.
     
  4. Empty

    Empty Member

    Messages:
    14,912
    Likes Received:
    11
    Trophy Points:
    0
    Same here!

    Thank you man, I was wondering how to distribute those god damned files!
     

Share This Page