https://ee2.eu/patch/changes/#156020
The fix reduced the sleep in the Multiplayer's ENet thread from 30 to 1 ms.[156020 - 2017-12-28]:
* Added fixes to reduce ping (delay) between the host and players by ~30 up to 60 milliseconds.
Yesterday, this is 26 of October 2024, we detected an anomaly in games with too low ping between players. The anomaly was the following:
- When player GenialnyŹółw joined my room, we had ping of 22 ms. Once the game was started, we noticed a strange mini-freezes, noticeable especially when fighter jets were moving. It didn't affect the command lag, everything was still perfectly responsive, but the game felt slower.
- When player GenialnyŻółw was hosting the game, the mini-freezes were less noticeable, but still existing.
For the testing purposes, I modified remotely the sleep in the ENet thread:
- When restored default EE2's "30 ms" the mini-freezes (units slowdown) were gone.
- Setting values lower than ~15 were causing the mini-freezes to appear again.
- Setting the value of 0 solved the mini-freezes problem competely.
Theory of the reasons that cause it:
- This is most likely a bug or some security fix in Windows, that causes functions WaitForSingleObject or Sleep to take more CPU time than expected (or simply inaccurate time). Since I recently upgraded to Windows 11 24H2, this feels like the most probable scenario.
- High-end processors with the high clock speed. Since I use Ryzen 9 5950X and I have more mini-freezes (when hosting the game) than player GenialnyŹółw with a worse processor, it's possible that the reason are some AMD fixes or simply the data is being processed on my computer too fast. Ironically, the better processing speed could be affecting it, but it's unlikely.
Solution:
- As a solution, I have remotely set the ENet Thread's Sleep time to 0 milliseconds, for all Unofficial Patch users. This means that we disable the thread sleep completely, and prevent the WaitForSingleObject or Sleep functions from being called by the ENet thread.
Possible problems:
- Very unlikely, but this hotfix might increase the CPU load on the processor core that EE2 uses for Multiplayer. This is very unlikely, because both players would need to have ping "0" between each other. Since there is always a delay, we can assume that the thread is anyway waiting for data from players and doesn't loop infinitely. This is still something to observe and report in this topic if you experience such problems.
- As always, we cannot predict what other issues can appear when the sleep is removed completely, therefore it's important that multiplayer users report the NEW issues they noticed in this topic.
What you have to do?
- You don't need to do anything, as the ENet Threa'd Sleep removal was applied to all users with the Unofficial Patch Keep Alive system. It's important to have a working Internet connection before starting the Launcher / game, so that the new configuration value is downloaded from the EE2.eu server. In any case, it's important to notify me about NEW issues that you notice during multiplayer matches.