Skip to content

fixing items stuck in perpetual active status - #30

Open
Terkala wants to merge 13 commits into
ss14Starlight:masterfrom
Terkala:stuck_physics_item_fix
Open

Terkala wants to merge 13 commits into
ss14Starlight:masterfrom
Terkala:stuck_physics_item_fix

Conversation

@Terkala

@Terkala Terkala commented Oct 15, 2026 •

Copy link
Copy Markdown

Outcome of analysis in the "Lag Removal Investigation and Fixing" discussion thread in the pr-workshop channel in discord. Essentially, a physics item that is stuck in a wall, or comes to rest touching a wall, would never go to sleep.

This fix should allow for items that are stuck to go to sleep, freeing up physics processing space and hopefully reducing lag. Gameplay behavior should be unchanged.

Edit, expanded scope details:
In addition to this contact calc, I found that items with overlapping contact boundaries would check every physics substep, if either item had any physics applied to it. This means that if someone moved two lockers into a spot so they're touching, then for the rest of the round, twice a frame, it would check each item to see if it was physics awake or not. Individually a small check, but repeated over every possible intersecting body on station it multiplied out quickly.

My solution was to make it so that when both sides of a contact are asleep, it removes them from the list. Shrinking the queue down to just contacts that still need physics calculations. Anything removed from the list would by definition need to be inactive, and being inactive means they don't need physics calc. If either one wakes up, it re-checks to see if they have any overlapping contacts (which is what normally happens when physics is applied), and re-adds them to the queue (which is normal behavior for when one object moves into another).

@Terkala

Terkala commented Oct 15, 2026

Copy link
Copy Markdown
Author

Let me know if there's something I need to adjust here, it looks like the build & test error is unrelated.

@Terkala

Terkala commented Oct 25, 2026

Copy link
Copy Markdown
Author

I'm going to update this with a measurable performance increase as well, and stats. On hold till I get the proper benchmarks in

@Terkala
Terkala marked this pull request as draft October 25, 2026 16:16
@Terkala
Terkala marked this pull request as ready for review October 30, 2026 15:34
@Terkala
Terkala requested a review from Rinary1 October 30, 2026 15:51
@Terkala

Terkala commented Nov 7, 2026

Copy link
Copy Markdown
Author

@Rinary1 I've updated this with your requested change, and expanded it slightly to also fix a related issue with contact calculations persisting when they didn't need to (ie: two physics-sleeping lockers touching would check their physics every subtick, even when both couldn't have moved because they're both physics asleep anyway). Details in the summary.

@Rinary1 Rinary1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Requires proper starlight comments

@Terkala

Terkala commented Nov 9, 2026

Copy link
Copy Markdown
Author

@Rinary1 Updated and moved. I think I have everything with correct comments now. Let me know if I'm still missing something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants