Skip to content

Procedural system 2.0

Jakub Lukasik edited this page Mar 23, 2023 · 4 revisions

Glossary

Config: file storing whole setup for procedurals, located on path "defaults/way.cfg"

Profile: Main configuration unit, every waypoint in procedural sequence needs to address some profile (it has properties like style, type of construction and reference to textures used for generated terrain surface)

Profile style: defines lane, shoulder, border widths, features to use from feature set and much more. Profile can define up to 8 of styles that can be picked for each procedural waypoint individually

Feature set: with addition to profile, feature set defines setup used for placing geometry along placed procedural sequences

Style

Defines set of properties of road profile, in one profile can be configured up to 8 styles, they can be used for minor changes in visuals within one profile. Common use cases are temporary narrower parts of roads in towns, parts of road without footpaths or roads without nature strip.

Example:

{
    style_name = "default", // name used for UI
    slot = 0,               // index to list of all (8) styles, used after order change of styles, to keep already placed roads valid
	
    lane_width = 3.0,       // paved road/lane width
    outer_shoulder = 2.0,   // outer shoulder width
    gutter = 0.5,           // gutter width
    curb = 0.5,             // curb width
    natstrip = 2.0,         // nature strip width
    footpath = 3.0,         // footpath width
    border = 0.5,           // border material width, flat part of the embankment
    embankment = 0.0,       // embankment width (horizontal width, single side)
    transition = 10.0,      // width of transition from paved part to original underlaying terrain
    rise = 0.0,             // min height above terrain
    turn_radius = 0.0,      // turn radius for sharp waypoint turns

    lane_feature = "track", // name reference to lane feature from feature set, only used when profile uses feature set (more about feature sets below)
}

Midlane

Another important profile property, that specifies how should look additional lane between opposite directions of stereo road. There is currently fixed set of 8 midlanes, that can be configured. All midlanes are:

  • Lane
  • Plain
  • Reserved
  • Connect
  • Hatched
  • Isle
  • Guard
  • Special

Example:

{
    midlane_name = "lane",     // One of names from list above
    width = 1.8,               // Width of mid-lane
    shoulder = 1.0,            // width from mid-lane to first side lane
    surface = "gravel_a_01cm", // Type of mid-lane surface (material, color)
    feature = "default",       // name reference to midlane feature from feature set, only used when profile uses feature set (more about feature sets below)
}

Profile

TODO

Lane feature

Example:

{
    name = "default",                    // name to be referenced in profile style definition
    single = "roads/tunnel1",            // model used in situation of one single lane
    left = "roads/tunnel1_left",         // model used on most left side of road if more than 1 lane
    inner = "roads/tunnel1_open",        // model used in between left and right models if more than 2 lanes
    right = "roads/tunnel1_right",       // model used on most right side of road if more than 1 lane
    enter_exit_disable = ["default"],    // when this feature is used next to "default" lane feature it will not generate enter/exit segment
}

If stereo road does have midlane with geometry, profile is composed as Left, N-times Inner, Midlane, N-times Inner, Right

If stereo road does have midlane without geometry, profile is composed as Left, N-times Inner, Right, Left, N-times Inner, Right

Midlane feature

Example:

{
    midlane_feature_name = "isle",        // name to be referenced in profile midlane definition
    model = "roads/concrete_rail_guard",  // path to model to be used
    enter_exit_disable = ["steel_guard"], // when this feature is used next to "steel_guard" midlane feature it will not generate enter/exit segment
}

Feature set

Configuration used for placement of defined mesh geometry along placed procedural sequences. Main idea is to define features and building blocks that can be referenced in profile style and then used to generate geometry from these blocks by number of lanes. Of course it is also possible to define one object for specific profile-style setup and use that, what helps with performance because less draw calls are needed.

Example:

{
    name = "tunnel",	                     // name to be referenced in any profile
    span = 5.0,		                     // length of models used
    surface_offset = 0.0,	             // additional distance from object pivot to procedural spline

    default_lane_feature = {                 // values used in every lane feature if not overridden
        left = "roads/tunnel_left",          // model that will be used for multilane case on left (includes first lane)
        inner = "roads/tunnel_open",         // model that will be used for multilane case on inner lanes (except first left and right lanes)
        right = "roads/tunnel_right",        // model that will be used for multilane case on right (includes first lane)
        single = "roads/tunnel",             // model that will be used for singlelane case
    },
    lane_features = [{                       // list of lane feature definitions that can be referenced in profile style
        name = "default"                     //style that does not override any of default models
    }, {
        name = "extra",                      // style that overrides left and right models
        left = "roads/tunnel1_left",
        right = "roads/tunnel1_right",
        enter_exit_disable = ["default"],    // when this feature is used next to "default" lane feature it will not generate enter/exit segment
    }],

    default_midlane_feature = {              // list of midlane feature definitions that can be referenced in profile style
        model = "roads/concrete_rail_guard"  // model that will be used as separator for two way road
    },
    midlane_features = [{
        midlane_feature_name = "concrete",   // midlane with custom model and disabled enter/exit when used next to "steel_rail" midlane feature
        model = "roads/concrete_rail_guard",
        enter_exit_disable = ["steel_rail"], // when this feature is used next to "steel_rail" midlane feature it will not generate enter/exit segment
    }, {
        midlane_feature_name = "steel_rail", // midlane with custom model
        model = "roads/steel_rail_guard",
    }]
}