AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CS:S/CS:GO] LagCompensation / 0 Ping (https://forums.alliedmods.net/showthread.php?t=321683)

BotoX 02-23-2020 13:20

[CS:S/CS:GO] LagCompensation / 0 Ping
 
17 Attachment(s)
What is lag compensation?
https://developer.valvesoftware.com/...g_compensation
https://developer.valvesoftware.com/...g_compensation

Watch this: https://www.youtube.com/watch?v=6EwaW2iz4iA

Okay, so why this plugin?
The source engine has lag compensation for player entities ONLY.
Anything else that's moving around in the server is NOT lag compensated.
This plugin fixes this for the most part.

It provides accurate and cheap (no interpolation between two snapshots) lag compensation for trigger_{hurt,push,teleport} and func_physbox* entities which are parented to moving entities.
It does this automatically and avoids breaking

How does it work?
The plugin remembers the last 32 (configurable) states of up to 256 (configurable) entities.
It keeps track if entities are actually moving and only compensates them if they are.
There are barely any performance implications of running this plugin, especially because it also optimizes how triggers work. If a trigger is lag compensated it will not run any physics simulation any more.

Usually a moving trigger would be actively scanning and touching any entity in its collision hull.
To make lag compensation possible this is blocked with the PhysHooks extension and now only players will be touching triggers.
Before a player is simulated, all (active/moving) entities are moved to where they are on their screen. This is done for each player.
At the end of the player simulation loop the compensated entities are restored to their server state.
After the entities have been simulated their parameters are recorded.

Issues
Moving platforms/trains are not lag compensated. If a trigger is parented to it, it will be lag compensated however.
Imagine a thin platform with a kill trigger parented on the bottom of it. If a player stands on the platform and it moves up the trigger on the bottom will move through the platform, into the player and kill them.
In this case you'll have to modify the map with something like stripper-source and add the no-lagcomp flag to the trigger.

Only letting players touch triggers comes with some issues on CS:S however, if a player stops sending packets to the server they are not simulated at all any more. Hence they will not touch any triggers that move through them.
CS:GO seems to have a fix for this in built. For CS:S I've included a plugin AntiLagSwitch which forces player simulation with empty packets after the server didn't hear from them for 16 ticks.

Because source has no client side prediction of triggers and we can't cheat the laws of physics something else has to be delayed now: death.
You play with 300ms ping and seemingly jump over a laser, only to die after it has already passed you.
A smart player will obviously scream "fucking 0 ping botox you gamer-word" into the voice chat.
A not-so-smart player will realize they made a mistake and it's just the information of their death which had to travel for 300ms before reaching them.

3rd person and server demos view for players with lag compensation enabled will look weird, they will touch lasers on your screen but not die.
This makes sense of course because on their screen they've jumped over the laser, that's the whole point of lag compensation.
To get an accurate view of their screen the demo needs to be recorded in their client.

Usage
Install the DHooks + Detours extension: https://forums.alliedmods.net/showpo...&postcount=589
Install the PhysHooks extension: https://forums.alliedmods.net/showth...09#post2684809
Install the LagCompensation.smx into your plugins/ folder and LagCompensation.games.txt into your gamedata/ folder.

If you want to avoid a trigger (or physbox) from being lag compensated by this plugin then you can add the value 1073741824 (1 << 30) to the spawnflags of the entity.

Players can choose to effectively this plugin by using the commands: !lagcomp or !0ping
(effectively: the plugin will always take the newest entity snapshot for those players, it will assume the player actually has 0 ping)

Thanks to:
All players and staff of UNLOZE Zombie Escape server.
While developing this plugin there have been many bugs and weird things happening for weeks.
Thanks for not pulling the plug and letting me continue working on this until all issues have been fixed.
Special thanks to xen for a lot of help with testing and investigating issues.

POSSESSION and ZombiEden for testing the CS:GO Win32 version and helping with windows signatures.

Obviously the SourceMod project, without SourceMod most of our mods would be incredibly harder or outright not possible.

Dr!fter and Pyschonic for DHooks + Detours.

The leaked 2007 engine source code provided insight into the depths of the engine, PhysHooks makes heavy use of this.

Video demonstration
Don't jump as early as this guy:
https://www.youtube.com/watch?v=ubZtbI0xCGE
In the past you had to jump lasers very early depending on your ping and lerp, because there was no lag compensation.
Now you'll just die because you fall into the laser.

Git repository
https://git.botox.bz/CSSZombieEscape...agCompensation

Donations
CS:GO Windows source code and builds have been released publicly after I've received donations in total of 200€.
Supporting Windows requires a lot more effort, debugging it even more. It's also really stupid to run a Windows server when Linux causes a lot less trouble.
https://paypal.me/BotoXbz
50€ - Net4All.ru
20€ - JAZE
60€ - GFLClan.com
65€ - Kxnrl
70€ - Mapeadores.com

Groven 02-23-2020 13:23

Re: [CS:S/CS:GO] LagCompensation / 0 Ping
 
Looks very interesting :)

