More balanced CommNetThrottling performance patch #299
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.