Skip to content

Batch Adding and Removing Bodies [SYNTH-253], et al.#1424

Draft
azaleacolburn wants to merge 6 commits into
devfrom
colbura/253/optmize-broadphase
Draft

Batch Adding and Removing Bodies [SYNTH-253], et al.#1424
azaleacolburn wants to merge 6 commits into
devfrom
colbura/253/optmize-broadphase

Conversation

@azaleacolburn

@azaleacolburn azaleacolburn commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Task

SYNTH-168 (Symptom)
SYNTH-191 (Symptom)
SYNTH-253 (Cause)

Symptom

Spawning fields rapidly causes Jolt to crash. According to Jolt documentation, this can happen when there are too many bodies in the broadphase tree arranged in an unoptimized manner.

Solution

According to the Jolt documentation, there are two ways to ensure optimization, the first is to batch adding bodies, so they can be added and arranged in a more efficient manner. The second is to call OptimizeBroadPhase() on the jolt body interface. There's significant overhead to the second option, and its not recommended with single-threaded Jolt, so instead, we batch adding bodies of a MirabufSceneObject.

Turns out, we actually do need to call OptimizeBroadPhase() anyway, to reset the broad phase tree structure. This means that this PR probably doesn't make spawning mirabuf scene objects any faster, but should stop spawning fields from crashing and speed up fields with lots of bodies.

Source

Verification

  • Fission builds
  • All tests pass.
  • Sequentially spawning fields with multiple bodies doesn't cause Jolt to crash.
  • Performance for fields with many bodies is significantly better on my machine.

Before merging, ensure the following criteria are met:

  • All acceptance criteria outlined in the ticket are met.
  • Necessary test cases have been added and updated.
  • A feature toggle or safe disable path has been added (if applicable).
  • User-facing polish:
    • Ask: "Is this ready-looking?"
  • Cross-linking between Jira and GitHub:
    • PR links to the relevant Jira issue.
    • Jira ticket has a comment referencing this PR.

@azaleacolburn
azaleacolburn requested review from a team as code owners July 17, 2026 17:38
@azaleacolburn
azaleacolburn marked this pull request as draft July 17, 2026 17:50
@azaleacolburn
azaleacolburn marked this pull request as ready for review July 17, 2026 18:26
@azaleacolburn
azaleacolburn requested a review from Copilot July 17, 2026 18:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@azaleacolburn
azaleacolburn requested a review from rutmanz July 17, 2026 18:28
@azaleacolburn
azaleacolburn force-pushed the colbura/253/optmize-broadphase branch from 9d45a77 to d29b4a0 Compare July 17, 2026 18:55
@azaleacolburn
azaleacolburn force-pushed the colbura/253/optmize-broadphase branch from d29b4a0 to 36950f8 Compare July 17, 2026 20:39
@azaleacolburn azaleacolburn self-assigned this Jul 17, 2026
@azaleacolburn azaleacolburn added enhancement physics Relating to either the underlying physics engine or the usage of it refactor The most important part of software development. labels Jul 17, 2026
@azaleacolburn azaleacolburn changed the title Batch Adding and Removing Bodies [SYNTH-253] Batch Adding and Removing Bodies [SYNTH-253] & [SYNTH-168] Jul 17, 2026
@azaleacolburn azaleacolburn changed the title Batch Adding and Removing Bodies [SYNTH-253] & [SYNTH-168] Batch Adding and Removing Bodies [SYNTH-253], et. al. Jul 17, 2026
@azaleacolburn azaleacolburn changed the title Batch Adding and Removing Bodies [SYNTH-253], et. al. Batch Adding and Removing Bodies [SYNTH-253], et al. Jul 17, 2026
@azaleacolburn
azaleacolburn marked this pull request as draft July 20, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement physics Relating to either the underlying physics engine or the usage of it refactor The most important part of software development.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants