Steam Revolution | Documentation

Custom meshes, materials, and sound

Definitions connect geometry to materials

A mesh block in definitions.txt connects a geometry name to a series of material slots. Buildings, trees, cargo, and other objects refer to a mesh definition by name. Geometry names resolve to package-specific assets when present, otherwise to the game's shared assets. The shipped levels/definitions.txt and meshes/ directory contain working examples.

mesh custom_shed {
    geometry custom_shed
    material 0 {
        color 168 52 10
        gloss 230
        specularity 10
    }
    material 1 {
        color { 80 110 45, 130 165 75, 210 190 120 }
        gloss 120
        specularity 6
    }
}

Material indices range from 0 through 7. Slots must be defined consecutively from 0 through the highest used index. color can be one RGB color (0-255 per channel), or a brace-enclosed, comma-separated ramp of two or more RGB knots; ramps are interpolated to 16 colors, then each placed object selects one of those samples for that material slot to add color variation. gloss and specularity set the material's lighting properties. uses_fullness true enables fullness-based rendering for that slot.

OBJ geometry conventions

The runtime OBJ importer supports positions (v), normals ( vn), UV selectors (vt), and faces ( f). Every face corner must provide a position, UV, and normal index in position/uv/normal form. Polygon faces are triangulated as a fan. Standard texture coordinates are not used to sample an image; the UV values select material and fullness bins.

v 0.0 0.0 0.0
v 1.0 0.0 0.0
v 1.0 1.0 0.0
vt 0.0625 0.1
vn 0.0 0.0 1.0
f 1/1/1 2/1/1 3/1/1

The shared mesh sources include mesh_preview.bmp and its mesh_preview.mtl material-library file as an authoring aid. Map the OBJ's UVs onto this image to see the material slot by its hue and the fullness bin by its darkness; an OBJ editor that displays the preview texture will show those selections on the model while you edit. The game uses the UV selectors and mesh definition at runtime, not this BMP.

The geometry asset name is the OBJ filename without its extension. Optional level-of-detail geometry uses the suffix convention <geometry>_lod1 (and subsequent LOD numbers when needed). The game converts OBJ sources into its compiled .mesh runtime format; include the compiled mesh asset with the package so it can be loaded by the game.

Using and overriding shared assets

A mesh definition and its geometry are separate: a custom level can add a new mesh definition that points to a shipped geometry, then give that geometry a different palette. This changes its appearance without supplying a new OBJ or compiled mesh. Redefining a shipped mesh name instead overrides its palette for every definition that uses that name in the level; use a new mesh name when only one resource should have the new appearance. To replace the geometry itself, supply an OBJ and compiled mesh under the referenced geometry name.

Other mesh references include building and tree types, plus each resource's train_mesh, loader_mesh, and storage_mesh. Engine definitions reference their own engine_mesh, tender_mesh, and smoke_mesh. The shipped meshes use the prefixes train_engine_, train_tender_, and smoke_, followed by wood, coal, or oil. The three smoke meshes share the same geometry. The game also looks up depot, signal_blocking, signal_free, and signal_chain directly. Keep the material slots compatible with the referenced geometry.

For example, extend the glass resource from the custom-level guide with separate mesh definitions for its loader and train cargo. These reuse the shipped loader and flatcar geometries, but color the cargo material light blue. Keep the fullness setting on that material so the visible cargo amount still changes with the load.

mesh loader_glass {
    geometry cargo_loader_bar
    material 0 {
        color 64 64 255
        gloss 230
        specularity 10
    }
    material 1 {
        color 120 200 235
        gloss 230
        specularity 10
        uses_fullness true
    }
}

mesh train_glass {
    geometry train_flatbed_car
    material 0 {
        color 130 51 35
        gloss 240
        specularity 20
    }
    material 1 {
        color 120 200 235
        gloss 230
        specularity 10
        uses_fullness true
    }
    material 2 {
        color 128 128 128
        gloss 230
        specularity 10
    }
}

resource glass {
    name "Glass"
    role cargo
    train_mesh train_glass
    loader_mesh loader_glass
    storage_mesh storage1
}

Material selection is per face vertex. If two faces need different material slots, give their corners UV coordinates in the corresponding U range. The V selector is independent and can vary across vertices when the selected material uses fullness.

Sound assets and ambience

Ambient sounds are declared as named ambiance blocks in definitions.txt. The sound value is a sound filename without its directory or .mp3 extension; the game resolves it from the shared sounds/ambiance/ directory and loops the MP3 during playback. A custom level references sounds available there rather than bundling audio in its level folder. The shipped definitions and sound directory contain working examples.

ambiance glassworks {
    sound 259501__ikayuka__industry
    volume 0.5
}

industry glassworks {
    name "Glassworks"
    ambiance glassworks
    buildings {
        ceramics_factory_center_1
    }
    recipe {
        consumes 2 sand
        produces glass
    }
}

volume is a multiplier from 0 to 1. Reference an ambience from an industry type with the ambiance <name> field; its buildings then contribute that sound to the ambient mix, with nearby buildings contributing more. New ambience blocks need both sound and volume. Here glassworks is a custom industry example: it reuses a shipped factory building and consumes sand to produce the custom glass resource defined above.

The names nature_forest, nature_river, and nature_ocean are required ambience definitions. The game selects them automatically from the nearby forest, river, and ocean sound maps; they are not assigned to an industry. You can override their sound and volume in a level's definitions, but keep the required names.

Back to documentation