Sunday, May 18, 2008

Lesson 3 - creating a 2-d sky - Connecting two rooms - adding sunlight -Inserting models


The first thing we should do. Is click the "ig" button. So that it pops up.

In the Camera View viewport, click on any wall to select all of them. Press Ctrl-e. Not only does that center the selected item in the 2-d viewports, it gives Hammer an idea of the size that it should draw your next block. Meaning when we draw our next room it will be the same height as the one that was selected when we hit Ctrl-e. And it will be on the same level. So it will already be in line with the current room. You will understand more of that later. For now, in the words of the great Hiram, "Just Do It".

Now let's create a huge room for these dudes to run into. Turn the Ignore Groups button back on. Select the wall that these two guys are facing.(see p32) This lets us know which side we're going to draw the new room on. (see p33) we need some room on that side. Make room by using the mousewheel to scroll out.
And then use the arrow keys to slide that thing over to the left.(see p34) now we have all this empty space to draw in. Let's draw a big room. Select the Texture Tool, click Browse, type Tools, double-click NoDraw texture, Select the Block Tool. In the Top View viewport, Drag a square 1601x 1010. (see p35)



I also changed my camera view, so I can get a better perspective of what's going on.(see p36) Hit Enter. Then click the Select Tool. (see p37 & p38) now the huge brush that we just created should still be selected. If not click on it and select it. Hit Ctrl-e, to center the 2-d viewports. Up to this point, we have been working in the Top View viewport. Now we are going to work in the Side View viewport. (see p39). We need to line these two rooms up.(see p40) slide the new brush over close to the room.





Zoom in with the mouse wheel as you get closer. So you can see the little white squares on the corners of the brushes behind the grips, little tiny squares.(see p41) We need to line them up.(see p42). After you get them lined up. Use the mouse wheel to scroll out.(see p43) we need to increase the height of our new brush. Select the grip in the middle, (see p44) And drag up to 775. (see p45) now we need to make it hollow. Hit Ctrl-h, thickness of 32, click ok.




Fly to the inside of the new brush that we just created.(see p46) now im going to show you a little trick a shortcut to create a quick border around your map. Make sure the ig button is not selected. Using the selection tool click on any wall inside the new brush. It should have selected all of the sides. Now take a quick look at the side view (see p47) you can see the spawn points outlined in purple. We can use these to adjust the height at which we should carve our huge brush. The height of the purple square is equivalent to the height of a player. So we want to make the cut over their heads. Because the height of the cut, is going to be the height of our border wall. So with the new brush selected click on the Carve Tool. Select to carve just above their heads (see p48) make sure you "keep both sides". Click Enter. You can see in the camera viewport the line we just carved. That will be the height of our fence.



Now working from the camera view,(see p46) let's texture our new box. Click on the Texture Tool. Click browse. Type tools, look for the texture called Skybox. Double-click the Skybox Texture. Apply the Skybox Texture to the top parts of the walls and onto the ceiling. (see p49) Select the Texture Tool, click browse type grass. Double-click on a Grass Texture. I used nature/argentan_blendgrassdirt. Apply the grass to the floor. (see p50) Click Texture Tool, type brick, select a brick texture. I used brick/brickfloor001a. Apply that texture to the remaining no draw texture's on the inside. (see p51).



Now we are going to place sunlight. To do this and we will use the Entity tool. The tool that looks like the chess pawn. Click on the Entity Tool. Now we need to go to that box on the right called move selected. Where it says Categories: Entities, objects:.
(see p52) click on the pulldown arrow on objects, and go to "light_env". And select it.(see p53).



Go to the Camera View viewport. Place the entity into your map by clicking where you want the entity to be placed.(see p54). Now we need to change the properties. To get to the properties of this entity. Use the select tool. And double-click on the light_env that we just placed in the map.(see p55) The properties dialog box will pop up. On the dialog box,see where it says, "Pitch Yaw Roll(X.Y,Z)" . Click on "Pitch Yaw Roll(X.Y,Z)". After, you select that, notice to the right the three zeroes, and under that a button that says "point at"(see p56). This controls the direction of the sunlight. We need to make it point towards the ground. Like in the real world. So click the button that says "point at"



Go back to the camera view. Your mouse pointer turns into a scope target. Just click on the ground approximately under the light_env. Click apply. Click cancel. (see p57) Now go back to the entity tool. And select from the "Objects:" drop down menu "prop_static."(like you selected the light_env) Now we're going to place it in our map. I used my arrow keys on my keyboard to swing my camera view down. As you can see in the example.(see p58), Notice How I use my top view to place the prop_static in front of our spawn room. Place yours, like I placed mine. Now I'm going to swing my camera down to get a better working view.(see p59)


