Setting Up Roads and Traffic

Creating a New Road Section Blueprint

  1. Load the Blueprint Editor and navigate to scenery\procedural (this is where roads will live)
  2. Right-click the Procedural folder icon and select “New Blueprint”
  3. Select “Road section blueprint” and press OK
  4. Rename the file to something sensible
  5. Enter a display name that is short and sensible
  6. Right-click a road IGS file (the blue cube icon) in the left browser pane that you want to create a variant of and select “copy filename”, then paste this into “Cross section ID”. This is the cross section texture that will be used, defining the look of the road.
This is your basic new template, which has a display name and has been told what road cross section it is drawing. This can now be exported. After a successful export, this road is now available in the Linear Object Tool tab of the World Editor.

The XML and display names should reflect both the type of road and what type of traffic (if any) it has on it, but ultimately any naming convention is the choice of the user.

Eg, XML: 1L_Tar_Light_2000s
Display Name: Road 1L Tar Lgt 2000's

Adding Lamp Posts

To automatically add an object, such as lamp posts, at regular intervals along a road's length you need to edit the Start geometry ID, Middle geometry ID and End geometry ID and frequency fields. In the three geometry ID fields, you paste in the reference to the lamp post shape IGS file which you can get by right-clicking on the lamp post in the left pane and copying the file name. This will tell the game to place a lamp post at the start of the road, at the end of the road and along the length of the road at X meter intervals. The interval between lamp posts is specified in meters in the Population Frequency field.

Any shape can be added along a road's length in this way. If you want a shape to be displayed only at each end, fill in only the start and end fields. This is how buffers are set up to be placed automatically at the end of a track.

Adding Traffic

Traffic behaviour is handled by a traffic manager blueprint, which is referenced in your road blueprint. Once the traffic manager blueprint has been made you can reference it by pasting the XML link into the “Traffic manager bp ID” field of the road blueprint.

Traffic Manager Blueprints

A traffic manager blueprint needs to be created for each type of traffic density and for each set of cars you want. The existing traffic manager blueprints are split between scenery\procedural and scenery\vehicles, but you can create them anywhere. In this example, we will be creating the new blueprint in scenery\procedural.
  1. Right-click the scenery\procedural folder icon and select “New Blueprint”
  2. Select “Traffic controller blueprint” and press OK
  3. Rename the file to something sensible
  4. Fill in the blank fields.
The fields are:

E Network Type Road / Air / Ship: Select "Road" for roads
F Lane Width A value in metres of about 2 works for regular two-lane roads. If the cars are not sitting in their lanes, tweak this value
E Lane Direction Direction the cars drive. For UK routes select Left-Hand Drive, for European and US routes, pick Right
F Elevation How high the road sits on the ground when it is laid. This should be set to 0 or 0.1 to avoid z-fighting with the terrain
E Speed Type The units in which the speed value is used. Either k/mh or mph
I Density An arbitrary value for how often traffic will be spawned. High = more traffic
F Release XXXX These three fields can be thought of as separate spawners. The number put in is how many cars are spawned (at a frequency decided on in density)

Expanding the Lane Prop and Vehicle Model tabs will give you more options:

F Max Speed The maximum speed a car can travel on that lane. If an individual car can travel faster, as specified in the vehicle blueprint, the value specified in this field will be the cap
I Population Density Another density value that is dependent on the lane. High numbers create denser traffic
Vehicle Model Paste in the XML link to each vehicle blueprint which you need to make for each car 

Vehicle Property Blueprints

The existing vehicle property blueprints split between scenery \ procedural and scenery\vehicles, but you can create them anywhere. In this example, we will be creating the new blueprint in scenery\vehicles.
  1. Right-click the Vehicles folder icon and select “New Blueprint”
  2. Select “Vehicle prop blueprint” and press OK
  3. Rename the file to something sensible
  4. Fill in the blank fields
The fields are:

Geometry ID A reference to the vehicle shape file (IGS)
I Population Density This is the chance to spawn this particular type of vehicle. The number is semi-arbitrary. If you had two vehicles specified and set this value to 50 for each, they would spawn evenly. If you set one to 1 and the other to 2, then the second type will spawn twice as often. To make all your vehicles spawn with the same frequency, set this value to 1
I Lane Change Prob This is the likelihood of the vehicle changing lanes if multiple lanes have been set up. Vehicles set to have a higher speed than the car in front may change lanes. Extra lanes specified in the traffic manager blueprint are empty of traffic and are only used for overtaking
F Vehicle Length The length of the vehicle in metres for avoidance purposes
F Top Speed A top speed reference. This time it is the vehicle's top speed as opposed to the lane. In theory, you could set up a 5mph top speed tractor to hold up the other cars on a country road

There may be a certain amount of sharing of files; vehicles only need to be done once for each and then can be referenced by other Traffic Manager Blueprints and Traffic Manager Blueprints can be used on multiple roads as long as the widths are similar.

Once you have set up your road, traffic controller and vehicle blueprints, you will need to export them all so they show in the Assets folder and become "game ready".

Traffic will not flow over breaks in a road or the end of a road ribbon (the red triangle visualisation which appears after a split or weld for example); so road ends should be hidden to avoid seeing cars pop into the world.