L4DNation

L4DNation => General => Topic started by: ProdigySim on January 23, 2012, 05:09:49 pm

Title: Lerp Guide v2.3.4c
Post by: ProdigySim on January 23, 2012, 05:09:49 pm
The Lerp Guide v2.3.4c
by ProdigySim and Don




What is Interpolation?

Interpolation was meant to help keep gameplay smooth even when packet loss occurs, or when waiting between update packets.

When using an interpolation value of 100 ms, the game state you see (all player/object positions) is an interpolated (http://dictionary.reference.com/browse/interpolated) game state that pulls from:

Essentially, this is going to mean that with cl_interp 0.1, what you see is going to be 100 ms behind the latest game state you received. Add on a ping of 50, and your client is behind the server by a full 150 ms every time it gets an update.



What does interpolation affect?

Your average player isn't going to care much about messing with interpolation values at all, but in competitive play it can be very important.

Basically, lerp can play a lot of different important roles in melee-ranged situations. Most players will benefit from adjusting their lerp from the default value. Note that your lerp value has nothing to do with whether you actually DO lose packets or not. That's controlled by network conditions entirely. Interpolation is just one solution to combat the jerkiness caused by lost packets and by the wait between packets.

So, an interpolation setting of 0 will make you lose smoothness (most people report jerky commons and SI), but it will give you the most current game state possible on your ping, and usually give you more time to deadstop hunters and whatnot.



What should I set my interpolation to?

In general, you want a lerp that's lower than the default of 100 ms. Some people switch their lerp when changing between survivor and infected side, but any forms of lerp toggling are usually frowned upon. Current Confogl configs watch for lerp changes and announce them, and leagues and tournaments are developing rules about lerp changes.

For Survivor play you are always going to want a lower lerp.
The maximum value generally people use is 67 ms, and the lowest is 0 ms.
Other popular settings: 10 ms, 16.7 ms, 20 ms, 33 ms, 38 ms, 40 ms.


It's important to note that the time between ticks on l4d2 is 33 ms, so we basically see a split in preferring < 1 tick of interpolation and > 1 tick of interpolation. Theoretically, many of these values are redundant, and only make tiny differences in what you see on your screen and how the server calculates your position and your hits.

For infected, higher lerp values can often be useful, as survivors generally run away from SI. Usually a survivor is going to make sure he/she is just out of the tank's reach. But, if the tank is using high interpolation, he won't see the survivor start to move for an extra 100+ ms. When using lerps extremely high, such as 400 ms or 500 ms, this problem is exacerbated greatly. The same phenomenon occurs when other special infected scratch survivors.
Confogl blocks lerps higher than 100 ms for this reason.

In general, though, you can still do everything you need to do as Infected with 0 ms, so it's recommended that you set your lerp to a value you're comfortable with on Survivor side.
Also, pouncing or charging another player will get harder the higher your lerp is, because the survivor position you see will not match up with the server's model. You will find more often that you pounced/charged right through a survivor and didn't hit.



How do I set my interpolation?

Your interpolation value (lerp) is determined by the following formula based on your client cvars:

Code: [Select]
min( max( cl_interp, cl_interp_ratio / cl_updaterate ), 0.5f )
To put this in english:
Your cl_interp value is limited to a minimum value of cl_interp_ratio / cl_updaterate and a maximum of 0.5 (500 ms), and is set by the cl_interp cvar value.
Note that for example cl_interp 0.04 results in 40 ms lerp.

When setting your lerp, a good idea is to set your cl_updaterate as high as possible, your cl_interp_ratio as low as possible, and then your cl_interp to what you actually want. This will minimize the value of the cl_interp_ratio/cl_updaterate-imposed limit and let you pick what you want for interp.

For example, I use 16.7 lerp, and my autoexec contains the following

Code: [Select]
rate 30000
cl_cmdrate 100
cl_updaterate 100     
cl_interp 0.0167
cl_interp_ratio -1   // actual value will clamp to the minimum value allowed by the current server

Normal servers allow 60 updaterate and a minimum interp ratio of 1. Confogl servers lock updaterate to 30 and allow interp ratio 0. This kind of a setting covers both bases.

Note that as you can see from the code, it is normally also advised to increase your rate setting to the L4D2 maximum of 30000, which tells the server that you can receive up to 30000 bytes/s which every normal connection nowadays should be able to handle. I also like to keep my cl_cmdrate value the same as my cl_updaterate, although due to engine limitations it technically doesn't make a difference whether you use 30 or 100 cmdrate.

If you use this snippet, edit the value for cl_interp as you wish depending on which lerp you want to use.
Note that on regular servers such as VALVe's official dedicated servers, the minimum lerp you will be able to use is 16.7



So what lerp should I use?

If you are still unsure what lerp to use after reading the guide until here, I would recommend you to stick with the 16.7 lerp for now. If you see too many jerky animations, increase it until you feel comfortable with them. A lerp above 50 ms should give most users completely smooth common infected animations.



Lerp on Net Graph

The source network graph will show your your lerp value somewhere in the middle. See http://developer.valvesoftware.com/wiki/TF2_Network_Graph (http://developer.valvesoftware.com/wiki/TF2_Network_Graph) for picture.

This value is going to be your calculated final lerp value in most cases. i.e. this value will be the calculated result of the min/max formula above. This can be useful in determining if your interp-related cvars are set correctly.

The COLORS on the net graph are mostly useless to be honest. All they do is make people misread the TF2 Network Graph article and spread stupid rumors like:

Quote from: Uninformed Moron
35 on Valve servers is orange, which is okay. That represents a warning of possible lost packets. Yellow IS lost packets.

I learned all of this from word of mouth and decided to ignore all existing literature on the subject.


Yellow Lerp: The server's framerate is such that its own internal update interval is less than your interpolation time. Usually L4D2 servers calculate 30 frames per second, so, again, anything below 33 ms will show up as yellow on a Valve Official/default dedicated server. Of course, your interpolation value will still work just fine. It will just look yellow on network graph. :|

Orange Lerp: Your interpolation value is set to less than 2 / updaterate. This condition can only appear while the Yellow lerp condition is not triggered. This is also completely bullshit. It's basically a warning that when you lose packets, you'll probably see entities jump around. The value they use (2 / updaterate) Is not completely arbitrary. If you actually set your interpolation value to 2 / cl_updaterate or above, you'll have 2 extra buffer packets in your interpolation range in case any update packet ever gets lost.
Again Orange lerp is all about "What if I lose packets?" It's only a warning that entities may jump around if a packet is lost.

Neither yellow or orange lerp on network graph are indicators of packet loss or any other network issues.
If you have yellow lerp, asking the server admin to turn up the server framerate is a good idea. In practice, neither of those conditions really matter at all.




Questions and Myths about lerp

Quote from: Random Player
Shouldn't I set my lerp so it's close to my ping?

No, lerp has nothing to do with ping. Lerp is merely for creating smooth animations.
The server knows about your current ping and always automatically corrects your hitboxes when calculating hits server-side.


Quote from: Random Player
Won't my hitboxes be more inaccurate the higher my lerp is? I can even see the difference If I enable the hitboxes!

No, the hitboxes you can see with sv_showhitboxes are the server-side hitboxes. When the server calculates whether you hit a shot or not, it knows not only about your current ping but also about your current lerp and moves the server-side hitboxes of other players back in time to correct this offset.


Quote from: Random Player
Don't I need to time my deadstop differently depending on the ping or lerp of the target hunter? Don't hunters with higher lerp screw me up?

No, the pounce hit detection from hunter and jockey as well as the charge hit detection are different from the melee hit detection of scratches or tank punches. No matter what ping/lerp a hunter, jockey or charger uses, you always have to time your skeet/deadstop/level/dodge exactly the same. Your timing only depends on your own ping and lerp.


Quote from: Random Player
My Lerp is a funny color in net_graph! I'm losing packets! ABANDON SHIP! You broke my game ProdigySim!

No. Lerp cannot cause packet loss. See above section on colors.



Sources:
http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking (http://developer.valvesoftware.com/wiki/Source_Multiplayer_Networking)
http://developer.valvesoftware.com/wiki/TF2_Network_Graph (http://developer.valvesoftware.com/wiki/TF2_Network_Graph)
Experiences and extensive testing of several players from the community
Title: Re: Lerp Guide v2.3.4c
Post by: CanadaRox on January 23, 2012, 06:43:16 pm
So I just need to set sv_lan 1 to make my lerp white again so I don't get packet loss?
Title: Re: Lerp Guide v2.3.4c
Post by: Blade on February 04, 2012, 11:34:16 pm
MY LERP IS A DIFFERENT COLOR I DON'T LIKE CHANGE
Title: Re: Lerp Guide v2.3.4c
Post by: Huuwap on May 07, 2012, 10:00:02 am
Thanks for writing this up, it helped me out a lot.  That said, I still can't skeet/deadstop hunters on a regular basis...you have any console commands that'll up my skill level across the board?  lol
Title: Re: Lerp Guide v2.3.4c
Post by: Jacob on May 07, 2012, 10:25:07 am
Thanks for writing this up, it helped me out a lot.  That said, I still can't skeet/deadstop hunters on a regular basis...you have any console commands that'll up my skill level across the board?  lol

Practice my man.
Add me on steam if you want any help.
Title: Re: Lerp Guide v2.3.4c
Post by: Amigo on May 07, 2012, 10:42:33 am
Thanks for writing this up, it helped me out a lot.  That said, I still can't skeet/deadstop hunters on a regular basis...you have any console commands that'll up my skill level across the board?  lol

There is no way you will be able to hit all skeets/deadstops you want. That just doesn't happen..
Title: Re: Lerp Guide v2.3.4c
Post by: Huuwap on May 07, 2012, 10:56:40 am
There is no way you will be able to hit all skeets/deadstops you want. That just doesn't happen..
I'd be happy with 2 out of 5...just need to work on the timing.  When they're sitting still I do alright ;).
Title: Re: Lerp Guide v2.3.4c
Post by: fig newtons on May 15, 2012, 12:11:05 pm
Use zero lerp, or ten at the highest. Something under 16.7.
Title: Re: Lerp Guide v2.3.4c
Post by: Huuwap on May 15, 2012, 12:26:26 pm
I'll give it a shot.
Title: Re: Lerp Guide v2.3.4c
Post by: Amigo on May 21, 2012, 07:09:11 pm
awesome guide.
Title: Re: Lerp Guide v2.3.4c
Post by: ProdigySim on June 01, 2012, 03:54:52 am
I wrote some other words here that people might find interesting:

http://forums.steampowered.com/forums/showthread.php?t=2728355#4 (http://forums.steampowered.com/forums/showthread.php?t=2728355#4)
Title: Re: Lerp Guide v2.3.4c
Post by: fig newtons on June 01, 2012, 11:15:20 am
What's the method for achieving 0 lerp on valve servers?
Title: Re: Lerp Guide v2.3.4c
Post by: ProdigySim on June 09, 2012, 03:14:48 am
What's the method for achieving 0 lerp on valve servers?
Step 1. Use any of the unpatched exploits in this game to edit cvars
Step 2. Set cl_interpolate 0.
Title: Re: Lerp Guide v2.3.4c
Post by: koalabebop on July 22, 2012, 02:51:58 pm
great article!
Title: Re: Lerp Guide v2.3.4c
Post by: jdtyhdgfhgf on August 17, 2012, 07:44:57 pm
Would you say that using 0 lerp would be the same as using 33 lerp (if everyone had to use the same lerp)?
Title: Re: Lerp Guide v2.3.4c
Post by: ProdigySim on August 17, 2012, 11:37:53 pm
Would you say that using 0 lerp would be the same as using 33 lerp (if everyone had to use the same lerp)?
No... and I don't see the point in everyone using the same lerp.

In terms of advantages/disadvantages of lerp it's ping+lerp = total delay. So, even if everyone uses the same lerp, they all have different ping.
Title: Re: Lerp Guide v2.3.4c
Post by: jdtyhdgfhgf on August 18, 2012, 03:55:56 am
So, if the delay still depends on the ping it shouldn't matter if the minimum lerp is 0 or 33 (in terms of restrictions).

The reason I'm asking this is that as you know the witches bug much more often when nb_update_frequency is not 0.1, but if we set it at default then people that use 0 lerp complain the commons seem jerky (they shouldn't use 0 lerp in the first place I know). So we got a dilemma here.

