S&box Wiki

Revision Difference

Creating_your_first_gm_flatgrass#563046

<cat>Hammer.Intro</cat> <title>Making Your First Map</title> # Introduction Before doing anything check here first; [Getting Started With Hammer](https://wiki.facepunch.com/sbox/GettingStartedWithHammer) The purpose of this guide is to jump into Hammer and start making something, in this case, we will be remaking **`gm_flatgrass`** step-by-step. For more documentation and tutorials on Source 2 mapping, refer to the [Mapping Resources Page](Mapping_Resources). # Knowing your tools If you plan on uploading your map, Create your map by following [Getting Started With Hammer](https://wiki.facepunch.com/sbox/GettingStartedWithHammer) OR **'File' > 'New'** ( <key>CTRL</key> + <key>N</key> ) to open a new map and then **'File' > 'Save'** ( <key>CTRL</key> + <key>S</key> ) to save as *gm_flatgrass*. *(This may cause compiler to complain that the vmap is not inside one of your created addons.)* ## Selection Modes <upload src="b3f81/8dc3350c57440f5.png" size="15462" name="image.png" /> From left to right we will be using the following modes: **Edges** ( <key>2</key> ), **Faces** ( <key>3</key> ), **Objects** ( <key>5</key> ) <upload src="314/8d90a7fff4f08da.gif" size="820392" name="CubeExample.gif" /> These three selection modes are the bare minimum to create this map, you can switch between them by pressing the number keys that represent their position. After picking the **Selection Mode**, you may also choose which **Tool** to interact with. ## Tools You can find tools on the left side, in this guide we will use the following: | Icon | Tool | Description | |:-------------:|:-------------:|:-------------:| | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf5906f9260.png) | **Selection Tool ( <key>⇧ SHIFT</key> + <key>S</key> )** | Select geometry elements, objects and groups. You can also use this to resize them. | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf60b4a1a43.png) | **Move Tool ( <key>T</key> )** | Move your selection along the X Y Z axes. | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf663711719.png) | **Rotate Tool ( <key>R</key> )** | Rotate your selection along the X Y Z axes. | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf680080886.png) | **Entity Tool ( <key>⇧ SHIFT</key> + <key>E</key> )** | Place any type of remaining entity such as: player spawns and lights. | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf68fed02fc.png) | **Block Tool ( <key>⇧ SHIFT</key> + <key>B</key> )** | Create basic geometric shapes such as: Quad, Block, Cylinder, Spike, Sphere | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf6a5855e18.png) | **Clipping Tool ( <key>⇧ SHIFT</key> + <key>X</key> )** | Slice geometry, cuts must be made in the 2D viewport and confirmed with **ENTER.** | <warning> As of the Scene System update, the Entity Tool has become mostly obsolete, however, most of the remaining Entities are converted to Prefabs upon loading them with a Map Instance Component </warning> See also: https://files.facepunch.com/wiki/files/314/8d90a83c8940111.png⤶ ⤶ ⤶ ## All of the rest Crash course on everything else we will be using on this guide and a short description. I suggest you look at [this video tutorial](https://www.youtube.com/watch?v=HrfsfgYpYN0) to help with the layout. (This video uses Half-Life: Alyx's Hammer, however, most of this should still apply.) <upload src="b3f81/8dc3353f4ee429d.png" size="552979" name="image.png" /> * **Object Editing**: Depending on the **Tool** and your **Selection Mode**, this section will have different options to interact and modify the selected geometry. * **Compile & Play**: Opens the compile tool to compile your map, it's recommended to use Fast Compile while working. * **Assets Window**: Props, Materials, Prefabs etc... Thanks to Asset.Party intergration, you're able to drag and drop almost anything in the `Cloud > Everything` category directly into your map! * **Object Properties**: While having an object or **point entity** selected you can modify its scale, position, rotation, and any properties it might have. * **Grid Settings**: When moving or resizing an object, it will snap to the smallest amount of units you have selected. Most of the time we will use **64**, **32**, **16**, and **8** units. * **Active Material**: This displays your currently selected material, pressing <key>Shift</key>+<key>T</key> will apply the texture to any Object or Face currently selected * **Outliner**: As you map, this will fill up with everything you've created, such as meshes. <key>W</key> <key>A</key> <key>S</key> <key>D</key> to move the camera in the viewports, <key>Scroll</key> to Zoom-in/out and hold <key>Right-Click</key> to rotate. --- # Making the Map, Step-by-Step ## Step 1: With the **Block Tool** ( <key>SHIFT</key> + <key>B</key> ), select **Quad** in the **Object Editing** window. <upload src="b3f81/8dc335525d09c20.png" size="23658" name="sbox-dev_aIlFHArpju.png" /> <upload src="b3f81/8dd195923a55976.png" size="12738" name="image.png" /> Then, make a plane that is *2048x2048* units. The bigger your map is, the longer compiling takes, so for now we'll keep it small for the purposes of this guide. <upload src="b3f81/8dc3355cb6dd631.png" size="649470" name="sbox-dev_2kHYiaXAnF.png" /> <note>Those red lines can help you with units, for example, if you create a mesh within a red line box, that will always be *1024x1024* units, therefore creating a mesh within 4 of those would be *2048x2048*!</note> You can use the **Object Properties** to center the plane to **X: 0; Y: 0** by clicking the `+` next to `Transform` <upload src="b3f81/8dc3355eed4887d.png" size="11145" name="sbox-dev_fSJNR9ujSu.png" /> ## Step 2: With the **Entity Tool** ( <key>SHIFT</key> + <key>E</key> ) selected, from the **Object Editing** window place the **Player Start**, **Sky**, and **Environment Light**. Make sure to rotate the light having the arrow face down using the **Rotate Tool** ( <key>R</key> ) and to give the **Sky** Entity a Sky Material in the **Object Properties** by clicking the Magnifying Glass. <upload src="b3f81/8dc33647dd1f0bd.png" size="23091" name="image.png" /> Let's use light_test_sky_overcast. <note> For the rest of the guide I have my Skybox turned off for clarity.</note> <upload src="b3f81/8dc33563f8ad08d.png" size="739903" name="sbox-dev_5ewN7ZXJ2X.png" /> ### Step 2.5: Enter Face Mode ( <key>3</key> ) and select a grass material from the Asset Browser by clicking `Everything` underneath `Special`, we can then filter it by clicking the triangle bars next to the search bar, then finally, type the material you want to use, in this case let's type "Grass" and double click `terrain_grass`. Next, Select the face and apply the material. ( <key>SHIFT</key> + <key>T</key> ) Then do a **Fast Compile**. From here, you're free to compile and test your map by using the methods listed in [Getting Started With Hammer](https://wiki.facepunch.com/sbox/GettingStartedWithHammer). ## Step 3: With the **Block Tool** ( <key>SHIFT</key> + <key>B</key> ), select **Cylinder** in the **Object Editing** window, make a cylinder that is *512x512* units and has *64* sides, place it in the center. This newly created mesh will use the Active Material, which in our case is terrain_grass. Let's change it back to the default for now. Shrimply type in "reflectivity_30" in the search bar. <upload src="b3f81/8dc335749c116f5.png" size="2054202" name="sbox-dev_MdLeEb9UOc.png" /> ## Step 4: With the **Clipping Tool** ( <key>SHIFT</key> + <key>X</key> ), let's swap to our 2D Top-Down Viewport ( <key>F2</key> ), slice the cylinder in half by pressing <key>ENTER</key> to confirm, then slice in quarters. In the **Object Editing** window remember to have the "Keep Both" (Third Option) **Keep Mode** selected. <note> Make sure to have the cylinder selected, or it won't slice! </note> <upload src="b3f81/8dc3357e1906dbb.png" size="190590" name="sbox-dev_R3k6Bdsg0a.png" /> ## Step 5: While in **Objects Selection Mode** ( <key>5</key> ) use the **Move Tool** ( <key>T</key> ) to separate the sections an equal distance from each other. <upload src="b3f81/8dc3358183ea478.png" size="258598" name="sbox-dev_mji6YIEcTT.png" /> ## Step 6: Let's swap back to our 3D View by pressing <key>F5</key> (You can do most things in 3D View, but experienced mappers will use both modes to their strengths.) While in **Edges Selection Mode** ( <key>2</key> ) use the **Selection Tool** ( <key>SHIFT</key> + <key>S</key> ) to select all the edges on the side which is missing a face of two opposite sections. To select multiple edges at once you can hold <key>SHIFT</key> while clicking on the edges. <upload src="b3f81/8dc335892ca798e.png" size="1911754" name="sbox-dev_TQzjSRWZgX.png" /> After you have all the edges selected like in the picture **Bridge** ( <key>B</key> ) them and, through the **Object Editing** window, select only *1* Step (Only 1 straight face will be generated) then press <key>ENTER</key> to confirm. Repeat on the other side. ## Step 7: Select the edges of the remaining faceless side by either **Double Clicking** or **Select Loop** ( <key>L</key> ) in the **Object Editing** window after selecting one of the edges. <upload src="b3f81/8dc3358bd275fd7.png" size="1653130" name="sbox-dev_4KinUQophj.png" /> **Fill Hole** ( <key>P</key> ) to cover the face, repeat on the other side. ## Step 8: While in **Objects Selection Mode** ( <key>5</key> ) select both foundations and use the **Selection Tool** ( <key>SHIFT</key> + <key>S</key> ) to make them taller by dragging the arrow facing upwards. Let's make them *192* units tall. <upload src="b3f81/8dc3358f0bcdb53.png" size="1636949" name="sbox-dev_tyPJkdtgQ7.png" /> ## Step 9: Using the **Move Tool** ( <key>T</key> ) and while holding <key>SHIFT</key>, move both foundations up to clone them. <upload src="b3f81/8dc33590490c2ff.png" size="1418341" name="sbox-dev_l1pW3Qf3nr.png" /> We will be using these clones to create the concrete slabs that separate the two foundations. ## Step 10: While in **Objects Selection Mode** ( <key>5</key> ) select both slabs and use the **Selection Tool** ( <key>SHIFT</key> + <key>S</key> ) to make them **shorter** by dragging the arrow facing downwards, let's do *16* units tall. Oh wait, our grid size doesn't let us do that, fortunately using <key>[</key> we can decrease the Grid Size shown at the bottom right. Now we're able to make the slabs that short. <note> It's advised to stay within a Grid Size of 2 or higher until you have a better idea of what you're doing. </note> <upload src="b3f81/8dc3359a323f675.png" size="1440821" name="sbox-dev_XrcCQXdRv9.png" /> Let's use the Front 2D Viewport ( <key>F3</key> ) to help us position, place the slabs on top of the bottom foundations with the **Move Tool** ( <key>T</key> ). <upload src="b3f81/8dc3359cee814f0.png" size="396955" name="sbox-dev_vj21g4zNPz.png" /> While selecting *one slab at a time*, make them slightly larger by about a single Grid Snap per side (Assuming you're still on a Grid Size of 16) to create an overhang. I recommend using the Top-Down 2D Viewport ( <key>F2</key> ) for this. ## Step 11: Using the **Move Tool** ( <key>T</key> ) and while holding <key>SHIFT</key>, move the bottom foundations up to clone them. Resize these new top foundations one-by-one to make them shorter and just a bit thinner on each side to accentuate the concrete slab's overhang. <upload src="b3f81/8dc335b140b847f.png" size="1617258" name="sbox-dev_FF0NToZ1gD.png" /> While in **Faces Selection Mode** ( <key>3</key> ) select the inner 2 faces of the top foundations and **Delete** ( <key>DEL</key> ) them. These brick foundations will have a wide arch that connects them. ## Step 12: With the **Block Tool** ( <key>SHIFT</key> + <key>B</key> ), create a cylinder with 32 faces that is as wide as the top foundation's height (In my case they are *192* units). <upload src="b3f81/8dc335ba27e4c36.png" size="1254032" name="sbox-dev_b8983zHVm2.png" /> With the help of the **2D Viewport**, **Rotate** ( <key>R</key> ) the cylinder 90° and place it exactly in the center of the two top foundations. Using the **Selection Tool** ( <key>SHIFT</key> + <key>S</key> ) resize the cylinder to be exactly as deep as the top foundations. ## Step 13: While using the **2D Viewport** and the **Faces Selection Mode** ( <key>3</key> ), select the bottom half of the cylinder and **Delete** ( <key>DEL</key> ) it. <upload src="b3f81/8dc335bfd39bb89.png" size="1015371" name="sbox-dev_ghu0NyBTD6.png" /> **Delete** ( <key>DEL</key> ) the front and back faces as well. ## Step 14: While in **Objects Selection Mode** ( <key>5</key> ) select the half cylinder **Flip Faces** ( <key>F</key> ). <upload src="b3f81/8dc335c1ed21605.png" size="862885" name="sbox-dev_qEpiPJZUiJ.png" /> ## Step 15: Using the **Clipping Tool** ( <key>SHIFT</key> + <key>X</key> ), cut the object in half and with the help of the **2D Viewport** **Move** ( <key>T</key> ) them close to the top foundations and on the concrete slabs just like in the picture. <upload src="b3f81/8dc335c80572abf.png" size="958839" name="sbox-dev_nYetmF2bNu.png" /> I once again recommend a **Grid** *size* of 16 for this. ## Step 16: In **Edges Selection Mode** ( <key>2</key> ), select the arc's top opposing edges and **Interpolated Bridge** ( <key>ALT</key> + <key>B</key> ) them. To keep Mesh Complexity down, let's use a step count of 5. <upload src="b3f81/8dc335cd6a3d991.png" size="933170" name="sbox-dev_SvvcHxUHQQ.png" /> ## Step 17: In **Edges Selection Mode** ( <key>2</key> ), select the top foundation's upper edges and **Bridge** ( <key>B</key> ) them together. <upload src="b3f81/8dc335d05be8841.png" size="1330136" name="sbox-dev_G1UoPESoRQ.png" /> In **Objects Selection Mode** ( <key>5</key> ), select the top foundation and the arcs and **Merge** ( <key>M</key> ) the meshes together. (**Reminder:** Hold <key>SHIFT</key> to select multiple objects) ## Step 18: While in **Edges Selection Mode**, select one of the edges belonging to the missing face and **Select Loop** ( <key>L</key> ) or **Double-Click** to include all of them. <upload src="b3f81/8dc335d6e39b9b6.png" size="985620" name="sbox-dev_mGK2IHdUvS.png" /> **Fill Hole** ( <key>P</key> ) to create the missing face and repeat on the other side. <warning> This creates what's known as an N-Gon, normally, this is BAD! However, Source 2 is really awesome and handles this for us. While it's technically bad practice, there's no real reason to worry. However, if you're looking for a way to fix this, simply connect each vert of the arch to the top left vert of "arch face" by using Verticies mode and Connect them ( <key>V</key> ) <upload src="b3f81/8dc33602c998861.png" size="716439" name="image.png" /> </warning> ## Step 19: Let's give the top a bit of an overhang aswell. First, head into face mode and select every top face. Then, in Resize ( <key>E</key> ) hold <key>Shift</key> and drag the red box out a grid snap (16 Units), then let go and do the same for the green box. Now, go into Transform and once again hold <key>Shift</key> and in drag it upwards a grid snap (16 Units). <upload src="b3f81/8dc3361a22dc95b.png" size="893817" name="sbox-dev_hynp2eUoY0.png" /> ## Step 20: I'm sure you're thinking "this is looking a bit strange", and you're right! It does seem a bit small doesn't it? Mistakes will happen, this is natural, but let's not delete the entire thing, we can fix it pretty easy. Select all the meshes in Objects Mode <key>5</key> and then using Select we can just drag it out. Let's use a **Grid** *size* of *256* here and drag each side out by a grid snap. Now, let's go back down to a **Grid* *size* of *64* and drag it down one grid snap. Our new width and length should be *1024x1024*. <upload src="b3f81/8dc3363e6027a33.png" size="1027585" name="sbox-dev_Y9h8GpeCp8.png" /> Not so strange anymore is it? And you didn't even have to redo the tutorial! ## Step 21: Beautiful! Let's publish i- Not so fast s&bro. We're forgetting some materials. Let's grab a Brick and Concrete texture from the Asset Browser, and apply them. Let's use brick_wall_b for our "Pillars" and concrete_damaged for our "Slabs". In **Face Mode** <key>3</key> select all of the relevant faces then apply the material using <key>Shift</key>+<key>T</key>. <upload src="b3f81/8dc3363c2b75bd6.png" size="1475288" name="sbox-dev_tbNUbWonC1.png" /> Now we can do a Fast Compile and check out the map using one of the methods listed in [Getting Started With Hammer](https://wiki.facepunch.com/sbox/GettingStartedWithHammer). <note>If you are getting an error regarding "(map path) is outside of the directory required for game content:" see; [Getting Started With Hammer](https://wiki.facepunch.com/sbox/GettingStartedWithHammer)</note> <note>If you are on a PC with a CPU that has efficiency Cores Windows sometimes tries to use only Efficiency cores for compiling. To fix this go into your Task Manager>Details select sandbox_dev and vrad3 rightclick>Set Affinity and select all CPU cores except the efficiency cores (usually the last ones are your efficiency Cores).</note> # Result <upload src="b3f81/8dc3364e3ab147c.png" size="2664999" name="sbox-dev_4Rlt4qogKd.png" /> Flatgrass may have seen better days, but this knowledge should help you get started in your mapping journey. For even more great information, I (personally) recommend Eagle One's Hammer Crash Course in [Mapping Resources](https://wiki.facepunch.com/sbox/Mapping_Resources).