Author Topic: Lerp, A Study  (Read 10358 times)

Offline w0rthy

  • Member
  • *
  • Posts: 6
Lerp, A Study
« on: June 13, 2013, 04:15:35 pm »
***************************
Linear Interpolation*************
***************************


What is lerp and what does it effect?

From what I've found so far, Lerp is the amount of time after recieving an update from the server that a linear interpolation will be made. This is basically added lag after you go above the threshold which will be mentioned later.
For the effects I will use different lerps as an example of its behaivor:

   At 0 lerp : there is no interpolation and you are seeing just the positions sent from the server. This is equal to having cl_predict set to 0.

   At 10 lerp : on a 100 tick server, this gives you maximum efficiency as you are predicting with fresh data exactly on every tick which is when you receive packets. Rockets no longer make quick, sharp curves from prediction errors and airblasting is now consistant as you are in sync with the server.

   At 100 lerp(default) : you will have to airblast farther away as your interpolations are 90ms behind the server's updates. Your ping of linearaly interpolated objects is now excessively high.

   At 500 lerp : the separation between the color of the rocket glow which isn't interpolated and the rocket which is, is now very evident. Your ping is now 490 if you are playing on the hosted server and you should give up on life.



How do I find the optimal lerp?

The optimal lerp is the default minimum of the cl_interp client variable. This is your cl_interp_ratio / server's cmdrate or tickrate. On 100 tick servers this is 0.01 which is 10 lerp.
But wait, Dodgeball Hell and Voogru aren't 100 tick servers. They are actually 66 tick but have the settings of a 100 tick server allowing 100 cmdrate and updaterate. Even though your cmdrate says 100 you are not actually getting 100.
The actual cmdrate of these servers is 66. This brings the optimal lerp to about 15. and also makes people running at 100 cmdrate and updaterate have more prediction errors. This is because the server has to send 100 packets in a second

while only thinking 66 times a second. This may cause multiple packets to be sent in one tick causing prediction errors and un smooth movement.

However, there are advantages to lowering lerp below 10.
The closer to 0 your lerp is the closer the rocket can get to you to hit it and the less the gap between faster rockets and slower ones.
Here is distances required to hit in meters for 50 mph and 200 mph rockets and varying lerps. These are calculated with 0 ms ping.

Lerp          50 MPH          200 MPH          Difference
0               0                    0                     0
2.5            .125               0.5                  .375
3.3            .165               .66                  .495
5               .25                 .1                    .75
7.5            .375               1.5                  1.125
10             .5                    2.0                 1.5
100(default) 5              20                 15(ewww)

Although 0 lerp comes out on top, 0 lerp also experiences extreme "rocket lag" where projectiles will glitch around and make sudden turns and motions.
10 Lerp has none of this as it is running with the server, so it will be extremely smooth.

Due to this you can either choose the unsmooth but consistent 0 lerp, the more inconsistent distance but smooth 10 lerp or one in between. Throughout the years my favorite lerps were 2.5 and 3.3. I did use 0 from time to time and did fairly well with it. 2.5 and 3.3 had some smoothness which helped the most and the distance wasn't anywhere close to unbearable. Another popular lerp is 7.5 which is smoother but more distance inconsistency than lower ones. In the end the choice is yours, whichever is more comfortable is the one you should use.



What commands do I use to set my lerp?

cl_interp_ratio 1
cl_interp "whatever lerp you want / 1000"

***********
Smooth******
***********


cl_smooth is a client variable that enables smoothing after prediction errors. This is your choice as after finding the frequency of prediction errors it is usually seen with multiple turns between packets like when orbitting. !!!!!This should be off if your lerp is below 10!!!!!!
cl_smoothtime should be your lerp or if that is not reachable the lowest obtainable on the server, which happens to also be cl_interp_ratio / server updaterate.

*********************
Other Settings***********
*********************


Other settings I use and believe benefit my performance will be listed below with their description.

"mem_max_heapsize" increases the amount of memory available to hl2.exe's heap.

"datacachesize" increased cpu data cache used which in turn made tf2 run faster but seems to have broken after an update.

"fps_max" this should be set to your updaterate/cmdrate so you draw every time you receive packets.

"rate" this changes the amount of bandwith hl2.exe will use. Set this to your updaterate*100

"cl_pred_optimize" effects the way prediction errors are handled, most set it to 2.

"mem_compact" performs garbage collection on the memory freeing up more space and making tf2 run faster every time it is called. I have this bound to a key that I smash a couple times every now and then.

********************
My Configs*************
********************


Carnifex 2011

w0rthy 2012 1

w0rthy 2012 2 (prime)

w0rthy 2013 (current)
« Last Edit: January 25, 2014, 01:01:22 pm by w0rthy »

Offline Evanbick

  • Member
  • *
  • Posts: 4
Re: Lerp, A Study
« Reply #1 on: June 28, 2013, 10:08:12 pm »
Awesome tutorial w0rthy! Thanks for posting.
Hi