Welcome to Hammer, it sucks -- A know-nothing's guide to using hammer

Discussion in 'Tutorials & Resources' started by wareya, Mar 20, 2014.

  1. wareya

    wareya L7: Fancy Member

    Messages:
    493
    Positive Ratings:
    173
    Hi! This is a mapper's 101 guide. I'm going to go over what I think the important basics are, when it comes to making TF2 maps. I don't know everything, though, so there might be something useful to know that I don't mention. Well, I'm bad at this, so let's get started.

    The first thing we want to do is locate Hammer, the map editor for TF2. It's distributed with TF2 now, so you're going to have to install the game if you want to map for it (how would you test without it...?). Right now, it gets downloaded to "steamapps/common/Team Fortress 2/bin", as hammer.exe and hammer.bat. You'll probably want to run hammer.bat, because it sets up important environment variables for hammer to function properly.

    [​IMG]

    (This is how hammer should look when you first run it. If it doesn't, enable everything under View -> Screen Elements.)
    So, you go run hammer, and... What's all this interface? Well, I guess it would be easier to explain if you make a new empty map first. Do that from the file menu, and I'll highlight the important tools for you:

    [​IMG]

    It's a lot to take in at once, but you can ignore it for now. We're going to go through the basics and make a very rudimentary TF2 map.

    Let's start with some geometry. We don't want to do anything special, so we're just going to make a box (there's a reason for that). Start by hitting "browse" on the right side of the screen, right next to the texture icon.

    [​IMG]

    You should see something like this. Don't worry if things are different sizes, or you have different textures. Now, type "concrete floor" into the Filter (first) and "tf" into the Keywords (second).

    [​IMG]

    You should see something like this. Don't worry if the icons are different or you don't see something that I do. Pick one of the plain ones and double click it. The browser will close, but notice that the texture icon on the right side of the screen changed (if you didn't pick the one that was there). That's the active texture, that the texture tools are using, and that "brushes" will use when you create them. I'm going to explain that next.

    Click the Block Tool on the left side of the screen. It's the gray shaded cube. Then, drag it across one of the grids you see on the screen.

    [​IMG]

    You should see something like this. If you see two wide ones and one rectangular one like I did, you picked the right grid. Otherwise, pick a different grid until you get it. Also, don't worry if it's not the same size as mine. The size isn't important, as long as it's fairly large. Hit enter.

    [​IMG]

    You just created a brush! But you can't really see it yet, because the camera might be inside of it. If it is, like in my screenshot right there, you have to move the camera out of it. Click whichever view says "camera", and wasd around until you're outside of it. You can also use the Camera tool to change your view angle, or hit "z" to toggle an FPS-style mouse lock.

    [​IMG]

    I made a brush! So... Now what? You need to make the walls. Do that texture browser thing from earlier, but choose a wall texture instead of a floor one. It doesn't matter that much what you pick, though. Finally, in one of the grid views that seems to be looking at the side of your floor brush, do something like this with the block tool:

    [​IMG]

    You're making a wall! And it's the same size as the floor, at least in the views that you didn't drag on. That's one of hammer's subtler features, you're going to have to get the hang of it yourself. Anyway, hit enter to make this brush, and do it for the other four walls too.

    [​IMG]

    I made a box! I can get it ingame now, right? Well, no, there are some important things that the map needs to compile and run correctly. First of all, you need lighting. The best way to make sure you have lighting is to add a skybox, and an entity that tells the skybox how to make the sun shine on the map. Select the skybox texture by searching for "sky tool" in the texture browser (if it doesn't show up, try removing the "tf" keyword). Then, do something like this for the sides and top of the map.

    [​IMG]

    This is great, because it kills two birds with one stone! First of all, anywhere that's "inside" the map needs to be entirely "sealed off" from the "void" outside of the map. We're going to put a player spawning point on the floor, which makes that the "inside", because anywhere that there's an entity is an "inside". Not like we could put it anywhere else, because that would be in the void. Anyway, we have a couple of entities to place.

    Click that little knob on the left side of the screen, right above the gray shaded cube. Better late than never, notice the section in the lower right part of hammer that says "Categories" and "Objects". After clicking the knob, it should say something like "Entities" and "info_player_teamspawn". If it doesn't, select those or type them in. Autocomplete can finish for you, if you want. Finally, click on the floor in the 3d view.

    [​IMG]

    Don't worry if you don't see a cute multicolored engineer with a beard, like I do. The important part is that you typed everything in correctly.

    We're done, right? We have a skybox and player spawns and the spawns are sealed off from the void. Well, we have to define how the light comes out of the sky, too. Make a light_environment entity, and set its pitch to something negative. Preferably something between -45 and -90. This makes the sun shine down, instead of appearing from the horizon. Hit Apply, and we're finally done. How do we get this map in the game?

    [​IMG]

    There's a little icon in the top right of the screen, to the left of the green leaf, that looks like a controller. I'll click it, give it a big red circle to point it out, then explain what everything does.

    [​IMG]

    So, when you want to play a map you made in TF2, it has to be compiled. This is a process that takes the map source that you can save and load (a "vmf") and turns it into a file that the game loads up and makes the actual ingame map out of (a bsp). There's a ton of stuff that the compiling process needs to do, because the game uses a lot of data straight out of the map instead of figuring it out while it's running.

    First, there's a program called "vbsp". This is the backbone of the compiling process. It converts all the level geometry into a data structure called a "binary space partition", and assigns different entities and pieces of geometry to parts of that data structure. I'll spare you the details, but it sets up everything that the game engine needs to actually run the map. The data structure is the reason that the map needs to be hollow geometry that's totally sealed from the outside. This makes almost everything that the game does incredibly cheap to calculate.

    Second, there's a program called "vvis". To put it simply, it decides which parts of the map can see which other parts. If it weren't for this, every map in the game would render everything all at the same time no matter where you are. Isn't that terrible?

    Third, there's a program called "vrad". It figured out how everything and every area in the level is lit. It's the difference between a map with shadows and indoor lighting and walls that look different from eachother, and a fullbright map.

    Finally, the compiliation process copies the finished bsp file into TF2's maps folder.

    Sorry for the long-winded explanation, but it's good to have a general idea of how these things work earlier rather than later. Anyway, let's run the compilation process and play our new map, right? Just hit "OK", and watch the compile log run by and TF2 start up with our new map!

    [​IMG]

    If you didn't make any mistakes, your map should look something like this. If something is totally wrong, like the lights missing, or being too strong, copy the compilation log into this online utility (everyone does it): http://www.interlopers.net/errors/

    That's the first new image in a while! Doesn't it look nice? There's not much to it, and I wouldn't play on it for very long, but it's a basic map that works right, and you can take what you learned here, and learning other things that are much more TF2 specific (like "How do I make a map be a KotH map?"), make really good maps.

    THINGS YOU'LL NEED TO KNOW LATER:

    Download and install this immediately: http://forums.tf2maps.net/showthread.php?t=4674

    For mathematical reasons, brushes absolutely always need to be convex pieces of geometry. If they're not, hammer will throw a hissy fit and break things.

    Go look up what a func_detail is and how it's used. This is necessary.

    Read a tutorial on entity logic.

    Hear what other people say about their map development workflow: How they make layouts, what the difference between an alpha and a beta map is, etc.
     
    • Thanks Thanks x 7
    • Agree Agree x 1
    Last edited: Jan 16, 2015
  2. Fr0Z3nR

    aa Fr0Z3nR Creator of blackholes & memes. Destroyer of forums

    Messages:
    6,391
    Positive Ratings:
    4,906
    I didn't think you would actually take the title name!
     
    • Thanks Thanks x 1
  3. Sergis

    aa Sergis L666: ])oo]v[

    Messages:
    1,871
    Positive Ratings:
    1,131
    whats the point of manifest window

    edit - id also recommend recommending making the wall with shiftdragging and retexture. those two things are basic enough to be included in a 101. and idk about others but i use block tool only once per map, then its shiftdrag shiftdrag shiftdrag unless i need some circles and arches

    & y u no F9 2 compile

    & its faster to find sky texture with "ssky" ;)
     
    Last edited: Mar 20, 2014
  4. wareya

    wareya L7: Fancy Member

    Messages:
    493
    Positive Ratings:
    173
    no idea, I had it enabled to show the default layout

    edit - i actually didn't know about shift dragging until this very week, and i got by fine. seems like it's one of those random many usability benefits that hammer has once you're good at it.
    i actually copy paste my brushes all the time but sometimes blocktool is mega useful. it's important to make it seem like an important tool, because otherwise it could give someone a bad habit. making blocks from scratch is never a bad idea, but always copypasting can be bad (i.e. if a brush has imprecise vertices and you don't know, etc)
     
    • Thanks Thanks x 2
    Last edited: Mar 20, 2014
  5. Micnax

    aa Micnax I maek map

    Messages:
    2,061
    Positive Ratings:
    1,396
    Shiftdragging makes life a whole lot easier, so it's worth a mention.

    Glad to see you included the Z shortcut for camera lock.
     
    • Thanks Thanks x 1
  6. henke37

    aa henke37

    Messages:
    1,919
    Positive Ratings:
    449
    I didn't realize that even hammer mixes up materials with textures. Time to file a bug report!
     
  7. puxorb

    aa puxorb L69: Emoticon

    Messages:
    455
    Positive Ratings:
    643
    I would also like to point out that you should make sure that the "select by handles" box is checked on the top toolbar. When I was new to hammer, dragging brushes out was a real pain in the ass because hammer kept thinking I was trying to click on brushes that shared the same side. Also, [ and ] allow you to change grid size very easily. I just learned that one a few months ago and it has saved literally minutes on my work.
     
  8. wareya

    wareya L7: Fancy Member

    Messages:
    493
    Positive Ratings:
    173
    well i'm under the impression that since they're textured materials it's ok
     
  9. henke37

    aa henke37

    Messages:
    1,919
    Positive Ratings:
    449
    The thing is, many materials have more than one texture. There is blend materials, materials with detail textures...
     
  10. Crash

    aa Crash func_nerd

    Messages:
    3,186
    Positive Ratings:
    4,899
    I think it's kind of a silly thing to take issue with. We all know what is meant by it.

    It's just semantics at this point.
     
    • Thanks Thanks x 2
  11. Freyja

    aa Freyja ¯\_(ツ)_/¯

    Messages:
    2,877
    Positive Ratings:
    4,944
    The manifest window has something to do with instances I think, but as far as I can tell it doesn't work in tf2 hammer. The intance menu has a "create manifest" that just crashes hammer, but I assume it's supposed to show all the instances files you have or something.
     
  12. Pocket

    aa Pocket func_croc

    Messages:
    4,489
    Positive Ratings:
    2,219
    It's kind of ironic that TF2's Hammer has features we can't use, because it was copied from the Hammer used in newer games, yet mysteriously lacks some features that are not engine-specific that newer games' Hammers have, like blendtexture support.
     
  13. xzzy

    aa xzzy

    Messages:
    815
    Positive Ratings:
    393
    I'm just super glad instances made into TF2's version because they are the handiest thing ever for rotation symmetric maps.

    Or for building on the grid and putting it in game at a weird angle.
     
  14. Egan

    aa Egan

    Messages:
    1,318
    Positive Ratings:
    1,507
    Like how on that CSGO Museum map that 3Dnj made, where the bridge is all one big instance. Looks great in the end.

    [​IMG]

    [​IMG]

    Got these from here.
     
    • Thanks Thanks x 1