velocity wrote:I guess you are right, thanks for the optimization it helped a lot.
I've been running some tests locally with 19 bots by running the
code you posted on GitHub and while the net_graph was bouncing red sometimes, I didn't notice any "lags" whatsoever while playing. I've also joined some of the most populated servers and some of them were very high but the game-play was still very smooth:
So my question here is, do you notice lags that are disruptive to the game-play or your concerns are solely based on the net_graph? If the later, I assume the net_graph itself shows red based on what the game would expect to run at without mods, etc.
A hook to set_transmit is brutal, to be honest. After some testing, on de_nuke with 19 bots and myself playing normally, the hook is called ~1300 times
every frame. When we say that tick listeners are hungry, this is like having 1300 of them in the same plugin.
There are a lot of way you can optimize your implementation. Just to name a few; caching, learning, and exiting early. I can help you to find and implement better approach assuming you are willing to share very specific details of what your goal is.