Repository navigation
Conversation
|
Let me know if there's something I need to adjust here, it looks like the build & test error is unrelated. |
|
I'm going to update this with a measurable performance increase as well, and stats. On hold till I get the proper benchmarks in |
|
@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
left a comment
There was a problem hiding this comment.
Requires proper starlight comments
|
@Rinary1 Updated and moved. I think I have everything with correct comments now. Let me know if I'm still missing something |
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).