Click the "select tool" then Double-click on the prop_static. The properties dialog box should have popped up.(see p60)

Select "World Model" then click on browse. (see p60).
A model browser should pop up.


(You can right-click on the pictures and select "open link in new window", to see the enlarged pic w/out leaving this page.")

(see p61)
1. You need to type door in the Filter.
2. Scroll down the list until you find the door just like the one I selected in my example.
3. You can preview the model in the window marked No. 3 on my example p61.
(After clicking on one of the model names you can use the arrow keys to move up and down)

Once you have the same door selected, double click on it.

On the object properties: prop_static dialog box click apply. ahhhhhhh! magic. That little red box turned into a doorway. Before we close this property box let's change the collisions. Click on collisions. Change the use "vPhysics" to "not solid." This makes the doorway not solid. vPhysics makes its solid. Some things you may want to be solid, like tanks, and cars. And some things you don't, like doorways and bushes. Well some of the bushes you might want solid. But you should never made doorways solid, because people run into them, and get stuck. Make it "not solid", click apply, click cancel.

The door we just created, is partially stuck in the ground.(see p62) We need to line it up. You can line it up with the Select Tool, By selecting it, then using the "side view" or the "front view", to zoom in, and move it up, out of the ground. But a quicker way, Is to Use the Select Tool, select it, then hit Ctrl-x, it will disappear. You put your mouse pointer in about the same place where the model was and press Ctrl-v. it will paste it. And it will place it right on the ground.(see p63)

Now that we have it lined up vertically we need to line it up horizontally. We do this through the top viewport. Select the doorway model. Go to the top viewport. Then zoom in if necessary I should not have to tell you that. Move it next to the wall, keep an eye on in the camera view. We want to move it partially into the wall.(see p64)

Now comes the fun part. Turn the Ignore Groups button on. Now we need to select the walls that we're going to cut. And not the walls that we do not wish to cut. (Remember: to select multiple items, we hold down "Ctrl key"). So select the doorway, hold the Ctrl key down select the wall that we're going to cut. Here comes the tricky part. Fly into the spawn room and select the wall that players are staring at. Because we have to cut a hole in that one too. So that's cut them both at the same time. That way we know the cuts line up correctly.

You should have selected the doorway, the wall that the doorway is touching, and the wall inside the spawn. Zoom in with the top view. Zoom in on the doorway. Select the carve tool. In the top viewport carve the wall close to the end of the door like in the example.
(see p65) Then do the same thing to the other side. It should look like p66. (see p66)


The vertical cuts are done. We still need to do one more slice. But we do not want to cut everything. We just want to cut what we have to. So we're going to use the "select tool," hit ESC, then select the door again. Hold down the Ctrl key and click the wall inside the doorway.(see p67) don't forget to swing around into the spawn, and select the door from this side.(see p68)


Once you select the doorway and those two wall pieces, zoom in, in the Front View viewport. Zoom into the top of the doorway, and slice that like you cut the sides of the door (see p69).

After you slice it, go back to the select tool, hit escape and select the part of the wall that is in the doorway like a brick door. Using the front view grab the grips, and drag that wall down to open up the doorway.(see p 70) Do the same thing with the wall that was behind that wall.

Go to the texture tool, click browse, type wood, and select a wood texture. I used wood/woodwall005a. Apply that texture to all the nodraw surfaces.(see p71) you are doing good, real good. Man, you should buy me a hamburger after this., Now to show you a quick way to get a model. If there is already one in the map that you want.

Click the Select Tool, select the doorway. from the top view viewport. Hold down the shift key, and drag the doorway to the other end of the hallway lift your finger off the mouse key before you take your finger off the shift key. This makes a copy. Without having to go through the dialog box.(see p72)


Select the door that we just slid over, Hit Ctrl-c to copy, hit Ctrl v to paste. Paste it on the ceiling near the light (see p73) then double-click on it, to open the properties. Select "world model", click browse, type "light_dome" in the filter, and look for "props_c17\light_domelight02_on.mdl". select that one click ok. Click apply. Click cancel.

Before you touch anything, you will notice that it is not lined up. You remember what we do. Simple we just cut and paste. It should still be selected already so all you have to do is hit Ctrl-x, to cut. Just do it. Put the mouse on the ceiling about where the light should be and press Ctrl-v.(see p74)


Now select the light bulb. Using the side view viewport and the front view viewport line up the light underneath the model just like I have it in the example.(see p75) Things you should know. The model by itself, will not light up the room. All the light comes from the light bulb.

Before you Compile the map, We have to change the default skybox texture. Valve, no longer uses that texture.

click on "Map", from the pulldown menus. Select, "Map Properties".(see 1a)

Click on the line that says, "Skybox Texture Name". Circled in red, where it says, sky_day01_01.....(see 2a)

We need to change that value to say sky_dod_01_hdr. (see 3a)
That is the skybox texture that they use in Anzio.
So that one will be good for a long time. Click Apply, Click Cancel.

Now that we are finished, and you've learned a lot. Compile the map and run around into your new space. You can practice adding new models. You know how to add models but, Let me give you an example of something that could happen. Let's say you copy the doorway and paste it into the field. Then you changed the model to a tank. The tank would not be solid. Because the doorway is not solid. So if you ever have a model in your map, and for whatever reason it is not solid and it should be, just remember to double-click on it. Open the properties, click on collisions, and make sure it says "vPhysics" instead of "not solid".

Go ahead and experiment with adding new stuff, just type whatever you are looking for, then see if they have one. You know the kind of stuff they have in DOD. Just use your memory. Don't mess up this map though. Click "save as"and mess around in that map, save this one. So you don't mess up this lesson. you learned a lot. But I'm not ready to cut you loose yet. There is still a lot to learn. Like flags, spawn protection, and a bunch of stuff. Don't forget to check your map for leaks. I checked mine, and there were no leaks.



When I ran my map, I noticed I didn't make the wall high enough.(see p76) so i decided to fix it real quick. I went back to hammer selected the box again,(see 77) (you might have to take the ignore groups button off.) I selected everything, and made another slice a bit higher than the first slice. Then I applied a new texture.(see78) I chose a different brick texture for the texture at the top part of the wall. It gives it a different look.



You can experiment with different textures.



Yeah I like that better.(see p79)



Goto Next Lesson

Friday, May 16, 2008

Lesson 2 - Leaks, Select Tool, Carve Tool.

Lesson 2:
Leaks, Select Tool, Carve Tool.
Ignore Groups Button

In this lesson you will learn about leaks, and more things we need to know about the Select Tool. Also I will introduce you to the Carve Tool. So let's get started.

Leaks, are important to know about. It is also important to know how to find them. A leak is caused by a hole in your map or by placing an entity on the outside of your map. A leak is an error created when Hammer cannot tell the difference between the inside of your map, and the outside. You want to eliminate leaks because they cause all kinds of funny things to happen. So the best way to see what a leak is, and how to fix it, we need to create one.

Before we create an artificial leak. I should teach you about the Select Tool. Because we are going to use the Select Tool to create the leak, and also to fix the leak. Open Hammer. Go to File and click new. Or hit Ctrl-n to open a new map file. As always, after opening a new map click on the "-" tic-tac-toe to make the grid smaller. I click it about six times. I move all those dialog boxes to the right of the screen. And I hit Ctrl-a to Center all my viewports.

Click on the Texture Tool, click browse, type brick, select a brick texture.
Now click on the Block Tool. In the Top View viewport draw a square 200x 200. And hit Enter.
You just made that solid. Now click on the Select Tool. Now the brush you just created should be highlighted with the little white squares showing around the brush.
(see p1).
Those little white squares are called Grips. They allow you to do real-time editing. When you see the grips active, that means that brush or entity is selected. To "Deselect" an object, you can simply click on another object, or click in empty space or you can hit the ESC button.



Let's try that. Hit the Esc button. You just deselected your brush. It should look like a blue box.(see p2) Now we need to select it again. There are several ways to select an object. Let's try them all. First one is, click near the outside of the blue brush and hold the mouse button down.(see p3) drag a yellow dotted line square around your brush(see p4)


Then hit enter. As you can see your brush is now selected again.(see p1)

Hit Esc to deselect your brush. Another way to select your brush is by clicking on one of the blue lines or the little blue "x" that marks the center of your brush. Try that. That's how that works.

Select your brush. Center your brush in the Camera Viewport. You should remember how to do this from the previous lesson. Click on the "View" drop-down menu, go down to "Center 3-D views on selection" and click. Now we should see some yellow lines in the Camera Viewport.(see p5) Remember that is because we are inside of a solid object. So to see our brush correctly, we'll use the mouse wheel to scrollback. Until your viewport looks like my sample in p6.(see p6). Take your time, I'll be here all day.

Now the last method of selecting a object is by directly clicking on it in the Camera Viewport. Let's try. Hit Esc to deselect your brush. Notice the yellow outline vanished. Now to select this brush again, just click on it in your Camera Viewport. Cool. I knew you could do it. In a populated map, this method is going to be the most common method used by you to select an object.

We will practice more later. After I show you how to use the Carve Tool. It is the icon that looks like a block with one of its corners cut off. Second from the bottom. Do not click on it yet. Just know where it is, so when I tell you to click on it, you will click on it. And I won't have to wait for you.

Your Camera View should look like my example in p6 (see p6). But for our lesson on how to use the Carve Tool, we should get a better view in our Camera View viewport. Using the W. A. S. D. keys and the Arrows on your Keyboard, fly around your camera view, until your view looks like my view in the sample
(see p7). Or something near to that. Where you can see the top, and one or two of the sides it doesn't matter.

With your brush selected, click on the Carve Tool. Place your mouse above your brush in the Top View viewport(see p8).

And drag it right through the center.
(see p9). Making it go straight up-and-down just like the sample. See the blue line you created, with two grips on each end. That is the line created by the Carve Tool, it shows you where you are about to slice the brush.

(We are making the slice right down the middle of the brush. If you make your "slice line" in the wrong spot. To reset it. You have to click on the Select Tool icon. Then click on the Carve Tool icon again.)

At this point, notice half of the brush is in Red and the other half is in white. Everything that is in red will be deleted. Everything that is in white will remain.(see p10). Just so we're clear, if you were to hit Enter right now half of the brush, the half that is red, would be deleted. And the white half would remain.

You can select which side of the brush you wish to keep. Just click on the Carve Tool icon again, and notice what happens in the Top View viewport. Each time you click on the Carve Tool icon, you toggle through the different selections. You can choose to keep the right side, you can choose to keep the left side, or you can choose to keep both sides. For our example, we need to keep both sides, so keep clicking the Carve Tool icon until both sides of your brush are white(see p11). Then click Enterto carve the brush.

As you can see in the Camera Viewport your brush is now divided in two.
(see p12)(if you're slice, is not going the same direction as my slice. Don't trip. It doesn't matter. Just follow along and try and learn.) You can tell its separated by clicking on the Select Tool icon.(red arrow) Then click the left side of the brush, in the camera viewport.(see p13) as you can see only half of the brush selected. And if you click on the right side, the right side will become selected.


And the left side will automatically be deselected.


We need to have both sides selected, so we can carve them both at once. To select more than one item. You need to hold down the Ctrl key. This allows you to select multiple items. Let's select both sides of this block. Click the brush on the left side.( see p13 ) Press and hold down the Ctrl key. Then click the brush on the right side. Now both sides should be selected (see p14).

Now we are going to carve the brush again. So that there will be four pieces. The brushes that we wish to carve are selected. So now click on the Carve Tool Icon. Drag a carve line through the middle of your brush perpendicular to your first carve.(see p15). Hit Enter. You now carved your brush again. There should be a total of four pieces now. Click on your Select Tool.

In the Camera View viewport, click on the top left corner block.(see p16). And your Top View viewport should look like my example.(see p17). I will give you a little more information about the Select Tool. Now listen carefully, in the Top View viewport click on the brush that is already selected. And watch the grips change. When you first select the brush, the grips allow you to stretch. If you click on the brush, a second time the grips turn into little circles. Circle grips allow you to rotate the brush. (see p18).IFyou Click on the selected brush again. The grips change again. When the Grips are in the centers only, and not on the corners(see p19) these grips allow you to slide the block to distort it. (These grips come in handy, when creating slanted roofs)If you were to slide it it would look something like this(see p20). You can try it, just hit Ctrl-zto undo when your done, (ctrl-z = undo). So a summary of this, is that if you click on the selected brush. You change the grips. They toggle through these settings. First click = stretch, second click = rotate, third click = slide (see p21). That is what they do. You can practice that on your own. We're going to use what we've just learned in our next examples. Close this map, you do not have to save this one.

Now open your map from the last lesson. You should have saved it to your computer, like I told you to. If you did not, don't worry, you just have to go back to Lesson 1 and recreate the room. I'll wait for you here.


After you open your map, The first thing you notice, is that you can see your room in three of the viewport's but not in the Camera View. This is normal. Hammer always opens like this. We have to center the Camera View viewport by clicking on the view drop-down menu and going to "center 3-D views on selection". (You always have to do that.) when my map loaded I was facing sideways to the spawn points. Rotate your view around until you are behind them, like in my example(see p22).

Click on the back wall (I mean the wall that the spawn guys are staring at). Oops, it selected all the walls of the room.(see p23) Because this brush was made from one single brush, so all six pieces are grouped together. I need to select one wall, not all of them. So we need to turn groups off, temporarily. To do this, click on the little button that says "Ig", that stands for Ignore Groups.(see p24). The proper name is "toggle groups ignore". I'm not going to go through the trouble of calling it that. Just call it the Ignore Groups button. Click on the Ignore Groups button. When the Ignore Groups button is pressed. Hammer will ignore all grouped items. And You can select each item individually no matter which group it belongs to. I will teach you more about groups later. I Just want to teach you what you need to know now, to do what we are trying to accomplish now. To turn groups on, press the Ig button again, it should be pressed in.

Leave the Ignore Groups button pressed.(see p24) Listen carefully, I do not want to have to repeat myself. Sometimes it helps, to read things more than once. And it also helps, if you read them out loud. When you hear the words spoken, you understand them better. Then you start reading sentences. Instead of reading word by word. When you start reading sentences. You understand what you read better. Because when people speak, we speak in sentences. Not one word at a time.

With the Ignore Groups button in the down position. Click on the back wall again, in the Camera View viewport.(see p25) it should have selected only the one wall that we clicked on. That's what you need to do if you try to select something and it selects everything. Just remember the "IG" button.

Now that we have our back wall selected, we are going to create a Leak. From the Top View viewport we're going to drag the wall away from the other wall to create a gap. Select a grip that is in the middle. On the long end of the rectangle.(see p26) and drag it from 300 to about 250. (It really doesn't matter if you are exact, we just want to create a gap.) it should look like my sample p27, in the Camera View viewport.(see p27)



We're going to pretend, that we do not know that the hole is there. Let's say we finished our map and we're ready to Compile It. Click the Run Map icon.(it's the bicycle link). Click OK and compile the map.