extr1m725 02-23-2020 13:43

Re: [CS:S/CS:GO] LagCompensation / 0 Ping
 
Sent 20 euros, thank you for the great plugin!

NanoC 02-23-2020 14:48

Re: [CS:S/CS:GO] LagCompensation / 0 Ping
 
Fantastic Botox!

Zeddy_god 02-23-2020 16:22

Re: [CS:S/CS:GO] LagCompensation / 0 Ping
 
Good stuff man! Thankyou for the release.

Syoudous 02-23-2020 17:15

Re: [CS:S/CS:GO] LagCompensation / 0 Ping
 
I'm not too familiar with Source innards but I do know CS:GO bloated itself with more lag compensation over the years. Do LagCompensate key values make no difference in a situation as is this on entities?

BotoX 02-23-2020 18:42

Re: [CS:S/CS:GO] LagCompensation / 0 Ping
 
Quote:

Originally Posted by Syoudous (Post 2684835)
I'm not too familiar with Source innards but I do know CS:GO bloated itself with more lag compensation over the years. Do LagCompensate key values make no difference in a situation as is this on entities?

CS:GO indeed has an option to lag compensate other entities by the means of the LagCompensate FGD.
However that probably only works on stuff you can shoot, definitely not triggers.
I am not sure if any maps with moving bosses etc make use of that FGD and what happens when both are active.
The plugin was made with CS:S in mind, so it doesn't take this into consideration (yet).
I guess I could make the plugin check for that FGD and either remove the FGD or ignore the entity.
Just hope that nobody set the FGD on moving triggers and then those are not lagcomped at all.

Syoudous 02-23-2020 19:21

Re: [CS:S/CS:GO] LagCompensation / 0 Ping
 
Quote:

Originally Posted by BotoX (Post 2684841)
The plugin was made with CS:S in mind, so it doesn't take this into consideration (yet).
I guess I could make the plugin check for that FGD and either remove the FGD or ignore the entity.
Just hope that nobody set the FGD on moving triggers and then those are not lagcomped at all.

Yeah, I understand that and I know CS:GO isn't totally your thing and this isn't something I looked into myself but I figured someone here (or the people testing your idea/stuff) would shed light on this if it actually has any effect at all. This is supported on all entities. If it is effective at all, I have not a clue. I never personally tested it nor really thought much of it.

I do know L4D2 (which this game's engine at least partially uses) used it heavily for a lot of stuff than just NPC's.

694372459 02-24-2020 02:03

Re: [CS:S/CS:GO] LagCompensation / 0 Ping
 
botox changed ze xd

BReeZ 02-24-2020 07:24

Re: [CS:S/CS:GO] LagCompensation / 0 Ping
 
Trying to understand this plugin.
So players playing on a server that is located far away (example: US player on an EU server) would normally have delay after entering a teleporter, or hit a triggerpush of sorts.

Would this make it feel snappier, more instant?

Similar to how valve added clientsided autobhop compared to the server sided laggy bhop plugins (CS:GO)?


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

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