I'm thinking of starting to limit lerps based on cl_interp_ratio 1, as that's what the minimum should be anyways, and how the netcode works (correct me if I'm wrong):
tick 30: lerps limited to 33.3ms - 100ms
tick 60: lerps limited to 16.6ms - 100ms
tick 90: lerps limited to 11.1ms - 100ms
tick 100: lerps limited to 10.0ms - 100ms
Title: Re: Lerp Guide v2.3.4c
Post by: Riven on August 18, 2012, 04:51:41 am
Is this why I get 16.3/16.4 lerp on the Pwgs when my rates are as following:

cl_interp_ratio 1
cl_updaterate 100
cl_interp 0.01

Sorry for deviating the thread.
Title: Re: Lerp Guide v2.3.4c
Post by: jdtyhdgfhgf on August 18, 2012, 05:06:32 am
Is this why I get 16.3/16.4 lerp on the Pwgs when my rates are as following:

cl_interp_ratio 1
cl_updaterate 100
cl_interp 0.01

Sorry for deviating the thread.

For now, pWg accepts lerps between 0 and 100.
Title: Re: Lerp Guide v2.3.4c
Post by: Riven on August 18, 2012, 05:22:44 am
I have no clue on why I get 16.3ms lerp then. Oh well, nevermind. I will force 10ms lerp via interp_ratio 0.

Thank you for your time.
Title: Re: Lerp Guide v2.3.4c
Post by: stabs on August 18, 2012, 07:15:31 am
So, if the delay still depends on the ping it shouldn't matter if the minimum lerp is 0 or 33 (in terms of restrictions).

Why wouldnt it matter? IMO, it's exactly because delay depends on ping that broader ranges of lerp settings should be allowed, if the very minimum legal setting was 33, that is another 33 ms of delay that players would be forced to play with, locking high-ping players into higher delay than what they already have. For low pings it's not that bad, but the higher your ping, the more that extra delay matters (counter-intuitive since the ratio is smaller with higher ping, but in my experience, high ping + high lerp is a lot more of a bitch than low ping + high lerp). Please do correct me if I'm being a moron.
Title: Re: Lerp Guide v2.3.4c
Post by: jdtyhdgfhgf on August 18, 2012, 09:41:18 am
Why wouldnt it matter? IMO, it's exactly because delay depends on ping that broader ranges of lerp settings should be allowed, if the very minimum legal setting was 33, that is another 33 ms of delay that players would be forced to play with, locking high-ping players into higher delay than what they already have. For low pings it's not that bad, but the higher your ping, the more that extra delay matters (counter-intuitive since the ratio is smaller with higher ping, but in my experience, high ping + high lerp is a lot more of a bitch than low ping + high lerp). Please do correct me if I'm being a moron.

Ping always mattered on online fps games, you can't just ignore that fact by letting people use incorrect network settings. How do you explain that in CS and CS:S people have to use the same lerp? And we're talking about a game that relies much more on hitreg than L4D/2.

Seems to me this problems comes from L4D. The competitive scene had no idea what lerp was, so everyone got used to use it at 0 like they're adjusting their crosshair color and now just the suggestion that it should be limited to ratio 1 (like every other valve game) is almost an insult. But I guess this is just one of the problems that will always remain, since people are too biased on their own interests to change to what's right.
Title: Re: Lerp Guide v2.3.4c
Post by: CanadaRox on August 18, 2012, 02:04:09 pm
Ping always mattered on online fps games, you can't just ignore that fact by letting people use incorrect network settings. How do you explain that in CS and CS:S people have to use the same lerp? And we're talking about a game that relies much more on hitreg than L4D/2.

Seems to me this problems comes from L4D. The competitive scene had no idea what lerp was, so everyone got used to use it at 0 like they're adjusting their crosshair color and now just the suggestion that it should be limited to ratio 1 (like every other valve game) is almost an insult. But I guess this is just one of the problems that will always remain, since people are too biased on their own interests to change to what's right.

CS1.6 uses very different lag compensation than the Source engine so anything in CS1.6 doesn't really mean anything here.  And I did a quick search in the ESEA CSS rules and they didn't have anything about forcing everyone to use the same lerp.

So here is how I explain it:
CS1.6 doesn't uses client side extrapolation do deal with lag compensation so changing the value could change how people move and your ability to shoot them so a single value is forced to keep the playing field even.
CSS doesn't enforce a specific lerp because changing the value doesn't actually change the way hits register and it doesn't directly improve your ability to get shots that would have otherwise been impossible, it just changes the time offset for your game state.

I don't get how changing the minimum ratio to 1 is "what's right".  If nb_update_whatever actually causes problems it should be removed.  People played with ratio 0 and choppy CI for a long time before anyone used nb_update_penis and if they want the advantage of easier deadstops they also have to deal with the disadvantage of jumpy CI.
Title: Re: Lerp Guide v2.3.4c
Post by: jdtyhdgfhgf on August 18, 2012, 09:07:46 pm
CS1.6 uses very different lag compensation than the Source engine so anything in CS1.6 doesn't really mean anything here.  And I did a quick search in the ESEA CSS rules and they didn't have anything about forcing everyone to use the same lerp.

So here is how I explain it:
CS1.6 doesn't uses client side extrapolation do deal with lag compensation so changing the value could change how people move and your ability to shoot them so a single value is forced to keep the playing field even.
CSS doesn't enforce a specific lerp because changing the value doesn't actually change the way hits register and it doesn't directly improve your ability to get shots that would have otherwise been impossible, it just changes the time offset for your game state.

I don't get how changing the minimum ratio to 1 is "what's right".  If nb_update_whatever actually causes problems it should be removed.  People played with ratio 0 and choppy CI for a long time before anyone used nb_update_penis and if they want the advantage of easier deadstops they also have to deal with the disadvantage of jumpy CI.

In CS:S you can't use 0 lerp, the minimum is based on cl_interp_ratio 1.
1 / 66 = 0.015151 ~ 15.1ms

And it's right, because no matter the tickrate, if your interp is following that formula above, you won't see commons stutter, while if it's lower than ratio 1 you will. (of course you have to test this with default nb_update_frequency)
Title: Re: Lerp Guide v2.3.4c
Post by: CanadaRox on August 19, 2012, 12:33:39 pm
In CS:S you can't use 0 lerp, the minimum is based on cl_interp_ratio 1.
1 / 66 = 0.015151 ~ 15.1ms

And it's right, because no matter the tickrate, if your interp is following that formula above, you won't see commons stutter, while if it's lower than ratio 1 you will. (of course you have to test this with default nb_update_frequency)

Well until PSim wrote the lerp tracker plugin using ratio <1 would cause issues.  In CSS you are shooting hitscan weapons at lag compensated targets (moving players).  In L4D2 you have to react based on non-lagcompensated events (player collisions) so being able to see a closer representation to live is much more important.  In CSS there is just no desire for a lerp that low because it doesn't really help the game in any significant way.  In L4D2 having a lower lerp can be a significant advantage so obviously people are interested in lower lerps.

And back to what I said before, if nb_update_frequency causes issues at non-default values, restore it to the default.  Then if players still want to use low interps that cause jumpy CI it is their own choice.  In Quake 3 you could have your FOV set to almost any value.  Setting FOV 160 was a setting you were free to set which would increase the amount you can see hugely, but you would have to deal with very high image distortion and middle that felt zoomed out.  Similarly if people want to use low interps that cause jumping CI, they get the advantage of easier deadstops but have to deal with jumping CI.  Their choice of low lerp has no affect on you and doesn't cause any issues with the lag compensation or hit registry on your end, so they should be free to set it as low as they want.  Similarly, their choice of high lerp DOES have an effect on you and causes unintuitive hit registration when you are the target so they are not allowed to use lerps that have been deemed "too high".

Your argument that it is right because common stutter is weak.  People should be free to deal with stuttering CI if they want since it doesn't have any impact on you.  We don't limit any other settings because setting it too high or low makes their game play subjectively worse so why should we prevent a low lerp if all it does is make their game subjectively worse?
Title: Re: Lerp Guide v2.3.4c
Post by: THyroXIN´- on January 14, 2013, 07:15:32 pm

The reason I'm asking this is that as you know the witches bug much more often when nb_update_frequency is not 0.1, but if we set it at default then people that use 0 lerp complain the commons seem jerky (they shouldn't use 0 lerp in the first place I know). So we got a dilemma here.


