fishfolk / jumpy

Tactical 2D shooter in fishy pixels style. Made with Rust-lang 🦀 and Bevy 🪶
https://fishfolk.org/games/jumpy/
Other
1.59k stars 116 forks source link

Game grinds to a hault / bug in physics / crash in parry2d qbvh #961

Closed MaxCWhitehead closed 3 months ago

MaxCWhitehead commented 3 months ago

Description

I was having some issues crashing in parry2d QBVH, sometimes a crash and sometimes game grinding to hault or hanging. Did some research and not the only ones hitting this - updated parry2d for a fix. Some additional context here: https://github.com/fishfolk/jumpy/pull/960

Thought that fixed it but I repro'd the slowdown again. I saw thousands of move_vertical and other operations update_kinematics inside a frame in puffin data. Not totally sure if should read too much into puffin in an error state, but just taking note. Going to try to repro with debugger attached and gather more info.

To Reproduce

(May be able to repro in local play, but these are the conditions I encountered it in).

  1. Start two jumpy clients
  2. Start online game
  3. Play game as normal on one client, kill other player, interact with items, etc.
  4. Observe either a crash, or FPS slowing down rapidly until totally frozen.

Expected Behavior

No response

Additional Context

No response

Log Messages

No response

MaxCWhitehead commented 3 months ago

Even if not a full death spiral, physics perf seems to also sometimes degrade over time. Likely due to BVH becoming inbalanced / degenerating based on notes relating to issues / fix in parry2d repo.

image
MaxCWhitehead commented 3 months ago

Sounds like the fix upstream was actually to just rebuild the BVH after it gets unbalanced enough, instead of crashing. So there is still a bug at large in parry2d causing degenerate tree, which makes sense why the issue moved from a crash to just being slow...

EDIT: But this is still much worse than rebuilding BVH every frame, as if it doesn't degenerate far enough to trigger rebuild, perf tanks.

MaxCWhitehead commented 3 months ago

Mitigated by #962, will keep an eye on upstream to see if we can remove this down the line. Will open an issue describing this problem in parry2d, as the other handful of issues were closed with recent fix, but it still seems to be a big problem.