The map will run, and play with a leak in it. And on a simple map like this, the problems are not as obvious as they will be when your map is full of stuff. A leak will cause your water not to show up when you compile your map. A leak will increase your compile time. A completed DOD map, might take in hour to compile. That same map with a leak might take 12 to 18 hours to compile, while Hammer tries to figure out where the inside of the map is and where the outside of the map is. Also leaks cause Lag.


Now back to our map. The leak in our map is very obvious. But when you start making real complicated maps. Leaks are not going to be to easy to spot. So what can you do to find your leaks? Lucky for you, Hammer has a tool we can use to find the leaks.
We have to load what is called a pointfile. Pointfiles are saved as .lin files, and they have the same name as your map except they end in .lin To load your point file click on the drop-down menu called Map.(see p28) Go down to where it says load point file and click on it. This is important for you to know. If you have a leak you see a msgbox(see p29). If you do not have a leak you will see a dialog box.(see p30). Since we see the MessageBox and not a dialog box that means we have a leak. And we should click yes to load the pointfile.


Loading the pointfile tells Hammer to draw a red line to show you where the leak is. And it draws this line in all the viewport's. Follow the red line until you see where it escapes from the inside of your map to the outside. Then you need to close that gap. So click on the Select Tool and select that wall that is too short. Using the grips, close that gap in the walls by dragging it from 250 units back to 300 units. (see p31)(note: if you can't get it to go back to exactly 300 it may be that your grid is too large and you should click on the icon to make the grid smaller, like I told you to do, in the first place .)

Now that we fixed our leak. We can unload the point file. Click on the Map drop-down menu, go to unload point file, and click it. Now that the point file is unloaded, we need to test our map again. So hit the run map icon. And compile the map.


Then go back to Hammer. And load the pointfile again. Click on Map. Then "load point file". If you still have a leak, (because in a large map there can be more than one leak.) Hammer can only show you one leak at a time. So if you have a leak. And your trying to fix it. After every time you compile your map you should load the pointfile. Fix the leak. Unload the point file.Compile the map. Load point file. Fix leak. Unload point file. Compile the map.......


Just keep doing that until there are no more leaks to load. If there are no leaks in your map, you will see a dialog box(see p30). You can just click cancel. If there are no pointfiles to load, then there are no leaks in your map. It does not hurt to check for leaks after you compile your map. A simple room like the one we created should not have any leaks. You only need to really check for leaks when you cut into a wall that is part of the box that contains your map. Or like if you expand your map. Like we're going to do today.

If you like you can take a break. You do not want to overload your brain. Check out the Music Break Room and listen to some music while you make maps.



Are you ready to get started now? Did you stretch your legs? Good. Let's start by adding a second room.

Continue on to the next lesson.