Procedural roads evolution


Infamous Developer
Jan 31, 2018
Prague, CZ
Hi everyone,

procedural roads just got an interactive editor and the ability to auto-generate AI waypoints: - when finished, this editor script will be able to edit all current parameters of roads. To learn what roads can do, read our docs: Quick recap:

; Syntax of procedural roads in .tobj file
; ----------------------------------------

; begin a road strip
    ; define a series of procedural points
    ; Arguments:
    ;posX, posY, posZ,   rotX, rotY, rotZ,   width,   borderWidth, borderHeight, type

; end a road strip

The road system is still very limited, let's discuss how it could be improved. These are the limitations I see, and how I'd improve the system:
  • Hill roads are bumpy, there is no autosmoothing and it's near impossible to create smooth hill road by hand/tool.
  • You can't create road crossings
  • You can't define custom material
  • You can't define custom groundmodel
  • The mesh generator creates disjoint geometry, so lighting shows sharp edges everywhere. This must be improved in code.
  • You cannot provide custom mesh to generate road from. This will require a whole new mesh generator code. ETA: next summer.

; Suggested .tobj extensions for procedural roads, with example
; -------------------------------------------------------------

   ; road name (for display in game)
   road_name "Scenic Route 43"
   ; road ID for internal referencing
   road_id scenic43
   ; custom material name
   road_material Scenic43Mat
   ; custom groundmodel name
   road_groundmodel customAsphalt
   ; auto-smoothing by dividing roads to smaller segments of maximum length (in meters)
   road_smoothing 0.5
   ; procedural points...

   ; crossing name (for display in game)
   crossing_name "The T-crossing with country road"
   ; crossing ID
   crossing_id CountryT
   ; custom mmaterial name
   crossing_material CountryTMat
   ; custom groundmodel name
   crossing_groundmodel customAsphalt
   ; a list of roads to cross, specifying point number (first=0, last='last')
   ; Syntax:
   ; crossing_road roadID, roadPointNumber
   crossing_road mainroad, 25
   crossing_road countryroad, 0
Last edited:
I tried to figure out how rotations work, and it seems they're broken and unpredictable. I need to understand them in order to correctly export the roads from my editor script.

The only param which works fine is 'rotY' - it represents anticlockwise yaw around global Y (up axis).
I was able to do a banked road in X direction, but not in Y direction.

See the attached terrain - it's a modified simple2, my comments are in the roadbox.tobj file.


    902.3 KB · Views: 331