S&box Wiki

Revision Difference

GettingStartedWithHammer#560938

<cat>Hammer.Intro</cat> <title>Getting Started With Hammer</title> <deprecated></deprecated>⤶ # Getting Started ⤶ ## Creating a content project ⤶ Before you can do anything, you will need to make a project which will contain your map file(s), and any other custom assets you will want to use for your map. If you already have a project, you can skip this part. A project can have multiple maps in it.⤶ ⤶ Start by going to the Projects tab and pressing the `+` button, then selecting `Create a new project...`⤶ <upload src="70c/8db84579290e9d7.png" size="19634" name="image.png" /> ⤶ Once you have done that a window will pop up with some options, select `Empty` content project and fill in the rest as you see fit, namely the project name and location.⤶ <upload src="70c/8db8471ccda5b89.png" size="24068" name="image.png" />⤶ ⤶ Press Create and you now have a content project ready for use.⤶ ⤶ ⤶ ⤶ ## Setting Up⤶ ⤶ Before you can start mapping, you'll need to have a Project setup, if you don't have one you can make one by opening s&box in Editor Mode and clicking "New Project", The Minimal template will be fine for the purpose of creating and loading a map. ⤶ <upload src="b3f81/8dc33228980a8f9.png" size="69785" name="image.png" /> ## Creating a new map Once you have a project created, you can navigate to it using the Asset Browser and then create your first map file. Select your project from the project list in the Asset Browser, right click on any empty space in the Asset List and select `New Asset...` then `Map`: <upload src="70c/8db8471e5059429.png" size="44413" name="image.png" /> A popup will show up asking for a name, and save location. You will want to create a new folder called `maps/`, open it, give the map a name, and save it. ⤶ <note>Your map **must** be within the maps/ folder, or it will fail to load in-game when testing.</note>⤶ ⤶ The game will create a sample map file for you with some basic entities pre-placed to get you started.⤶ ⤶ The game will create a sample map file for you with some basic mesh and some info_players to get you started! ⤶ You can now open and edit your new map. <upload src="70c/8db84740a83f540.png" size="31789" name="image.png" /> ## First steps to run the map in-game⤶ ⤶ You can open your map in the Hammer editor by double clicking the map asset in the Asset Browser. You can also right click for more options, such as quickly loading a compiled version of the map in-game.⤶ ⤶ Ah yes. Before you can load your map in-game it must be first compiled. To do this press the "Run Map" button in the toolbar, or simply press <key>F9</key> when your map is open in Hammer. ⤶ ⤶ <upload src="70c/8db8473cbdbc96f.png" size="21120" name="image.png" /> ⤶ This will open map compilation dialog. You can also open this window using `File` > `Build Map...` option the Hammer Editor's toolbar. ⤶ <upload src="70c/8db8473f1b5317d.png" size="25147" name="image.png" /> ⤶ Select `Fast Compile` and `Load in engine after build` and press `Build`.⤶ ⤶ This will quickly compile your map and load it in-game using your currently selected gamemode.⤶ ⤶ And that's it! You have made your first map and loaded it in-game. You can now start [learning to use the Hammer Editor](Mapping_Resources) and create your very own map! Just keep in mind that you will need to compile the map to see changes in-game.⤶ ## Compiling your map⤶ ⤶ ⤶ On your quest to running your map in-game, you'll want to compile it, this can be done by pressing the Hotkey <key>F9</key>, alternatively you can find the button to compile the map here:⤶ <upload src="b3f81/8dc3323a9da96e3.png" size="21120" name="8db8473cbdbc96f.png" /> ⤶ For the purpose of getting your map up and running, we'll be using `Fast Compile`. ⤶ Once compiled, you should be given a horribly contrasted green banner of Sweet Success! <upload src="b3f81/8dc332406356863.png" size="3053" name="sbox-dev_xRJ39v8pgL.png" /> ⤶ ⤶ ## Running your map In-Game⤶ ⤶ <note> If you're a Entity System Veteran checking out s&box today, running a map in-game is not as simple as it used to be, read carefully! </note>⤶ ⤶ Below are two methods you can use to check out your map In-Game, choose which works best for you, don't worry, neither require programming knowledge! ⤶ ⤶ ⤶ ## Method 1 : Running the map through a Map Instance Component⤶ ⤶ This method is valuable if you're planning on using your map in a game.⤶ To start, let's leave hammer for a minute and head back over to our Editor. ⤶ <upload src="b3f81/8dc33256507ebe3.png" size="1162499" name="sbox-dev_vb52AAXpwL.png" />⤶ First, you'll want to create a new GameObject, this can be done by simply right clicking in the hierachy and clicking "Create Empty". ⤶ <upload src="b3f81/8dc332599c554b4.png" size="13202" name="sbox-dev_InaSfWozRj.png" />⤶ ⤶ Now, click on your newly created GameObject, let's give it a by pressing <key>F2</key> and call it `Map Instance`.⤶ Next, head to your Inspector, by default this is underneath your hierarchy. Click `New Component`, and in the Search Bar type `Map Instance` ⤶ <upload src="b3f81/8dc33260222250a.png" size="19942" name="sbox-dev_XeP9DBx2op.png" />⤶ ⤶ Now, all you need to do is type your map's directory in the `Map Name` field, in our case, it should be `maps/my_map.vmap`, if you named your map something else, shrimply replace the "my_map" with your map's name. ⤶ <note> In some cases, you may need to close and reopen your editor, remember to save! </note>⤶ ⤶ Congrats! Your map is now loaded! ⤶ ⤶ ⤶ ## Method 2 : Running the map through Walker/Scenebox ⤶ ⤶ <note> This Method requires your map to be Released on Asset.Party, aswell as it being re-uploaded to Asset.Party anytime you make a change. </note> ⤶ ⤶ This method is valuable if you're just wanting to test your map using a basic FPS controller. ⤶ ⤶ To start, let's leave hammer and return to our Editor. We'll want to publish our project to Asset.Party first by following [this guide](UploadingAssets)⤶ ⤶ After your map is uploaded make sure it's set to Released.⤶ <upload src="b3f81/8dc3326f744afaa.png" size="10457" name="firefox_C1p37a1TLq.png" />⤶ ⤶ Then, open s&box in normal Game Mode, and open either "Walker" (For a barebones First Person Controller.) or "Scenebox" (For a more Sandbox like experience.)⤶ <upload src="b3f81/8dc3327f070e0b0.png" size="274522" name="sbox_W9k27zaJyd.png" />⤶ ⤶ You should be able to find your map by typing in it's name, and you'll be good to go!⤶ ⤶ ⤶ ⤶ ⤶ ## What's next? Once you are happy with how your map looks and plays, you can publish it to asset.party, for other players to play on. ⤶ Before uploading your map you will want to perform `Full Compile` or `Final Compile` build of the map. This will be much slower, but will result in best quality for lighting. ⤶ You can then [upload your map to asset.party by following this guide](UploadingAssets). Once your map feels complete to you. Let's do a Final Compile before uploading to Asset.Party (Or re-uploading if you've followed Method 2) ⤶ Back in the Compile Window, you'll have the option of a `Final` or `Full Compile`. Final Compile offers the best visual quality, however the compile time will be longer than a Full Compile.⤶ If you aren't completely certain about your map, it's best to do a Full Compile first to see how things will generally look, and do one last pass for any mistakes.⤶ <upload src="b3f81/8dc3328a3fde017.png" size="10582" name="sbox-dev_HZaNYDvsT4.png" />⤶ <note> Advanced Users may find Custom Settings useful for increasing the Lightmap quality all the way up to 8k, aswell as using the `Use all available CPU threads` setting for a faster compile time.</note>⤶ ⤶ Assuming everything looks good to you, Upload (or re-upload) your map using this guide!⤶ You can then [upload your map to asset.party by following this guide](UploadingAssets).