Source-1-Games icon indicating copy to clipboard operation
Source-1-Games copied to clipboard

[TF2, Any] Increase the MAX_RATE for netchannel

Open sappykun opened this issue 1 year ago • 0 comments

The maximum rate for the netchannel in most Source games is hardcoded to 50000 bytes per second (50 kB/s). I would like to request an increase to the default maximum rate.

Netchannel is used for client file transfer, like player sprays and jingles. I believe it is also used for transferring map files if a fastdl server is not specified.

I have a Sourcemod plugin here that allows players to resize their sprays, but a lot of code is dedicated to working around the incredibly slow download speeds to ensure that sprays are cached properly for as many people as possible.

The easiest solution would be to change MAX_RATE in netchannel.h to a higher value. This value is only used once in SetDataRate to clamp the rate value. If applicable, a few convars could be added to control the min and max channel rates on both client and server similar to rate, sv_minrate, and sv_maxrate.

I believe this is a worthwhile change because:

  • it is a relatively simple change, one line if the convars are not added
  • improves file download for sprays, meaning they show up on clients faster
  • allows listen servers to send files quickly without the need for external hosting (though I suspect this is a rather unpopular method of server hosting)
  • allows Sourcemod plugin developers to send files to clients in the middle of a match at a much higher speed (for example, sending players a map file while they're playing so they don't have to wait for the download on map change). It's technically possible already, but 50 kB/s limits what can be sent in a reasonable time.

TF2's 64 bit beta is already updating some other hardcoded values like the entity limit, so this request is mostly for TF2. However, it is a change that I think benefits any Source engine game.

sappykun avatar Feb 12 '24 23:02 sappykun