AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Snippets and Tutorials (https://forums.alliedmods.net/forumdisplay.php?f=112)
-   -   [ANY] Improve Latency (https://forums.alliedmods.net/showthread.php?t=339591)

000 09-19-2022 11:10

[ANY] Improve Latency
 
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.

Bacardi 09-19-2022 13:17

Re: [ANY] Improve Latency
 
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.

000 09-19-2022 13:35

Re: [ANY] Improve Latency
 
Quote:

Originally Posted by Bacardi (Post 2789190)
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).

luki1412 09-23-2022 07:18

Re: [ANY] Improve Latency
 
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.

000 09-23-2022 12:50

Re: [ANY] Improve Latency
 
Quote:

Originally Posted by luki1412 (Post 2789474)
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.

Bacardi 09-23-2022 14:59

Re: [ANY] Improve Latency
 
...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.

000 09-23-2022 15:17

Re: [ANY] Improve Latency
 
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.

000 09-23-2022 15:54

Re: [ANY] Improve Latency
 
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.

luki1412 09-24-2022 13:06

Re: [ANY] Improve Latency
 
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

000 09-24-2022 20:30

Re: [ANY] Improve Latency
 
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.

luki1412 10-02-2022 04:58

Re: [ANY] Improve Latency
 
Quote:

Originally Posted by 000 (Post 2789589)
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.

No, you're the one not getting a simple message I posted.

Read the official documentation and stop embarrassing yourself with your "low latency trick" if you have no idea what you're even doing. Nothing about this is a trick, you just don't get how it works.
https://developer.valvesoftware.com/...yer_Networking

It's not only for CSS! These commands are available in all source engine games.
You're setting client settings for them from the server. You already have access to sv_ commands that ENFORCE them in the first place. You're scratching your left ear with your right hand while thinking you're some genius.

For some reason you think that sv_ commands and cl_ commands do not work together and change completely different things. CL_ is a client's PREFERENCE. SV_ is a server's ENFORCEMENT. If you set your CL UPDATERATE to 100000, that doesnt mean your game will use 100000 updaterate. The server is sending data to you, at the rate it is set to. If it has sv_maxupdaterate set to 60, your cl_updaterate is now 60, even though you set it to 100000. You can only set your CL preferences to a value in BETWEEN what server allows. You don't even take tickrate into account which is the actual max limit.

Im not going to waste any more of my time. People who understand how rates work, don't need a plugin for them.

luki1412 10-03-2022 09:23

Re: [ANY] Improve Latency
 
Quote:

Originally Posted by 000 (Post 2790216)
First of all I want to say that I go through life being nice and (where possible) humble - with respect and understanding, whoever it is.

And I am not on these forums searching for my honor. I am here because I've chosen these very things in my life for the sake of passion.

This might help you:
https://en.m.wikipedia.org/wiki/Gautama_Buddha


That's fine. You might be right. But you never proved that I am wrong (for example by a simple video). At this point, I don't understand how someone could be arguing without delivering a crystal clear proof at least once.


I have never stated that it was a trick, rather a question.

I have no reason to be embarassed at all. If you don't mind, it'd like to quote Richard Feynman as to why:

As I get older, I realise being wrong isn't a bad thing like they teach you in school. It is an opportunity to learn something. - Richard Feynman

Also, why should I let my life be negatively (or at all) shapen by how someone percieves me or would.

These are two of many reasons.

Also regarding your attempted humiliation: <projection, displacement>


I know that these commands are available in all source engine games. Nevertheless, I also stated that I am not an expert.


Again, attempted humiliation because of feeling deeply ashamed and/or disgraced. With that being said:

Is it what you know or what you think?


I never stated that. I just described the behaviour.

Also, these values are bound to the tickrate. I think it is self-explanatory. If not, then it is out of scope of this topic.

Again, prove it that I am wrong, that the stated behaviour cannot be observed. If so, I did a big, catastrohpic, mistake (If you want so) by publishing without testing it beforehand (and just let my memory do it) and this thread can be trashed. Where is the problem?


Let's ignore the fact that it should cause humiliation.

That is fine. After all, it is your life and time.

My personal opinion about you (since you had yours about me):

All in all you are going to ruin relationships and a happy, fullfilled life with that kind of mindset, only because no one has ever (to this point) told you about it. But that is what I think.

And after all the best I could do, you will etheir take my hints serious and move on peacefully (and I'm sure you are going to check this here again, nevertheless) or you will take this is personal, without gratitude, insisting on your actions to be rightful, and remain bitter.

I could have easily destroyed your life over the internet, because obviously I know yourself better than you do. Some people, like psychopaths for example, would do that, just because you acted this way. And they can do that with you (yes, over the internet). And some of them are in the military, specialized in Informatics. You are ignorant and light-headed. Where I come from this gets you killed.

Instead, I gave you all the keys you need to make something out of it. And you could, you are intelligent enough.

You have to understand that those what you feel are just feelings. You don't have to let them shape your life.

I, sincerely (really, I am honest), wish you a good path to go.

This might help you on your path well:
https://en.m.wikipedia.org/wiki/Self-awareness
https://en.m.wikipedia.org/wiki/Self-consciousness
https://en.m.wikipedia.org/wiki/Psyc...cal_projection
https://en.m.wikipedia.org/wiki/Disp...nt_(psychology)
https://en.m.wikipedia.org/wiki/Cognitive_dissonance
https://en.m.wikipedia.org/wiki/Metacognition

I would recommend to not limit one self just to wikipedia. Instead, other sources and expierence is a good way to go - studying.

Also: I am not your bro, you bellend.

Best regards.

Do you misunderstand everything on purpose?

Mr. Bellend, that was not an attempt to humiliate you, it was an attempt to point out how wrong you are and how stubborn you are about being right, when you're wrong.

For a person that is supposedly always trying to be nice, you seem very eager to try and humiliate me and even ended up using childish insults.

I have proved it multiple times, you just don't get it. It's that simple. Im not going to waste my time making a video. Let me make this extremely simple for you so even your compressed brain can understand it this time:
- your plugin only enters convars on behalf of the users themselves
- the server will still not use them unless the sv_ convars on the server have the same or lower(higher) value
- instead of this plugin you could just adjust the sv_ convars on the server, making the plugin redundant

Is this simple enough for you? Do you need a 12-step tutorial?

You behave like a little child and then try to win an argument with quotes about honor and respect.

There is no honor or respect in your last message.

There is nothing wrong with not understanding something. You could have just asked me nicely to explain it better, but you didn't want that. You can't admit you're wrong, ever apparently. Every message you posted just keeps confirming it.
"Im still right" seeping from every message.

You've betrayed the values you seemed to care so much about. You've stooped lower just to prove that you're higher.
You've failed today.

This is of no interested to anyone anymore. You've ruined the thread with your ego. I'm not going to continue with this any longer. This is my last post in here. Good luck with your "little trick plugin".

PS: you could have just made a post about rates and autoexec.cfg instead

Spirit_12 10-03-2022 18:15

Re: [ANY] Improve Latency
 
This topic is not useful at all. Please categorize it as trash and close it.


All times are GMT -4. The time now is 23:45.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.