More balanced CommNetThrottling performance patch#299
Merged
gotmachine merged 2 commits intodevfrom Mar 8, 2025
Merged
Conversation
…updates are now occuring at a configurable in-game seconds interval (default is 2.5 seconds), instead of a real time interval with a hard minimum of 0.5s. This mean simulation precision will stay consistent when timewarping, as updates will happen more frequently as the timewarp rate goes up, up to every fixed frame when crossing the 125x warp threshold (for the default 2.5s). We also put a upper bound on the update frequency at 50 Hz by checking the fixed/physics frame count (no point in running at stupidly high update rates on high frequency monitors or if framerate isn't locked).
… limit and a real world time minimum interval.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The current CommNetThrottling patch is a fix for the stock logic, that was inactive due to a botched implementation.
We previously had that (fixed) stock throttling mechanism as a disabled by default, opt-in patch (see PR #58).
The stock implementation and default settings of the patch is rate-limiting CommNet updates based on real-world elapsed time, 5 seconds in normal play and phys-warp, and 0.5 second in non-phys warp. Compared to what happens in stock (which isn't rate-limited at all, CommNet updates happen every visual frame), the 5 second lag in CommNet updates is quite noticeable (for example when waiting for signal acquisition after a LoS loss), and the 0.5 second hard cap is making the simulation precision quite terrible at mid to high timewarp rates.
While there are very little gameplay mechanisms affected by the loss of precision in stock, some mods are using CommNet a bit more extensively, and I'd argue that there is usually a lot more performance headroom in non-phys timewarp.
This PR propose a revamped mechanism that use an upper limit interval between updates in an in-game time set to 2.5 seconds, which is more acceptable for gameplay purposes. It also put an upper bound on the real time update frequency set to 50 hz (20 ms minimum interval), as there is no point in running at stupidly high update frequencies on high frequency monitors or if the framerate isn't locked (manually or through V-Sync). That last setting can be increased to up to 500 or even 1000 ms in case the user doesn't care about simulation precision during timewarp and want to avoid the continuous performance hit in such cases. This PR also enable the patch by default.