Raised This Month: $ Target: $400
 0% 

[ANY] Improve Latency


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
000
Senior Member
Join Date: Jul 2022
Old 09-19-2022 , 11:10   [ANY] Improve Latency
Reply With Quote #1

Well, it should be a controversial topic.

Anyway, I would like to share with current and future server operators a little trick(?) I discovered when I was younger and still had game servers for Counter-Strike: Source.

Improve player latency:

I had noticed that when default rates of clients were lower then those of the server, latency decreases.

This can be achieved as follows:

PHP Code:
#include <sourcemod>

public void OnClientPutInServer(int iClient)
{
    
ClientCommand(iClient"cl_cmdrate 30");
    
ClientCommand(iClient"cl_updaterate 20");
    
# OR
    
FakeClientCommand(iClient"cl_cmdrate 30");
    
FakeClientCommand(iClient"cl_updaterate 20");

Since I'm not an expert on this subject (and I lack a lot of knowledge about it), I can't explain anything meaningful.
Attached Files
File Type: sp Get Plugin or Get Source (imprv_latency.sp - 34 views - 161 Bytes)

Last edited by 000; 10-02-2022 at 12:10.
000 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-19-2022 , 13:17   Re: [ANY] Improve Latency
Reply With Quote #2

Code:
'Bacardi connected.
FCVAR_SERVER_CAN_EXECUTE prevented server running command: cl_cmdrate
FCVAR_SERVER_CAN_EXECUTE prevented server running command: cl_updaterate
Plugin does nothing, unless you are running very antique cs:s version.
Bacardi is online now
000
Senior Member
Join Date: Jul 2022
Old 09-19-2022 , 13:35   Re: [ANY] Improve Latency
Reply With Quote #3

Quote:
Originally Posted by Bacardi View Post
Code:
'Bacardi connected.
FCVAR_SERVER_CAN_EXECUTE prevented server running command: cl_cmdrate
FCVAR_SERVER_CAN_EXECUTE prevented server running command: cl_updaterate
Plugin does nothing, unless you are running very antique cs:s version.
Hmm. Now I am questioning if it really worked back then or if I had changed something else as people started to complain. Without the plugin (if you do it yourself with console) it does work however.

I just tested it right now and it working. I guess it is not working on dedicated servers (the plugin).

This thread is trash then.

(Although for clients on their end it can be useful to know).

Last edited by 000; 09-25-2022 at 00:29. Reason: unrelevant text.
000 is offline
luki1412
Veteran Member
Join Date: Oct 2008
Location: OnPluginStart()
Old 09-23-2022 , 07:18   Re: [ANY] Improve Latency
Reply With Quote #4

cl_cmdrate - This command sets the max number of command packets that are sent from your client to the servers each second.

cl_updaterate - This command is used to set the number of packets per second of updates you request from the server.

Its not really a trick when you lower them. Servers can also enforce them via server commands:
sv_mincmdrate sv_maxcmdrate sv_minupdaterate sv_maxupdaterate

If you lower them, you send and receive less data but that also means that your game has to simulate where a player is, more often. Could be missing your shots more due to that.
__________________
luki1412 is offline
000
Senior Member
Join Date: Jul 2022
Old 09-23-2022 , 12:50   Re: [ANY] Improve Latency
Reply With Quote #5

Quote:
Originally Posted by luki1412 View Post
cl_cmdrate - This command sets the max number of command packets that are sent from your client to the servers each second.

cl_updaterate - This command is used to set the number of packets per second of updates you request from the server.

Its not really a trick when you lower them. Servers can also enforce them via server commands:
sv_mincmdrate sv_maxcmdrate sv_minupdaterate sv_maxupdaterate

If you lower them, you send and receive less data but that also means that your game has to simulate where a player is, more often. Could be missing your shots more due to that.
Yes, but the point was:
Quote:
I had noticed that when default rates of clients were lower then those of the server, latency decreases.
That means while we want clients to have default rates (cl_cmdrate 30 and cl_updaterate 20), the server shall enforce higher values and thus resulting in lower latency for clients.

This is the observed bevahiour (you can test it by yourself by joining a server where sv_mincmd/up is higher then 20 and 30 using said rates above and once again with higher or equal values to the server. The former will decrease latency).

For example:
Server using sv_mincmdrate 66 and sv_minupdaterate 66 and client joined with cl_cmdrate 30 and cl_updaterate 20 equals to lower latency.

Where when client joins with cl_cmdrate 66 and cl_updaterate 66 equals to higher latency.

And like I said: Apparently, it cannot be achieved this way anymore (via ClientCommand). Bacardi might be right that it might work in way older versions of CS:S. But I don't remember when I did this (guess pre orangebox). At this point it doesn't matter.

Last edited by 000; 09-27-2022 at 07:03.
000 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-23-2022 , 14:59   Re: [ANY] Improve Latency
Reply With Quote #6

...to clarify also, rate, cl_cmdrate, cl_updaterate are client side console variables.
Means, these just hold value, what you set in your own game.
- Means, you should not follow/check clients cvar values.

*seems game now change cvar value when you join in server as well.
But it revert values back when you disconnect from server.

Code:
] cl_updaterate 
"cl_updaterate" = "66" ( def. "20" )
** NOTE: The real value is 10.000 but the server has temporarily restricted it to 66.000 **
 archive notconnected
 - Number of packets per second of updates you are requesting from the server
] cl_cmdrate 
"cl_cmdrate" = "66" ( def. "30" ) min. 10.000000 max. 100.000000
** NOTE: The real value is 10.000 but the server has temporarily restricted it to 66.000 **
 archive
 - Max number of command packets sent to server per second
] rate
"rate" = "66000" ( def. "80000" )
** NOTE: The real value is 3500.000 but the server has temporarily restricted it to 66000.000 **
 archive
 - Max bytes/sec the host can receive data