what is "the" witch bug?
Title: Re: Lerp Guide v2.3.4c
Post by: ProdigySim on January 14, 2013, 10:59:34 pm
what is "the" witch bug?
It's not "the witch bug" it's "the witches bug", with bug used as a verb.

He's simply referring to pathing failures--and since witches and commons share their pathing logic the same can happen to both. If the witch fails to path to a player it freaks out.
Title: Re: Lerp Guide v2.3.4c
Post by: THyroXIN´- on January 15, 2013, 03:43:06 am
It's not "the witch bug" it's "the witches bug", with bug used as a verb.

He's simply referring to pathing failures--and since witches and commons share their pathing logic the same can happen to both. If the witch fails to path to a player it freaks out.

ah okay,  then I know, I also had it. So NB_update_frequenzy is not an option?!

and, how come that I read fps_max 150.
Is my setting wrong haveing fpx_max 1000 and 1000 fps?
Title: Re: Lerp Guide v2.3.4c
Post by: Visor on January 15, 2013, 06:53:05 am
I've made some time ago a plugin that sets the default value of nb_update_frequency whenether a Witch draws in a Survivor's line of sight. Then it restores the initial value once she's killed/juked. Shared this stuff with step, not sure if he tested it on pwg or not.

Anyway, players really don't like this feature. They'd much rather have a smooth and retarded witch instead of a laggy and smart one. Who's to blame but not Valve? By now, any source dev in the world should've noticed that ANYTHING non-default in Valve creations causes weird shit to happen. Surely their "no bosses, do what you will" policy has its benefits, but it also has a crapload of weaknesses. Modding or modifying their games is a pain in the ass and it never goes well. That's the result of convoluted code written in a random fashion by several programmers and the lack of playtesting.
Title: Re: Lerp Guide v2.3.4c
Post by: THyroXIN´- on January 15, 2013, 04:54:52 pm
I just checked, when i execute promod nb_update_frequency is set to 0.
I tried to avoid this by insert nb_update_frequency 0.1 in promod.cfg. but its still 0 ?
is it forced by a plugin? / how can i change it back to default. before the promod is executed its 0.1
Title: Re: Lerp Guide v2.3.4c
Post by: Sir on January 15, 2013, 05:35:36 pm
I just checked, when i execute promod nb_update_frequency is set to 0.
I tried to avoid this by insert nb_update_frequency 0.1 in promod.cfg. but its still 0 ?
is it forced by a plugin? / how can i change it back to default. before the promod is executed its 0.1

The confogl.cfg in the Promod folder executes confogl_rates, which has the nb_update_frequency set to 0.
If you want it to stay at default, there's no need to add it to the config, anywhere.
Title: Re: Lerp Guide v2.3.4c
Post by: THyroXIN´- on January 15, 2013, 07:13:01 pm
The confogl.cfg in the Promod folder executes confogl_rates, which has the nb_update_frequency set to 0.
If you want it to stay at default, there's no need to add it to the config, anywhere.

well thanks, I forgot to check that file :)