How To - Create Custom Theme
Updated 3 months agoSetup
1. Requirements
- To build custom Map Generator content you first need to setup Unity with Atlas, you can do so by following this tutorial - Link
- It's important that you have 1 Unity project per Map Generator Theme, build times can be very slow with unused content in the Unity project, so make sure you clear Unity of any unused assets that aren't apart of your theme
- Any assets can exist in sub folders as long as they are in their respective package folder
2. Importing Map Generator to Unity
- Download the Map Generator SDK unity package file: Download here
- Go into Unity Editor and right click the Project tab then
Import Package > Custom Package...
, navigate and select the SDK unity package file you just downloaded - If everything was properly setup you shouldn't have any red errors and are ready for creating a package
3. Creating Package
- In your root Assets folder in your Project tab, create a new folder of the name of the theme you wish to setup e.g.
ExampleTheme
- Open your new Theme folder in the Project tab and Right Click in the Project Tab and go to
Create > Map Generator > New Package
, a new file called Package should appear. Hit enter and leave it namedPackage
. Very Important that this file isn't renamed and remains in the root of your theme folder - Click on the new Package File, in the Inspector tab there should be a list of editable options you can fill out. The important 3 are:
Theme Name
- The name that appears in the Map Generator when selecting this themeTheme Description
- A short description of what the theme is, e.g. A desert townTheme Preview
- The preview image that appears when a theme is selected, 16:9 aspect ratio, this has to be a sprite which can be set in the Inspector when the image is selected in the Project tab
- At the bottom of the Inspector with the package file selected you should see a
Build Package
button, this will build the package and all of its content within its folder. (This will also build all other Packages in the project) - Navigate to your Project folder in windows and find the AssetBundles folder, here you should find your compiled theme ready for the map generator. The file should be labeled with your package name, e.g.
ExampeTheme.mapgen
- To load your Package into the map generator, it can be placed in any mod folder within your games plugins folder, which means it can be packaged with other mods if wanted.
- Create a mod (Not covered in this tutorial) and include the theme
.mapgen
and.manifest
files within that mod and the map generator will automatically find them
Creating a Theme
Package - Map / Terrain
Textures
The visual and effect components of the terrain, set Primary texture to None for it to be ignored. Each can be assigned with a unique texture or the same texture multiple times.
- Primary - The main texture that will appear the most across the map
- Secondary & Tertiary - Both of these textures are randomly scattered throughout the map to help break up the primary texture
- Scale - Affects how much the textures will loop
- Normal - Normal bump map that can be optionally assigned
Atlas Mat Def
- The Physical properties of the terrain for bullet reactions and other mods like Player Footstep effects
Skybox Model
- Skybox - A GameObject prefab spawned in the center of the game world and scaled to the same size as the map, it assumes the center of the skybox is 1x1x1 in size. Anything within the 1x1x1 would be apart of the game world and anything outside of the 1x1x1 would be on the outskirts of the terrain
Audio
Used for ambient background sounds
- Background Audio - The audio clip that will play on loop forever
- Audio Indoor Volume - How loud the background audio will be in Reverb environments that are considered indoors
- Audio Outdoor Volume - How loud the background audio is when in reverb environments that are considered outside or when the player isn't in any reverb environment
Package - Models
Themes are made up of lists of Game Object prefabs that spawn into the world, each category performs a different form of spawning of objects.
Model | Description | Internal |
---|---|---|
Hubs | A single structure that sits in the middle of the map and often acts as the starting position for Supply Raid | A single hub is randomly selected from all enabled themes |
Interior Props | Props that only spawn inside of structures, they are assumed to be about 1x1x1 in size | Props are randomly selected and filled into all structures by the % setting amount randomly |
Exterior Props | World props that only spawn on the terrain that aren't environmental | They can only spawn on terrain and are randomly selected |
Environmental | All external environmental objects such as trees, rocks and bushes | These objects can only be spawned on the terrain and are randomly selected |
Terrain | Objects that serve as unique terrain elements such as a hill, cliffs, large rocks or some other terrain piece that serves as a surface for other objects to spawn on | Spawned before all other game objects and function the same as the generated terrain |
One Of A Kind | A one off unique Game Object that spawns randomly in the world, can be anything but spawns after all terrain is generated. Used for unique objects such as a landmark or unique structure | Selected randomly from all loaded themes |
Materials
Materials or "Terrain Materials" are assigned in the package file, these materials receive the same material data that the terrain is given allowing for smoother transitions between the terrain and objects. This also allows for themes to override the visual look allowing everything to blend together no matter the theme being used.
To setup a material to work with this system, you first need to set the shader to Alloy/Vertex Blend
. Then assign this material to anything you wish to use the terrain materials for, then add the material to the theme's Package Terrain Materials
list.
The distribution of Terrain material textures is determined by the Vertex color on the mesh:
- Red - Ground (The main looping texture for the terrain e.g. Grass)
- Green - Ground Scattered (Secondary ground texture to break up the main texture e.g. dirt)
- Blue - Slope (Used for cliff faces and other more vertical surfaces)
Package - Landscapes
Landscapes is the system that changes how the terrain generates its form
Creating a New Landscape
Landscapes are confusing at best and require a lot of tweaking to get working and understand.
- You can create new Landscapes by right clicking inside your package's folder in the Project tab and selecting
Create > Map Generator > New Landscape
and naming it anything you want - Set a Title, Description and preview image to what ever best describes your terrain.
- Each of the generation uses Curves to adjust the generation information, these are made up of Time and Value. For generation to properly work each curve needs at least a linear 0 to 1 line from Time & Value = 0 TO Time and Value = 1. There is a default one at the bottom of the curve editor screen with a green line going from the bottom left to the top right.
- A way to view this curve is that Time represents what input height data is received from 0.0 to 1.0, this comes in the form of perlin noise. Value is what the curve will do with that data, so if 0.5 Time inputs, we can set it to default 0.5 OR do something different like 0.75 to increase the height of that terrain point.
- Mountains are for larger height points layered on the terrain, you can enable or disable it. Adjusting the scale affects the depth and width of the mountain and the strength affects the height
- Detail Noise is the minor bumpy noise to keep the terrain interesting in the smaller scale, this is less effective with the terrain resolution so low but it is optional. Like Mountains the scale works the same