Another thing, even today in cs:s, game default values comes mostly from from HL2 game,
which are very low values and for singlegame play.

Back in day of cs:s era, people wrote a lot of recommended rate settings for cs:s in web sites, but those were mostly for HL1 mod Counter-Strike.
For example rate 24000, cl_upraterate 100, cl_cmdrate 100
- which is very low rate for high update rate. Players made CHOKE for themself.
- 66 tickrate is now default speed.

Then there was old calculator which people looked even today
http://web.archive.org/web/202111290.../drekrates.php
- This give also wrong answers.


But, for reduce lag with higher count of players:
- Better decrease updaterate and set rate very high.

for min. rate setting is 1000 x updaterate, this depend how well map is made and player count.

This is my (shame) calculator, I practised java script and html few years ago
ambaca.github.io/rate-calculator-2015/

But calculations are very simple. And you need look net_graph 5 from in game.
__________________
Do not Private Message @me
Bacardi is online now
000
Senior Member
Join Date: Jul 2022
Old 09-23-2022 , 15:17   Re: [ANY] Improve Latency
Reply With Quote #7

To clarify again:
The server will enforce the players' rates resulting in low latency. There can be the case where it might become to much for the client. At this point however you shouldn't even play the game. Buy a new computer and/or more bandwidth.

About server specific stress:
You don't have to force the example (of 66 updates) above. I stated that whatever your rate settings for the server are (and as long as they are higher then the clients') it will result in way lower latency.

And clients using the default rates on their end has the best results. I've tested it without problems on a 64 slots full zombie server. I encourage everyone to try themselves.

However, what the pros and cons in detail are (for client and server) I don't know.

Also:
Server rates should never be default (sv_mincmdrate 10/sv_minupdaterate 10) because clients (especially back then) will not know about rates and would use the games default ones in multiplayer resulting in a bad expierence. The min value should always be 33. If you can't afford a server that can handle that, better don't make servers.

Dropping below 33 is allowed. But should not do (optimize your server, maps etc).

The same applies for clients: If you can't handle min 33 (your fps will be +/- 33), don't play the game (but that dependents on factors like players amount, map quality, graphic settings etc).

It is relative.

Nevertheless, I have to say that in the golden age of CS:S most large and popular servers had low-end settings (especially zombie servers) and people didn't bother. They could've had a better expierence however. And since 2015 or something this changed dramatically. All low-end servers died out. The few that remain are high-end - ofc the slow death of community servers is responsible for this as well.

Note: The text above focuses on CS:Source.

Last edited by 000; 10-02-2022 at 12:41.
000 is offline
000
Senior Member
Join Date: Jul 2022
Old 09-23-2022 , 15:54   Re: [ANY] Improve Latency
Reply With Quote #8

Reserved. I might (when I have more time) give detailed cases of rates and it's relevance to my actual post.

Edit: Not interested + topic is out of scope.

Last edited by 000; 10-02-2022 at 12:19.
000 is offline
luki1412
Veteran Member
Join Date: Oct 2008
Location: OnPluginStart()
Old 09-24-2022 , 13:06   Re: [ANY] Improve Latency
Reply With Quote #9

Bro you made a plugin that enters client commands for clients themselves. You already have access to sv_* commands to set them at that point and trying to set their client commands does not exclude them from the settings set by sv_* commands. Sv_* settings OVERRIDE cl_* settings.

Set sv_minupdaterate to what you want to allow them to use, like 30 and set max to server tickrate. This way the players can use lower and higher updaterates. Same goes for cmdrate. Your plugin does nothing if sv_min* commands are set to something higher.

PS: 66,6 is tickrate for tf2 but not cs, where it is 64 and 128. l4d2 uses 30
__________________
luki1412 is offline
000
Senior Member
Join Date: Jul 2022
Old 09-24-2022 , 20:30   Re: [ANY] Improve Latency
Reply With Quote #10

I guess you didn't test it in CS:S, else there wouldn't be any argument. And you were not attentive to what I have written.

Last edited by 000; 09-25-2022 at 01:25.
000 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:20.


Powered by vBulletin®
Copyright ©2000 - 2022, vBulletin Solutions, Inc.
Theme made by Freecode