PDA

View Full Version : VHE & My First Map Tutorial


dodsynthetic
02-06-2009, 03:55 AM
===========================================
VHE & First DoD Map Tutorial
===========================================

This tutorial is aimed at setting up your VHE (Valve Hammer Editor) and creating a simple map with two flags. It can be a real pita setting up VHE if you have never done it before, the info here will make it very easy. This will be the start of a series of tutorials covering everything from advanced map features and other things such as custom WAD files to adding your own models and sprites.

First you need to get VHE. Fortunately, I have packed up my version 3.5 with the latest version of Zoner's Half-Life tools which are a set of compilers for creating maps. It also has the Day of Defeat FGD file and other DoD specific files so things like models show up while editing a map as they normally will show as a simple 3D block. All you have to do is extract it to your c:\Program Files directory. If your Windows is of a different language, you will have to make some minor changes to the paths of the compiler exes or you can just make the folders as mentioned.

You can get version 3.5 of VHE by searching http://www.google.com or download my copy with everything inlcuded
from vhe.rar (http://www.rivurs.com/downloads/dodplugins/vhe.rar)

I have also put up the sample map I created for this tutorial here (http://www.rivurs.com/downloads/dodplugins/my_first_map.rar) if you want to check it out or have problems figuring something out.

=====================================
I downloaded a clean copy
=====================================
If you decided to get your own copy of VHE from elsewhere on the internet, more than likely, it won't have the map compilers included. If it does, they could also be the stock ones that Valve originally released. These are OK but to do any form of mapping, I HIGHLY recommend Zoner's which can also be found on Google or you can get them here
zhlt34x86final.rar (http://www.rivurs.com/downloads/dodplugins/zhlt34x86final.rar) You will also need a copy of the DoD FGD file. Google is your friend.

Now that you have your VHE, DoD FGD file, and either the default compilers, or Zoner's, start by extracting the VHE to a directory of your choosing. If the download of VHE just included the hammer.exe you will need to make some new directories in the folder you extracted your hammer.exe to. These will be fgd and tools. Inside the fgd folder, make one named day of defeat and copy your dod.fgd file there. Inside the tools directory, you will have the default compilers or if you have Zoner's, extract them into a new folder in the tools directory named zhlt34x86final. I hope you got this version of Zoner's as this will give the best results. For compiling, I am only going to cover using Zoner's as well.

With your files and directories all in place, it's time to setup your VHE. Go to your hammer.exe and double click it to run it. Up on the tool bar click Tools > Options. Now click on the Game Coniguration tab.

- Under Configuration, click the Edit button and add a new configuration named dod.

- Under Game Data Files, click the Add button and add your FGD file.

- Under Game Executable Directory, click the Browse button and point it to your half-life folder.

- Under Mod Directory, click the Browse button and point it to your "day of defeat\dod" folder.

- Under Game Directory, click the Browse button and point it to your "day of defeat\valve" folder.

- Under RMF Directory, click the Browse button and point it to a directory where you wish to save your maps to.

If your having trouble locating your Steam/DoD install, it is generally installed in:
C:\Program Files\Valve\Steam\SteamApps\myusername\day of defeat
You can also quickly locate it by right clicking your Steam desktop/Start Menu icon and selecting properties. Under the Target box, it will show the path to your install.

After you have setup these settings, now click the Build Programs tab.

- Under Configuration, make sure dod is selected.

- Under Game Executable, click the Browse button and add your "day of defeat\hl.exe" file.

The next few settings are where the compilers are located. These will be in the directory you installed VHE to. Example c:\Program Files\Valve Hammer Editor\tools or with Zoner's c:\Program Files\Valve Hammer Editor\tools\zhlt34x86final Note that the default compilers are named different such as CSG is qcsg.exe but with Zoner's they are hlcsg.exe

- Under CSG Executable, click the Browse button and add your csg.exe file.

- Under BSP Executable, click the Browse button and add your bsp.exe file.

- Under VIS Executable, click the Browse button and add your vis.exe file.

- Under RAD Executable, click the Browse button and add your rad.exe file.

- Under Place comiled maps..., click the Browse button and point this to your "day of defeat\dod\maps" directory.

OK were almost done here. Now we have to add some textures to use. Click the Textures tab.

If your using Zoner's, add the WAD file provided by Zoner's. These include special textures so they are easily at your fingertips.

- Click the Add button and point this to the zhlt.wad file which will be in the directory you installed Zoner's to.

We will also need some regular textures to work with so we will borrow the ones from the dod wad file.

- Click the Add button again and point this to your day of defeat\dod\dod.wad

Your all done. Click the Apply button and then OK button.

=====================================
I downloaded your copy
=====================================
This will be easy and as said before, if you extracted it to the same folder "c:\Program Files\Valve Hammer Editor\" your almost ready to start working. You will first need to change some settings to your point to your DoD and Half-Life install. Go to your hammer.exe and double click it to run it. Up on the tool bar click Tools > Options. Now click on the Game Configuration tab.

- Under Game Data Files, click the Add button and add your FGD file.

- Under Game Executable Directory, click the Browse button and point it to your half-life folder.

- Under Mod Directory, click the Browse button and point it to your "day of defeat\dod" folder.

- Under Game Directory, click the Browse button and point it to your "day of defeat\valve" folder.

- Under RMF Directory, click the Browse button and point it to a directory where you wish to save your maps to.

If your having trouble locating your Steam/DoD install, it is generally installed in:
C:\Program Files\Valve\Steam\SteamApps\myusername\day of defeat
You can also quickly locate it by right clicking your Steam desktop/Start Menu icon and selecting properties. Under the Target box, it will show the path to your install.

After you have setup these settings, now click the Build Programs tab.

- Under Configuration, make sure dod is selected.

- Under Game Executable, click the Browse button and add your "day of defeat\hl.exe" file.

- Under Place compiled maps..., click the Browse button and point this to your "day of defeat\dod\maps" directory.

OK were almost done here. Now we have to add some textures to use. Click the Textures tab.

If your using Zoner's, add the WAD file provided by Zoner's. These include special textures so they are easily at your fingertips.

- Click the Add button and point this to the zhlt.wad file which will be in the directory you installed Zoner's to.

We will also need some regular textures to work with so we will borrow the ones from the dod wad file.

- Click the Add button again and point this to your day of defeat\dod\dod.wad

Your all done. Click the Apply button and then OK button.

Your now done! If you extracted VHE to a different directory though refer to the "I downloaded a clean copy" above for setting up additional directories.

=====================================
My First DoD Map
=====================================
Hopefully the VHE setup wasn't too hard and if all goes well, you will be running your first map soon!

To get started on your first map, click File > New on the tool bar. You will be presented with four windows.

Next step is to turn on "snap to grid". This will make things easier on you when building your level for positioning and what not. It also helps to prevent hull leaks. A hull leak is anytime the interior of a map is not entirely closed off from the outside. This is bad and your map won't compile with a hull leak. To turn this on, click Map > Snap to Grid in the tool bar. Also, make sure Show Grid is also checked so you can see what your working with if it isn't on. More in depth, snap to grid, makes things stay in line on the grid so you can create consistent sized walls and make sure they always meet up in effect, closing the hull. You can change the grid size with your [ & ] keys so you can instantly make larger walls. Just so you know, the walls that you build in a map are called "brushes". These form to create your whole map.

==============
Building
==============
Time to build the first wall. On the left side of VHE, you will see 11 large icon buttons. Hovering your mouse pointer over these will reveal their names. Click the Block Tool icon.

You will now be in the mode to create brushes. On the far top right side of VHE you will see Texture Group and Current Texture. The current texture is the one that will be painted to your brush. Go ahead and select one that looks good. I'm going to go with drkbrick2.

Next, move your mouse pointer over the top (x/y) view window. These windows correspond to the view of your map. Top is overhead looking down, front and side are easily figured out. XD Left click and drag to create a new brush. You'll notice how you can change it's shape by moving the mouse around. You can also left click the brush in different windows to place it where you like as well as use the little white boxes for adjusting the size. You will frequently use all of the views to adjust your brushes and position them. After determining what you want, make sure it's big enough. My current grid size is 64 (it tells you the size in the bottom right) and therefore each box on the grid is 64. The brush I created has a length of 1536 24 blocks x 64. Plenty long for what we need. Now when you look at the front and side view, you will see that this wall is only 64 high. That's kind of short so we'll adjust it's size to 192.

Once the size and shape look good, hit Enter and it will make the brush into the map. You should see this in the Camera view pane. Navigating your map can be done in the Camera view by holding the space bar with the wasd as forward/backward etc. and mouse look with left click held down.

With these basics in mind, you can complete a whole box. The sides do not have to over lap to prevent a leak to hull. Corners touching is perfectly acceptable

==============
Lighting
==============
Since this is a closed map with no skymap, we need to put in a light. It's no fun playing in a pitch black map right? XD Click the Entity Tool icon.

In one of the view windows, left click and then hit enter to create an entity. Position it so it's inside of your box. Next, click the the Selection tool icon.

Select your newly created entity by left clicking on it and hitting your alt+enter key. This will bring up the entity properties window.

Under Class select light. The default settings will work fine but you can play with the brightness and other options if you like. The number format you see is RBG and level. So for the default value of brightness, 255 255 128 200, this is saying red is set to 255, green is set to 255, blue is set to 128, and the level is 200. Level is the amount of light it will produce. The ranges for these numbers are 0-255 where 0 is least and 255 is max.

==============
Spawns
==============
We are now ready to add in the spawns. Using the method to create the light, create another entity but this time, instead of creating a light, select info_player_allies. Do the same on the opposite side of your map but make it an
info_player_axis. Since this is a simple map, we are adding only one of each team spawn. You normally want up to 32, 16 for each side because if too many spawn in the same spot, they will get stuck in each other. Anyway, you can adjust the yaw, which is the direction the player will be facing when they spawn. Sometimes the player models wont show, you will just see a block so you can't see the direction. If you got my copy of VHE, the required DoD files are included to show them but still sometimes won't show. Restarting VHE can fix this. If you did a fresh install, you will need to grab this sprite pack and extract it to your VHE directory.
sprites.rar (http://www.rivurs.com/downloads/dodplugins/sprites.rar)

==============
Flags etc
==============
The flag system isn't really hard. Start by making an entity, this one will be dod_control_point_master.

This handles the actions for when a team captures all the flags.

- Under Target When Allies Capture, enter allies_win.

- Under Target When Axis Capture, enter axis_win.

- Under Group Name, enter flag_group.

The targets are what get triggered when a side caps all the flags so the names are important. With the group, we need to have a common group that the flags will be tied to.

Now we will create the targets. These handle things like the points to give to the team for winning the round etc.

Create a new entity, this will be a dod_score_ent.

- Under Name, enter allies_win. You probably noticed that this is the same name used from the dod_control_point_master "Target When Allies Capture". The dod_control_point_master will target this when allies win because it's name is the same as the dod_score_ent name.

- Under For Team, select Allies. If the Allies won, we only want to do this for the allies.

You can change the score amount if you want to give more than the default amount of points to the winning team.

Next, create another dod_score_ent but this one will be named axis_win and For Team, Axis.

Lastly, lets make two flags to capture.

Create yet another entity. This one will be a dod_control_point. This is a flag and we'll start on the Allied side.

- Under Name, put flag1.

- Under Control Point Name, enter Allied First.

- Under Can Allies/Axis touch this point, select yes for both.

- Under Sound Made when Allies capture, put ambience/uspointcaptured.wav.

- Under Sound Made when Axis capture, put ambience/gerpointcaptured.wav.

- Under Group Name, enter flag_group. Remember from the dod_control_point_master? We want to tie these to it by the common group
name we used.

- Under Index of This Point, enter 1. This needs to be a unique number. This is the first flag so we'll enter 1.

Feel free to play with some of the other options which are fairly obvious as to what they do. Now make another dod_control_point but for the Axis side. For name use flag2, make sure both sides can touch it, use the same flag group name, and an index of 2. This is basics needed for a working map. Read on though for some more things we can do when a team wins and I'll finish this up with how to compile your map for playing.

==============
Targets
==============
So we now have what is needed to play a map with two flags but let's put some additional things to work. We will add a round win sound and a HUD message when a side wins as is common to many maps.

You know that dod_control_point_master will target allies_win when allies win and axis_win when the axis win. Well, you can add other things with the same name so they are also triggered. Anything you set with those target names will fire off when the corresponding team wins.

Create a new entity. This one is going to be an ambient_generic.

- Under Name, enter allies_win.

- Under Path/filename.wav of WAV, enter ambience/uswin.wav.

Now under the Flags tab, check Play Everywhere, Start Silent, Is NOT Looped.

Play everywhere plays the sound throughout the map. Start silent makes this sound only play when triggered, and is not looped makes sure it only plays once.

Now make one for the axis side. By now you should know what to set. Name axis_win. Path/filename.wav of WAV will be ambience/germanwin.wav this time though.

On to the HUD win message, create an entity. The type is game_text.

- Under Name, enter allies_win.

- Under Message, enter a message you would like such as "Allies win!".

Under the Flags tab, make sure the All Players box is checked. This makes the message show to all players.

Make another one for Axis and your all done.

==============
Observer
==============
The observer entity, while not required is nice to have. When you first join a map, this is the location a player will be in before choosing a team. You want this inside of your map. Without it, they are put at location 0,0,0 (X/Y/X). Create an entity and it will be info_observer. After creating it and placing it where you want, that is all that is needed.

==============
Compiling
==============
I'm going to skip using the built in method to compile the map and show you a much better way of doing it. It will give you more control. This method uses batch files. For those of you who know what MS-DOS is, you will probably know what a batch file is. If you dont, it is basically a file that contains set of actions (think scripting). Making one is very simple. Open up any text editor such as notepad.
Copy the following into your text editor:

@echo off
set WADROOT=C:\Program Files\Valve\Steam\SteamApps\myusername\day of defeat\dod
if ERRORLEVEL 1 goto failed
if ERRORLEVEL 1 goto failed
"C:\DoD Modding\Tools\zhlt34x86final\hlcsg.exe" -wadautodetect -chart -cliptype precise "C:\path to where my map is\my_first_map"
if ERRORLEVEL 1 goto failed
"C:\DoD Modding\Tools\zhlt34x86final\hlbsp.exe" -chart "C:\path to where my map is\my_first_map"
if ERRORLEVEL 1 goto failed
"C:\DoD Modding\Tools\zhlt34x86final\hlvis.exe" -fast -threads 1 -chart "C:\path to where my map is\my_first_map"
if ERRORLEVEL 1 goto failed
"C:\DoD Modding\Tools\zhlt34x86final\hlrad.exe" -bounce 1 -sparse -threads 1 -chart "C:\path to where my map is\my_first_map"
if ERRORLEVEL 1 goto failed
if ERRORLEVEL 1 goto failed
if ERRORLEVEL 1 goto failed
if ERRORLEVEL 1 goto failed
if not exist "C:\path to where my map is\my_first_map.bsp" goto nocopybsp
copy "C:\path to where my map is\my_first_map.bsp" C:\Program Files\Valve\Steam\SteamApps\myusername\day of defeat\dod\maps" /y
echo copied to dod\maps.
:nocopybsp
goto succeeded
:failed
echo.
echo There was a problem compiling your map, check your log file for errors.
:succeeded
echo.
if exist "C:\path to where my map is\my_first_map.log" "C:\Windows\system32\notepad.exe" "C:\path to where my map is\my_first_map.log"

Let's go through this so it's setup for your map.

set WADROOT= is the directory where your used wad files are. In our case it would be the dod.wad which will be in your dod folder.

From the next few lines, you will see that I use Zoner's compilers. You will want to change these directories to point to where your compilers are. You will also want to change the directories listed at the ends of these entries to where you saved your map along with the map's name with no extension. Do this for the CSG,BSP,VIS, and RAD.

For if not exist, this will be the path and name of what your compiled map name will be.

For the next line, copy, this will also be the path and name of what your compiled map name will be. This is followed by the path to where your DoD map folder
is located.

The last part if exist is used to pull up the log file for your compiled map. It is optional but good to check see if any errors came up when compiling. The first part is the path to where the map log file would be created and the second part you would point to your text editor, in my case notepad followed by the path to the log file so notepad knows what to open.

What all this does is compile the map, copy it to your day of defeat installation and opens the log file automatically for you.

If everything compiles fine, you can now open DoD and test your map!

I'm going to cover some of the command line options on a few of the exes used in compiling the map. Compiling can take a long time with larger maps so just to test
something you may want to change some settings to make it quicker. These are for Zoner's.

vis.exe with -fast or -full
-fast obviously is faster but for a final build, you will want to use -full
The -threads setting will allow you to take advantage of multi-core CPUs such as Pentium Core2 Duo, AMD Athlon 64 X2. If you only have 1 core leave this setting to
-threads 1 and for say two cores, it would be -threads 2. Obviously the more cores you have, the quicker you can compile maps.

rad.exe -bounce
-bounce sets how many times light will bounce off surfaces. The higher the number, the better the lighting in dark areas. Set this to 0 for faster compiling and
higher for final builds.
-threads works the same way as with vis.exe

Now save this to something like my_first_map.bat. The .bat extension is imporant for it to work properly. After that is done, you will need to save the map in the .map format. So far you have probably just used save to save your map. What you want to do now is use File > Export to Map. Once that is done, double click your batch file and let it do it's thing. As soon as it's done and granted you didn't encounter any errors, you can go into DoD and play your map! If placing the map on a server, make sure to upload the dod.wad or the server will stop because it needs the texture from the wad file.

==============
Map Info
==============
You have probably noticed that some maps give information when joining. These are simply text files that have the same name as your map and are placed with the compiled map in your dod\maps folder. When giving out your map make sure to include it so people know who made it.

=====================================
Tips and Tricks
=====================================
- ALWAYS make backups of your maps. I can't stress this enough. Things can go terribly wrong in an instant and as a general rule, always make a backup of the last compiled, in game working version you worked on. This can save you time and headache when you start getting one of those pain in the ass error messages. Many times, it's quicker to remake what you did than track down a problem that prevents the map from compiling or working in game.

- You can use the built in map checker to easily fix simple errors it's Map > Check for problems in the tool bar.