Creating A Construction Pack

The following is a guide for creating a new, custom Construction Pack with the Hurtworld SDK.

If you haven't installed and set up the Hurtworld SDK, see Installing the Hurtworld SDK.

We're going to be working with the sample project that is distributed with the SDK, the Statue Pack. You can find this already set up and ready to go in the SDK. Feel free to cannibalize this project for your own purposes. However, for your first pack, it's recommended that you make a new project and work through these steps to gain a proper understanding of the process.

Getting Started
The first thing we're going to need to do is make a place in the SDK for your pack to go. Make a folder with your projects name in the root Assets directory. It's highly recommended that you try to keep the assets for a pack inside this folder.

You need to create a HurtworldModConfiguration asset within this folder, so the SDK knows that this is a mod. Do this by right clicking in the folder in the Project view, and selecting Create > Hurtworld Mod Configuration. This configuration object tells Steam Workshop things like what ID this pack is, what it's called, and what its icon is. It also contains some information needed by the game to successfully load the pack, such as custom attachment point types, which we'll cover later. Think of this asset as the root of your pack. Any attachments that you make must be in the same folder, or a subfolder, of this asset.

Creating a Custom Construction Attachment
It's recommended, and much faster, to take an existing, similar construction attachment and cannibalize it if possible. However, it's also possible to create one from scratch, and this is what we'll do now. We'll create a nice little base for our statues to sit on.

First, create a new prefab. Name it something distinct and unlikely to conflict with other mods! The default pack uses the naming convention {Category}{Subcategory}{Size}{Material}Constructed, but you can call them anything you want. We'll call ours "ShigiStatueConcreteConstructed". Make sure that this prefab is in the same folder, or a subfolder, of your HurtworldConstructionWorkshopConfiguration. This object, and all it's children, need to be on the Constructions layer.

Setting up the Mesh and Material
Now, let's add the mesh and collider we want to make up this attachment. Create a new GameObject as a child of ShigiStatueConcreteConstructed. Let's call it something like "Mesh". You'll want to add a MeshFilter component, a MeshCollider and a MeshRenderer. Set the MeshFilter Mesh to the desired mesh - in this case, a mesh called "StatuePodium". Set the MeshCollider Mesh to the mesh you want to use as the collider. In this case, we can use the same mesh as the Renderer, but often you'll want to put a simpler mesh here for performance. Finally, set the material on the MeshRenderer to your desired material. Whenever possible, try to make your construction attachments use the same material. You can do this by creating texture atlases. When attachments use the same material, they can be combined into the same mesh when placed. This means we can render structures faster.

Adding a Construction Attachment Component
Now add a ConstructionAttachment component to the object. You'll be presented with the Construction Attachment Editor. See that article for an in-depth explanation of all the editor. For now, we're going to go through the bare minimum to set up the attachment.

Setting Up the Construction Attachment
The red warning at the top of the editor will tell you when something is missing from the attachment, and what needs to be done. Let's work through the errors it shows.

It should be complaining about having no local attachment points defined. To fix this, go to the Local Points tab, and press the '+' button to add a new local attachment point. You can think of this as the origin of your attachment. It can have a position and rotation.

Now, we get an error saying we don't have a visualization mesh. We need to tell the attachment what mesh to use when displaying the green/red build mesh. To set this value, go to the Placement tab, then the Visualization category. Let's set the mesh to the file called "StatuePodium", same as our renderer. Remember to set the scale on the visualisation mesh - we can just set it to (1,1,1) in this case.

We now get a message about having no Construction Volumes defined. An attachment must have at least 1 build volume. This is generally a volume that is slightly smaller than the attachment itself, and doesn't go into any of the area that you want to be able to overlap other attachments. You can add multiple construction volumes at any size, position and rotation. A construction volume cannot have zero size, and you may get another error about this if you don't set the extents to some value.

Every construction attachment needs exactly one removal point, so it can be removed by players. It's strongly advised that the removal point be within a construction volume. Removal points cannot overlap. Consider this very carefully when adding a removal point to an object. Add a removal point by going to the Attachment Points tab, clicking the `+` button, and setting the Type to Removal Point.

You should now be error free! If not, solve the issue described by the error. A Construction Pack will fail to build if a Construction Attachment within it has an error.

Configure the properties in the rest of the editor to your liking. See Construction Attachment Editor for a detailed explanation of each setting.

Uploading your Construction Pack
See Uploading an Item to Steam Workshop