Setting Up Map Resources

From Empires Wiki
Jump to: navigation, search
Empires Mapping Documentation
Mapping Overiew | Hammer Configuration | Entity Index | Basic Mapping | Setup Resources | Tutorials | Useful FGD Modifications



Resources? What are Those?

First off, your asking, "What are Resources?" Well, Resources are the scripts and files needed for the Minimap and Objectives for your map.

How important is this? very. You cannot spawn without the resource.txt file in your Empires/Resource/Maps directory, and without the minimap VTF file and VMT file in your Empires/Materials/Maps directory. All you will see on your minimap is a black and purple checkerboard (that is, if you don't crash).

Creating the Minimap

Step 1 - The MiniMap Image

Take an overhead screenshot of your level.

Become a spectator by choosing it on the team menu, and hide the HUD by typing "cl_drawhud 0" in the console. If your map has fog, use the command "fog_override 1" to disable it (sv_cheats must be set to 1). Fly up to a decent height and look down. Do not go outside of the level. Use the cl_leveloverview command to have the engine draw the level flat. Setting cl_leveloverview to a higher number will make you zoom out more. Once you are happy with the camera, use the console command "screenshot <picturename>" to save as a targa (.tga) formatted image which has no compression.

You can also save to a .jpeg (default key F9) if you would like to edit the minimap picture from this format. You will then need a program such as ABC Converter to save to .tga for conversion to .VTF


Tip Tip: if you are using a large func_precipitation brush in your level, viewing too much of the brush at one time will cause you to crash to desktop.

Step 2 - Formatting the Image

Open your image in Photoshop/ABC or any decent image editing program. You can find it in Empires/Screenshots.

Crop it so that the image's width and height are the same and resize it so that they are a multiple of 2 (ie 256x256, 512x512, 1024x1024). Note down the pixel coordinates of the top left corner and the bottom right corner of your map as shown on the minimap image.

The coordinates can be found by hovering the mouse cursor over the relevant point in the minimap, and looking at the toolbars in your image editing program. Depending on what program you are using there will be a pair of numbers like this: (232,884) or (75 X 1024) for example. Those numbers are the pixel coordinates of your cursor position. Write these numbers down as you will be needing them later. You should have two pairs of numbers, one pair for the top left corner, and another pair for the bottom right. Neither pair should be smaller than 0 or larger than your image width/height.

It is very important that you find these coordinates with precision or the minimap will lose accuracy and this can cause all manner of problems.

Step 3 - Conversion to VTF

Convert your TGA image to HL2's VTF format using VTEX (found in your source SDK directory).

If you are unsure how to do this then follow this tutorial

Step 4 - Save in Directory

Place the .VTF file in your Empires/Materials/Maps folder

Step 5 - Creating the VMT file

Open a plain .txt file with a text editor such as Notepad. Copy this text into it.


"UnlitGeneric"
{
	"$baseTexture" "maps/<your map name>"
	"$vertexcolor" 1
	"$vertexalpha" 1
	"$no_fullbright" 1
	"$ignorez" 1

	"%keywords" "empires"
}

Edit <your map name> and save as a .vmt file in Empires/Materials/Maps directory. Make sure that you have not saved it as <your map name>.vmt.txt or it will not work.

Your Minimap has been created. But before we can see how it looks, we need to make a script that tells the game all about your map and its files.

Setting Up the Script

Step 1 - The Basic Script .TXT file

"How do i set up the script?" its very simple.

Open your text editor and turn Word Wrap off. Then, copy this text into a plain .txt file:


"<your map name>"
{
	//the location in the 'materials/' dir where the image for the map is
	"image"		"maps/<your map name>"

	//the top left corner of the image which equals the top left corner 
        //of the map coordinate below
	"min_image_x"	"90"
	"min_image_y"	"45"

	//the bottom right corner of the image which equals the bottom right corner 
        //of the map coordinate below
	"max_image_x"	"990"
	"max_image_y"	"950"
	
	//the top left corner of the map
	"min_bounds_x"	"-11150"
	"min_bounds_y"	"14850"

	//the bottom right corner of the map
	"max_bounds_x"	"14350"
	"max_bounds_y"	"-10250"

	//the size in map coordinates of each sector of a map (A1,F5, etc), a grid
        //line is drawn around each sector on the minimap to visually segregate them 
	
        "sector_width"	"200"
	"sector_height"	"200"

	//There are four levels of zoom. These are the min and max which correspond to
        //the amount of the map visible in the minimap panel when at that zoom level.

	"min_zoom"	"1"
	"max_zoom"	"0.25"

//Team panel descriptions
	"nf_description" "The Northern Faction is less equipped and trained than the forces of the Brenodi Empire, 
but its forces make up for it with genetic manipulation and determination.  All members are ex-citizens of Jekotia whose
disbanded military's past exploits into genetic manipulation were phased into the general population and provided a counter
to Brenodi technology.  This gives them the advantage of more versatility in ability enhancement and an unmatchable level of 
cohesiveness and coordination.  They've managed to find support in ex-Jekotians hidden within the Brenodi Empire and
among remnants of bunkers and weapon caches left over from the great battle which dissolved the nation of Jekotia."

	"nf_objective" "Objective: Build refineries to gain resources and build up your army.  
Then destroy the Brenodi Command Vehicle, or destroy all barracks (removing any place to spawn) and kill all members of the 
enemy team."


	"imp_description" "The Brenodi Empire’s forces are equipped with state of the art weaponary and equipment.  
All members undergo a strict training regiment to establish their combat effectiveness, and they are 
supported by the very best mechanized armor and air units.  All Brenodian citizens are required to receive an extensive set
of nanotechnological devices to function, and their military relies on these nanotech enhancements to further 
enhance the abilities of their soldiers.  The Brenodi Empire wages an ongoing campaign to subdue the Northern Faction
and eliminate their terrorist actions through force that have become all too common in ex-Jekotian territory."

	"imp_objective" "Objective: Build refineries to gain resources and build up your army.  
Then destroy the Northen Faction Command Vehicle, or destroy all barracks (removing any place to spawn) and kill all members 
of the enemy team."

}

Now look at the lines beginning with two forward slashes like this // . Make sure that they have only one line of text. They must not start a new line of comment text without a double slash. If your map crashes when you load it, it is probably because this script has the wrong format. Look at the picture below to see what I mean.

Correct Comment Format

Step 2 - Editing for Your Map

Now we will edit the script for your map.

First off, edit <your map name> on the top line.

"<your map name>"
{
	

Step 3 - Minimap Location

The next section is to add the minimap to your map, this will also create a "megamap" for spawning.

//the location in the 'materials/' dir for your maps VTF file.
	"image"		"maps/<your map name>" 

This tells the game where to look for the minimap you have just created. Change <your map name> to the name of your minimap.

Step 4 - Minimap Calibration

//the first part of the minimap calibration information

	//the top left corner of the image which corresponds to top left corner of the Hammer map coordinate below
	"min_image_x"	"90"
	"min_image_y"	"45"

	//the bottom right corner of the image which corresponds to the bottom right corner of the Hammer map coordinate below
	"max_image_x"	"990"
	"max_image_y"	"950"

Remember those two pairs of numbers I asked you to write down in the first section ? Insert them into the obvious locations here. (by the way if you don't know, the first number of each pair is the x value and the second is y).

//the second part of the minimap calibration
	
	//the top left corner of the map as displayed in Hammer
	"min_bounds_x"	"-11150"
	"min_bounds_y"	"14850"

	//the bottom right corner of the map as displayed in Hammer
	"max_bounds_x"	"14350"
	"max_bounds_y"	"-10250"

Insert your map coordinates here.

If you don't know how to do this, read carefully. Look at your map in the top view of Hammer. You know, the plan view, usually in the top right with (x/y) in the corner. Now zoom into that view so you can see the absolute top left corner (but stay inside the skybox) of your map very clearly. Now move your mouse cursor over that point, as precisely as you can or noone will be able to hit anything with artillery feedback and your buildings/units will be displayed incorrectly. Now look at the bottom status bar without moving your mouse, see that little pair of coordinates twinkling up at you ? Wipe away the sense of Deja vu from your mind and insert the numbers into your script. First number of the pair goes into the x value etc. Repeat for the bottom right position and you have calibrated your minimap.

Step 5 - Grid Overlay and Zoom Levels

//The grid overlay sizing information

	//the size in map coordinates of each sector of a map (A1,F5, etc), a grid line is draw around each sector on the minimap to visually segregate them 
	"sector_width"	"200"
	"sector_height"	"200"

This is the grid overlay onto the Minimap. This allows you to control the sizing of your grid overlay. For example, a large map will require large grid squares and large values. A smaller map will require smaller grid squares and smaller values.

You can also tweak these numbers to make sure your grid overlay does not end halfway through a sector on the minimap. In other words it lets you stop the computer drawing 5.5 grid squares instead of 6 or 5. You will understand this when you see your minimap for the first time I am sure. If you don't understand this then leave those numbers alone for now.

//Zoom Level Options

	//There are four levels of zoom. These are the min and max which corresponds to the amount of the map visible in the minimap panel when at that zoom level.
	"min_zoom"	"1"
	"max_zoom"	"0.25"

Self explanatory really, again if you don't understand these numbers, leave them alone and you will soon.

Step 6 - Map and Objective Descriptions

//Team panel descriptions
	"nf_description" "The Northern Faction is less equipped and trained than the forces of the Brenodi Empire, 
but its forces make up for it with genetic manipulation and determination.  All members are ex-citizens of Jekotia whose
disbanded military's past exploits into genetic manipulation were phased into the general population and provided a counter
to Brenodi technology.  This gives them the advantage of more versatility in ability enhancement and an unmatchable level of 
cohesiveness and coordination.  They've managed to find support in ex-Jekotians hidden within the Brenodi Empire and
among remnants of bunkers and weapon caches left over from the great battle which dissolved the nation of Jekotia."

	"nf_objective" "Objective: Build refineries to gain resources and build up your army.  
Then destroy the Brenodi Command Vehicle, or destroy all barracks (removing any place to spawn) and kill all members of the 
enemy team."


	"imp_description" "The Brenodi Empire’s forces are equipped with state of the art weaponary and equipment.  
All members undergo a strict training regiment to establish their combat effectiveness, and they are 
supported by the very best mechanized armor and air units.  All Brenodian citizens are required to receive an extensive set
of nanotechnological devices to function, and their military relies on these nanotech enhancements to further 
enhance the abilities of their soldiers.  The Brenodi Empire wages an ongoing campaign to subdue the Northern Faction
and eliminate their terrorist actions through force that have become all too common in ex-Jekotian territory."

	"imp_objective" "Objective: Build refineries to gain resources and build up your army.  
Then destroy the Northen Faction Command Vehicle, or destroy all barracks (removing any place to spawn) and kill all members 
of the enemy team."

This is the Description of the two sides (factions), as well as the map objectives. if you have objectives other than the default ones, you can change these, otherwise its not necessary.

If you do want to edit them, just make sure that you do everything inside the quotation marks and it will not affect the operation of the script.

Step 7 - Save in Directory

Save this file in your Empires/Resource/Maps directory as <your map name>.txt

Load up the map, and if you have followed this guide to the letter, your minimap will show up!



Guide Created by Kylegar and Jimather