modding:developerinfo:streets

Streets

Overview

A street configuration files specifies a set of parameters to define the properties, dimension, features and visuals of streets. They are stored in .lua files in the folder res\config\street\.

The file has the following format:

function data()
return {
	-- property and dimension definitions
        -- ...
 
	materials = {
                -- material definitions
	},
	assets = {	
                -- asset definitions
	},
	bridges = {
                -- bridge definitions
	},
}
end

Properties and dimensions

Example:

function data()
return {
	numLanes = 4,         -- number of lanes
	streetWidth = 16.0,   -- [m] width of the street (without sidewalk)
	sidewalkWidth = 4.0,  -- [m] width of the sidewalk
	sidewalkHeight = .3,  -- [m] height of the sidewalk
	yearFrom = 0,         -- available from [year]
	yearTo = 1925,        -- available until [year]
	upgrade = false,      -- only used in the upgrade tool [bool]
	country = false,      -- disallow town buildings [bool]
	speed = 60.0,         -- [km/h] maximum allowed drive speed
	cost = 88.0,          -- building costs per meter
 
	-- material, assets, and bridge definitions...
}

Materials

The list of materials defines the materials used for various parts of the street. Every definition contains a link to a .mtl file and its size.

materials = {
	streetPaving = {
		name = "street/country_new_medium_paving.mtl",     -- base path: /res/models/material/
		size = { 8.0, 8.0 }                                -- ???
	},
 
	-- more material definitions...
},

Available material definitions: (which are ALL optional)

  • streetPaving
  • streetBorder
  • streetLane
  • streetStripe
  • streetStripeMedian
  • streetTram
  • streetBus
  • crossingLane
  • crossingBus
  • crossingTram
  • crossingCrosswalk
  • sidewalkPaving
  • sidewalkLane
  • sidewalkBorderInnersize
  • sidewalkBorderOuter
  • sidewalkCurb
  • sidewalkWall

Street materials with non-zero polygon offset are rendered without depth buffer write. Depth write can be forced with forceDepthWrite flag.

Base Materials

Base materials - like paving and sidewalks - require the following parameters:

function data()
return = {
    order = 0
    params = {
        -- more params
        polygon_offset = {
            factor = -2,
            units = -2,
        },
    type = "PHYS_TRANSPARENT_NRML_MAP" -- or non-transparent
}
Overlay Materials

Overlay materials - like markings, borders, bus lanes or tram tracks - require the following parameters:

function data()
return = {
    order = 1    -- for multiple overlays set order appropriately
    params = {
        -- more params
        alpha_test = {
            alphaThreshold = 0.5,
            preferAlphaToCoverage = false,
        },
        polygon_offset = {
            factor = -3,
            units = -3,
        },
    type = "PHYS_TRANSPARENT_NRML_MAP" 
}
Material types

Material types are renderered in this order:

REFLECTIVE,
REFLECTIVE_NRML_MAP,
REFLECTIVE_OP,
REFLECTIVE_NRML_MAP_OP,
PHYSICAL,
PHYSICAL_OP,
PHYSICAL_NRML_MAP,
PHYSICAL_NRML_MAP_CBLEND,
PHYSICAL_NRML_MAP_CBLEND_DIRT,
PHYSICAL_NRML_MAP_OP,
PHYSICAL_NRML_MAP_CBLEND_OP,
PHYSICAL_NRML_MAP_UV1_AO,
PHYSICAL_NRML_MAP_OP_UV1_AO,
PHYSICAL_GLOSS_ONLY,
PHYSICAL_OP_GLOSS_ONLY,
SKINNING_TEXTURED,
SKINNING_PHYS_CBLEND4,
SKINNING_PHYS_NRML_MAP_CBLEND4,
PHYSICAL_ALPHA_NRML_MAP,
PHYSICAL_ALPHA_NRML_MAP_OP,
PHYS_TRANSPARENT,
PHYS_TRANSPARENT_NRML_MAP,
PHYS_TRANSPARENT_NRML_MAP_CBLEND_DIRT,
PHYSICAL_NRML_MAP_CBLEND_DIRT_LOGO,
TRANSPARENT,
TRANSPARENT_DETAIL,
TRANSPARENT_NRML_MAP,
TRANSPARENT_OP,
TRANSPARENT_NRML_MAP_OP,
EMISSIVE,
LEAF_CARD,
BILLBOARD,
BILLBOARD_MULTI

Assets

Contains a list of asset models, which will be placed along the street.

assets = {
	{
		name = "asset/lamp_old.mdl",    
		offset = 5.0,                   -- [m] offset along the street
		distance = 17.0,                -- [m] distance between assets
		prob = 1.0,                     -- [0.0 - 1.0] placement probability
		offsetOrth = 3.4,               -- [m] offset perpendicular to street direction
		randRot = false,                -- random rotation [bool]
		oneSideOnly = false,            -- place only on one side of the road [bool]
		alignToElevation = false,       -- align to elevation [bool]
		avoidFaceEdges = false,         -- asset not placed at street segment border (avoid...
                                                -- ...overlaps with bigger assets, i.e. tree beds)
		placeOnBridge = true,           -- place on bridges [bool]
	},
 
	-- more asset definitions...
},

Bridges

Contains a list of .lua files with available bridges.

bridges = {
	"stone_old_medium.lua",
 
	-- more bridges...
},
modding/developerinfo/streets.txt · Last modified: 2018/12/11 15:59 by tom

Page Tools