Procedural roads evolution

ohlidalp

Infamous Developer
Administrator
Developer
Joined
Jan 31, 2018
Messages
170
Location
Prague, CZ
Hi everyone,

procedural roads just got an interactive editor and the ability to auto-generate AI waypoints: https://github.com/RigsOfRods/rigs-of-rods/pull/2976 - when finished, this editor script will be able to edit all current parameters of roads. To learn what roads can do, read our docs: https://docs.rigsofrods.org/terrain-creation/old-terrn-subsystem/#procedural-roads. Quick recap:

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

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

; end a road strip
end_procedural_roads

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.

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

begin_procedural_roads
   ; 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...
end_procedural_roads

begin_road_crossing
   ; 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
end_road_crossing
 
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.
 

Attachments

  • roadbox-terrn.zip
    902.3 KB · Views: 346
Back
Top