RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator

Home Page:https://www.rigsofrods.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: Moving and parked vehicles

DynV opened this issue · comments

commented

Up to now I only did single play and I think maps lack "life". It would be nice if there were other vehicles. For performance issues I think there should be levels of "population", maybe they can be based on how much road there is on the map, also the vehicles can be rated for level of details; ie at minimum "occupancy" only the quickest to render vehicles are included (beside the one the player is in) per 1/4 mile moving at avg 15 mph.

Maybe a 2nd phase can be for the roads to be better analyzed and longer stretches have a higher avg speed, and sections with many intersections have a lower avg speed. Maybe a 3rd phase could ensure the vast majority of the time the 2 road types are proportionally "populated", ie for a maps with 1/3 rural/highway roads, there's almost always ~1/3 of the "occupying" vehicles on one of those (rural/highway road).

Thank you for your consideration

Update 1
Maybe rugged maps like Pines Proving Ground and Brutal Valley can have a dozen parked vehicles and a corresponding amount of hikers around the map. Optionally a handful of vehicles with large offroad tires slowly roaming around (eg < 5 mph).

Hello @DynV,
Maps could indeed use more life and there are projects and tools to make it happen:

The map format already supports spawning parked vehicles. We have an AI and waypointing system, all editable and invocable from script. See demo_script.as for the AI controls and road_editor.as for road/waypoint editing. Finally, If you wanted to make NPC people to walk around, there is this: #3030

Have fun and come chat on Discord.

Extra idea: What if only the nearest vehicles actually had full physics? Vehicles far from the player could be kinda "dummy vehicles" with a simplistic N/B and lower LOD meshes. There are two problems with this though:

  • Loading vehicles causes a bit of stuttering at the moment, so such a LOD thing would make the game unplayable currently.
  • Reloading vehicles would be pretty noticeable as you would see a car respawning, which is definitely not optimal, Especially because the full N/B would be used only from very close.

All good ideas and all should be doable via scripting, though it isn't at the moment. I have 2 solutions in mind:

The full-on fake vehicles (no collisions) approach

If you want to get your hands dirty, I suggest you download a github build of #3030, then load the .truck file manually as shown in this example script and then load it's meshes manually as shown in this other example script. Yes this approach is messy and fake but also powerful. You could in fact use more of the 'characterPosing' example to add pedestrians or other NPCs to terrain.

The 'physics freezing' approach

The game already has an option to freeze physics for individual vehicles (hotkey 'End' - see TRUCK_TOGGLE_PHYSICS in settings). AFAIK it cannot be toggled from script at the moment, but adding that is minimal work. Once that is in place, all that is left is a function to move/rotate the frozen vehicle. Also not hard to add. I think I'll go this way about it.