S&box Wiki

Revision Difference

Creating_your_first_gm_flatgrass#529780

<cat>Dev.Map</cat> <title>Creating your first gm_flatgrass</title> The purpose of this guide is to jump into Hammer and start creating something, in this case, we will be recreating **`gm_flatgrass`** step-by-step. For more documentation and tutorials on Source 2 mapping, refer to the [Mapping Resources Page](https://wiki.facepunch.com/sbox/Mapping_Resources). *`Note: This guide uses the version of Hammer that is included in Half-Life: Alyx`* # Knowing your tools **'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*. ## Selection Modes <upload src="314/8d90a75e4575d36.png" size="43404" 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/8d90be4e1c525d8.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/8d90be8fbb1d066.png) | **Move Tool ( <key>T</key> )** | Move your selection along the X Y Z axes. | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf38cd1aab3.png) | **Rotate Tool ( <key>R</key> )** | Rotate your selection along the X Y Z axes. | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf3d2aa7e80.png) | **Entity Tool ( <key>⇧ SHIFT</key> + <key>E</key> )** | Place any type of point entity such as: player spawns, AI spaws, logic entities, props | | ![](https://files.facepunch.com/wiki/files/1a832/8d90bf3e5dfcf7b.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/8d90bf3ffb2d8f6.png) | **Clipping Tool ( <key>⇧ SHIFT</key> + <key>X</key> )** | Slice geometry, cuts must be made in the 2D viewport and confirmed with **ENTER.** | See also: https://files.facepunch.com/wiki/files/314/8d90a83c8940111.png | ![](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 point entity such as: player spawns, AI spaws, logic entities, props | | ![](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.** | 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. <upload src="314/8d90a86169ab3d9.png" size="359908" name="Remaining Stuff.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 run your map, use Fast Compile while working. * **2D Viewport**: Shows an [orthographic](https://en.wikipedia.org/wiki/Orthographic_projection) view of the map from any direction. You can shift views by pressing Top ( <key>F2</key> ), Front ( <key>F3</key> ), Side ( <key>F4</key> ) * **Assets Window**: Props, Materials, Prefabs etc... You can drag and drop from the **Asset Browser** that opens when running the workshop tools as well. * **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. <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, make a plane that is *2048x2048* units. The bigger your map is, the longer compiling takes, so for now we'll keep it small and enlarge it when we're ready to finalize. <upload src="314/8d90a8c729cf228.png" size="910081" name="image.png" /> You can use the **Object Properties** to center the plane in **X: 0; Y: 0** ## 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> ) <upload src="314/8d90a8d6cba4512.png" size="447667" name="image.png" /> ### Step 2.5: Slap a grass texture on the plane and do a **Fast Compile**, if all you wanted was a literal flatgrass then you have finished the tutorial. ## 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. <upload src="314/8d90a8ed3e90fc7.png" size="825083" name="image.png" /> ## Step 4: With the **Clipping Tool** ( <key>SHIFT</key> + <key>X</key> ) and working in the **2D Viewport**, slice the cylinder in half by pressing <key>ENTER</key> to confirm, then slice in quarters. <upload src="314/8d90a8f8be3894c.png" size="951295" name="image.png" /> In the **Object Editing** window remember to have the third **Keep Mode** selected. ## 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="314/8d90a90de6709c7.png" size="937315" name="image.png" /> ## Step 6: 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="314/8d90b45017a071b.png" size="735207" name="image.png" /> After you have all the edges selected like in the picture **Bridge** ( <key>ALT</key> + <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="314/8d90b46ca27add8.png" size="612829" name="image.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. <upload src="314/8d90b485e82e33f.png" size="817666" name="image.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="314/8d90b4971bbda77.png" size="525063" name="image.png" /> We will be using these clones to create the concrete slabs that separates 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. I suggest changing the **Grid**'s *size* to a smaller value like *16*. <upload src="314/8d90b4d85c8d299.png" size="1203441" name="image.png" /> Using the **2D Viewport** to help, place the slabs on top of the bottom foundations with the **Move Tool** ( <key>T</key> ). While selecting one slab at a time, slightly make them larger on each side to create an overhang. ## 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="314/8d90b5013dd1030.png" size="931565" name="image.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 *160* units). <upload src="314/8d90b50ff6d063f.png" size="986081" name="image.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="314/8d90b51e4f0c814.png" size="814787" name="image.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="314/8d90b526a33429a.png" size="660015" name="image.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="314/8d90b52b84d46b3.png" size="880122" name="image.png" /> You might want to lower the **Grid**'s *size* for this, I've used *8*. ## Step 16: In **Edges Selection Mode** ( <key>2</key> ), select the arc's top opposing edges and **Bridge** ( <key>ALT</key> + <key>B</key> ) them. <upload src="314/8d90b53c571469f.png" size="805954" name="image.png" /> ## Step 17: In **Edges Selection Mode** ( <key>2</key> ), select the top foundation's upper edges and **Bridge** ( <key>ALT</key> + <key>B</key> ) them together. <upload src="314/8d90b549e447080.png" size="1050769" name="image.png" /> In **Objects Selection Mode** (<key>5</key> ), select the top foundation and the two 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="314/8d90b55825e1fc7.png" size="1061881" name="image.png" /> **Fill Hole** ( <key>P</key> ) to create the missing face and repeat on the other side. ## Step 19: Duplicate the first two concrete slabs with the **Move Tool** ( <key>T</key) in **Objects Selection Mode** ( <key>5</key> ) and place them on the top brick foundation. <upload src="314/8d90b562f501e87.png" size="943464" name="image.png" /> Select the two inner faces in **Faces Selection Mode** ( <key>3</key> ) and **Delete** ( <key>DEL</key> ) them, then select all edges of the missing face in **Edges Selection Mode** ( <key>2</key> ) and **Bridge** ( <key>ALT</key> + <key>B</key> ) them together. ## Step 20: Drag some textures from the **Assets Browser**, resize the grass plane and do a **Fast Compile** to check out your map! <upload src="314/8d90b56ca352240.png" size="693373" name="image.png" /> # Result <upload src="314/8d90b56d0f8bd29.png" size="1204355" name="image.png" /> This may look like a discount **`gm_flatgrass`** but what you learned here were the very basics to Hammer.