Creating your first building mod¶
This guide is authored by Voxel Tycoon community member scailman
This guide tries to show the basic steps to create a mod that adds new buildings in the city generation in Voxel Tycoon (as per
The guide is not intended to teach you modeling, so you must have a basic understanding of 3DS Max, Blender, Wings 3D, or any other program you want to use that allows you to import and export
As in all games, there are certain recommendations that must be followed when creating a 3d model.
- The size of the building should not exceed 5x5x10m.
- The model must have the minimum details that make it recognizable but without overloading the model.
- The colors have to be pastel colors so that match the same style as the rest of the buildings in the game.
- Use dark tones for windows. I recommend the value
#272727 (RGB 39,39,39).
Basic concepts when modeling a building¶
When starting the creation of a building, it is a good idea to think about what type of building we want to represent and what size it will have. A good recommendation is to import a building similar to the base game buildings on the size of our model. A good practice is to start with a grid with the size of the building we want to make. See the following image.
Each grid represents a 1x1 meter that matches a voxel in the game. Taking these dimensions into account, we know that the building must not exceed these limits when creating it. The building can have as many parts as it can be, but when we export it to the game, it is recommended that there be only one single object that conforms to the entire building. The coordinate axis must be located at
0,0,0, although then the building is not centered with respect to the plane that we have used as a reference to define the size. This must be taken into account so that the building does not overlap with the roads or other buildings.
The position of the main facade is important so that once the building is already in the game, it appears correctly located next to the roads and as a reference to the dimensions of the base of the building that we will have to configure later. In this case, the X-axis is the main facade of the building and measures 6m and the Z-axis is the bottom of the building and measures 4m. The axis orientation may vary depending on the 3d program being used, which in this case is 3ds max.
Texturing the building¶
VT texturing is very basic, it uses a 64x64 pixel square texture divided into different squares in which each unit will represent a color when the building is exported.
This base texture can be found in the folder `Content/your_first_pack" where the game is installed. Once this texture has been applied to the model, we can start creating the unwrap separating all the polygons of the model depending on the color that we want them to have once it is finished.
This is how the building unwrap should look depending on the number of colors we are going to use. For the night effect of the windows, in case the building has windows, the windows must be separated in different colors in the unwrap since they will be the different variations of windows lit at night. In the previous image, the unwrap has been created so that the building has three variations of night windows. Later we will explain how to create the necessary settings so that the windows appear lit at night.
Once we have the finished model, we can always export it to the game in
.obj format. For now, it is only a simple 3d model but later we will configure the necessary files so that the game recognizes it and can generate our building in the cities. All mods must be contained in the folder
Content/<mod_name>. For convenience and order, it's recommended to follow the same directory structure that the game uses and that can be verified by opening the folder
Building settings (
In order for the game to recognize that we have created a building, we must create or copy the .house file of any existing building and modify the necessary parameters. This file is located in the folder
To edit the game files we only need a text editor such as Notepad ++, or Visual Studio Code. I highly recommend VS Code as you can compare side by side.
This is what the
.house asset file looks like and contains the following parameters:
- PopulationRange: Indicates the maximum and minimum population that the building will have when the city generates it.
false): This parameter indicates if it can request a product, as is the case in stores. In the rest of the buildings, the value is false.
Size: Specifies the size of the building. These are the values we use in the reference plane. For the value of Y, the height, we must always round up, for example, if our building measures 2.4m (2.4 voxels) we must always indicate a value of 3.
Liveries: In this parameter, the path of the mesh of our building that we exported previously is indicated. Note that the first part of MeshUri (arab_buildinhgs), is the name of our mod followed by the name of the
default_night_1(..3): is the name of the different liveries to show the windows lit at night. There are three liveries that match the unwrap of the model.
MeshVariant: Indicates the name of the variant specified in the
.obj.metafile that defines the colors of the model that we will explain later.
Price: It is the price of the building, in this case, the demolition price.
RunningCosts: It is the operating cost of the building. As it is a city building, it has no effect on the player's finances. A null value indicates that loc automatically calculates the game.
false); This parameter indicates whether the object will appear in the game or in menus as a buildable asset in the player's menu. Hide assets are still visible in-game, eg. locomotives in recipes.
Building settings (
This file tells the game how our building should generate when a city grows.
- Uri: It is the path of the .house file that we explained previously.
- ProportionalCount: It is the proportion in which the building will appear with respect to the total number of buildings in the city.
- Density: Density of buildings in the city of this type.
- Biomes: This parameter indicates in which specific biome the building should appear. If the value is "null", the building will appear in all biomes, but if a biome is specified, the building will only appear in that biome as the buildings in the Arctic biome.
The asset editor integrated into the game and accessible from the main menu, allows us to modify the colors of any asset in the game. In it, we will look for the building that we have created.
The first time we access our building it will appear in gray color. This means you don't have a color palette assigned yet. To create a color palette we must click on Generate Palette and the model will now have the colors of the reference image that we used when creating the unwrap.
To assign colors, we simply have to click on the different parts of the building that will be highlighted as we move the mouse over it and select a color in the window that appears on the right. To specify a specific color that we already have defined, you can enter the hexadecimal value of the color. The different bars that appear below the color picker allow you to add brightness to the material or not to be affected by light at night, making it have the effect of lighting.
Once we have finished applying the colors, the building will look like this.
The different colors of the palette are saved in the
.obj.meta file and contain the different variants that indicate what color and properties should be replaced for the effect of illuminated windows.
The code above shows the color palette of the example building. We skipped some colors at the beginning because the listing would be too large but you can see the section of the variants. In the variants section, the names of the three variants are defined for the night windows that appeared in the
.house file named
night_1 - 3. In this case, the values 8, 9, 10 correspond to the colors in the upper section which are the ones to be replaced by the colors and parameters of the Variants section. To know what values you have to specify, the colors range from 0 to 15 (16 in total) but the easy way to find the correct colors is by the hexadecimal value. If color
#272727 was used, all colors with this value represent windows. Another parameter that can identify the windows in the Glossiness parameter, which in the rest of the colors will be
The location file allows indicating the name that will be shown in the menus or in the new information tool (pre-alpha 0.80) of the building.
The image shows that the indicated
LocaleUri language is English and in the Items section the path of all the files of the different objects created is specified, in this case several buildings (
.house), a biome (
.biome) and a plant (
You can have as many
.strings files as languages you want to have in the mod.
Publishing the mod¶
Once you have finished modeling the building, configuring the different files and applying the color palette, all you have to do is create an image of the mod (
preview.png) that will be shown in the mod finder and that must have dimensions of 512x512 pixels. It is also necessary to create a
mod.json file where the description of the mod is specified and which in turn allows the mod to appear in the mod selection window when creating a new game.