This article's documentation is for anything that uses the Source engine. Click here for more information.

Building Generator

From Valve Developer Community
Jump to: navigation, search
English (en)Translate (Translate)


Note.pngNote:This tutorial was written for XBLAH's Modding Tool XBLAH's Modding Tool v1.18.2. Please be aware that subsequent updates might have introduced alterations in terminologies, introduced novel features, or reorganized certain elements within the interface.


Compiling a map

XBLAH's Modding Tool XBLAH's Modding Tool comes with a Building Generator for Source. The tool includes some example files, and users can create their own templates.

Accessing the feature

This can be accessed within the tool via Custom IconTop Menu > Maps > Building Generator.

Generating a random building

The Building Generator creates buildings out of voxels, using instructions under 🖿scripts/building_generator/themes and map data under 🖿prefabs/building_generator. Select the File.vmf that you want to compile, select the desired settings and click Compile Maps.

In case you only edited the map entities, you can click Update Entities to compile it faster, keeping the brushes, visibility and lighting data intact.

In case you only want to check if the map is sealed, you can click Leak Test. The tool will alert you if any leaks are found.

Creating a Theme

Each script file consists of a theme. A theme is made out of pieces

PlacementTip.pngExample:a theme file of the DEV Textures theme, included in the tool. You can use it as a base to create new themes.
// Name: DEV Textures
// Author: Jean XBLAH Knapp
//
// Description:	This is a template theme, for feature testing and for reference.
//
// Usage:		Parts files have the following path format:
//				prefabs/[theme_id]/[part_name]_[orientation].vmf
//
//				The available orientations are FT, BK, LF, RT, FT_LF, FT_RT, BK_LF, BK_RT
//				The FT orientation is east in Hammer.
// 
//				The default skin is Skin 0
//				If a different skin is selected, whenever Skin 0 is found in the prefabs,
//				it will be replaced by the selected skin

building {
	// Settings
	name		"DEV Textures"
	voxel_size	"128"

	// Skin information
	skins {
		"0" {
			name	"0"
			materials {
				material "DEV/DEV_MEASUREWALL01A"
			}
		}
		"1" {
			name "1"
			materials {
				material "DEV/DEV_MEASUREWALL01D"
			}
		}
	}

	// Floor information
	floors {
		// Used by every floor that does not have custom settings
		"default" {

			// If a part is not found, it will use this one
			default_part	"wall01"

			// Used by FT, BK, LF and RT faces
			default_edge	"window01"

			edges {
				part {
					part_name	"window01"

					// How often this part should be picked. The default is 1.
					// If the frequency is 4, it means it will be picked 4x more often.
					frequency	"4"
				}
				part {
					part_name	"window02"
				}
				part {
					part_name	"window03"
				}
				part {
					part_name	"window04"
				}
			}

			// Used by corner faces
			default_corner	"wall01"
		}

		// The ground floor
		// It equals to using index 0
		"bottom" {

			// The height of the floor is defined by this value times the voxel size.
			// Default value is 1.
			height	"1"

			// If a part is not found, it will use this one
			default_part	"wall01"

			set_pieces {
				part {
					part_name	"door01"
				}
			}
		}

		// The upper floor
		// It equals to using index -1.
		"top" {

			// If a part is not found, it will use this one
			"default_part"	"roof01"
		}

		// Any terrace floor except the roof. If none is set, "top" is used for any terrace
		"terrace" {
			"default_part"	"roof01"
		}
	}
}

Pieces

Each piece is a visgroup of the File.vmf under 🖿prefabs/building_generator. The front of the pieces always face east in Hammer. Each piece must have a single info_landmark, that represents the origin (back-right corner) of the piece.

Skins

Themes can have multiple skins.

Supported Games

See also