RigsOfRods / rigs-of-rods

Main development repository for Rigs of Rods soft-body physics simulator
https://www.rigsofrods.org
GNU General Public License v3.0
1.01k stars 177 forks source link

Collision perf: brute force per-actor lookup #3156

Closed ohlidalp closed 4 months ago

ohlidalp commented 4 months ago

To benchmark, download the attached ZIP, unpack the script to 'Documents\My Games\Rigs of Rods\scripts' and in game, type loadscript example_game_gridSpawn.as to console. example_game_gridSpawn.as.zip

obrazek

On my desktop with Ryzen 5 5600X (6 cores), with Release build, spawning 4X 3Y 10Z (total 120) busses gives me these results:

Note the biggest FPS eaters are, in order:

  1. calcFlexbody() - depending on how many/how dense flexbodies are used
  2. CalcBeams() - always
  3. CalcNodes() Collisions easily jump CalcNodes() and if it's a bigger crash, it jumps even CalcBeams(). Flexbodies are always the hungriest tho.

Suggested (with a tongue in cheek) on Discord#dev: https://discord.com/channels/136544456244461568/189904947649708032/1242063388624949339

ohlidalp commented 4 months ago

Changed to draft because this makes performance way worse in the Benchmark terrain with Gavrils MV4, reported by Mike on Discord#dev

https://streamable.com/933t0p https://streamable.com/sbn9fe big lag spikes with the PR, especially when the second set of cars collides

ohlidalp commented 4 months ago

Closing as a dead-end branch... I have other perf tweak in mind for later.