Performance Enhancement: Moved Automap to its Own Physics Layer#2790
Performance Enhancement: Moved Automap to its Own Physics Layer#2790Vwing wants to merge 5 commits into
Conversation
Moved Automap onto its own non-interacting physics layer, so we don't have to constantly enable/disable its game objects. This is a *huge* performance boost in large dungeons. Also we now destroy the generated geo immediately on transition to the outside. This could wait, before, because the geo was disabled; but now that we don't disable geo, we need to do it immediately.
|
Will push this one into the next 1.2 Test3. |
Made sure we keep using the implicit Physics.DefaultRaycastLayers for casts that were using that, but with Automap excluded. Added a PhysicsLayers utility script to expose that mask as a static PhysicsLayers.DefaultRaycastLayersWithoutAutomap.
|
Glad you caught that. I went ahead and excluded the 'Automap' layer from every raycast that doesn't need to interact with it, PlayerActivate included. |
Interkarma#2781 already ignores the Automap layer in DaggerfallMissile and WeaponManager
|
Undid changes that would've conflicted with #2781, since it already ignores Automap. |
Daneel53
left a comment
There was a problem hiding this comment.
This PR was deeply tested into 1.2 Test3 in the same time as RedRoryTheGlen's PR 2781.
Both authors confirm that all is now working as intended.
Both PR are ready to be integrated into the game.
KABoissonneault
left a comment
There was a problem hiding this comment.
I'm not sure I understand why every raycast call needed to be modified for this change. It seems like if that's truly necessary, then this change would break any mod using a raycast that's not been modified to exclude the Automap. Can't the Automap be excluded from physics by default, and be enabled only in those sections that need for rays with the automap to block?
Gonna put this PR on blocked while we resolve this
| m_ClothInterCollisionStiffness: 0 | ||
| m_ContactsGeneration: 1 | ||
| m_LayerCollisionMatrix: fffffefffffffeffffbffefffffffffffffffefffffffefffffffffffffffffffffffefffffffefffffffefffffffefffffffefffffffefffbbffefffffffeffc800fe0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffffefffffffefffffffeff | ||
| m_LayerCollisionMatrix: fffbfefffffbfeffffbbfefffffffffffffbfefffffbfefffffffffffffffffffffbfefffffbfeffc804fe0ffffbfefffffbfefffffbfefffbbbfefffffbfeffc800fe0ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbfefffffbfefffffbfefffffbfeff |
There was a problem hiding this comment.
Could we get some screenshots of what this change looks like from the editor?
|
It's not entirely necessary, was just being prudent. The only tested-broken cast was in PlayerActivate; trying to select a lever, for instance, would sometimes hit the automap version of that lever. Unfortunately there isn't a way to make a layer default-excluded from raycasts. But I could test a couple workarounds that are more constrained to just changing the automap code. Will investigate later this week. |
… geo This solves the issue where it occasionally consumes raycasts meant to hit e.g. levers.
|
@KABoissonneault I have reworked the AutoMap so that it no longer generates its geometry at the same position as the real world geometry. I set the offset to -10,000 in the y, so it's being generated 10 kilometers below the world (Unity units, not game units - Unity units are larger). In cultural reference terms, it is now a "Backrooms" rather than an "Upside Down". Also reverted all changes to Raycasts. Tested it out, and levers work as expected. Automap functions as expected. And we still get 30fps performance gains in large dungeons, the goal of this PR. |



Moved Automap onto its own non-interacting physics layer, so we don't have to constantly enable/disable its game objects. This is a huge performance boost in large dungeons.
Also we now destroy the generated Automap geo immediately on transition to the outside. This could wait, before, because the geo was disabled; but now that we don't disable geo, we need to do it immediately.
EDIT: Ah, it was already on its own physics layer. I just set it non-interacting with other layers and removed all the then-unnecessary-and-super-unperformant enable/disable code.