Gå til innhold

Tweake interpolate for riktig hitbox?


Anbefalte innlegg

Virker som mange tweaker cl_interpolate og cl_interp, for å få "riktige" hitbokser om dagen. Jeg synes dette er en god forklaring på hvorfor det ikke virker (og hvorfor det ser ut til å virke):

 

(original tråd) Just because you see the hitboxes out in front of the model does not mean that there is something wrong. Let me explain:

The reason that with cl_interpolate 1 the hitboxes are out in front of the model is because cl_interpolate turns on INTERPOLATION. How does interpolation work? Well, the game server runs in stochastic "updates" ie on a standard 33 tick server every 30ms the server moves everything to its new position and sends the information to the clients. From the client's point of view this means that every 30ms things will "jump" into a new position. Interpolation smooths out this jumping by the following method.

 

When a new update arrives the engine looks back cl_interp amount of time and picks 2 updates, 1 that came before that time and 1 after. It then smoothly moves the objects and models between those two positions.

 

So, with interpolation on, there is an additional delay of cl_interp amount of time. When you turn on sv_showhitboxes, the hitboxes (which are actually just the server's simplified representation of a model) appear cl_interp time AHEAD of the model, because the client is delayed. Good so far?

 

Well, now your main worry: How the hell does hit detection work if the place you see things is not where they are on the server?

 

Well, it's called LAG COMPENSATION. And it works like this:

 

Every update that the server sends to your client has TIMESTAMP that indentifies when that update was generated by the server. When you aim at someone and fire, the "FIRING" message that you sent to the server also contains the timestamp of the update that was being played back to you when you fired. The server takes this information, and rolls everything in the game world back into the positions they were in at the update you were viewing when you fired. And that state of the world is used to test for hits. If you have cl_interpolate 0, then the update you are viewing will be the latest one, with cl_interpolate 1 it will be a slightly older one, but it does not matter because the server KNOWS which update you were looking at when you fired.

 

So there we have it, you now know why sv_showhitboxes shows you strange things, and why those strange things don't actually matter.

 

Regards,

Bomber.

 

If you don't believe me try it out for yourself:

1. Fire up a listen server - sv_cheats, sv_showhitboxes.

2. Put cl_interpolate 1 cl_interp 0.1 (defaults).

3. Shoot at the hitbox - no hits

4. Shoot at the model - hits

5. While watching the hitboxes toggle between cl_interp 2 and cl_interp 0 - see how the distance between the model and hitbox changes?

6. What YOU think interp causes - that you have to shoot the "hitbox" can be experienced by setting cl_lagcompensation 0 with interp on. You will now have to shoot the hitbox as the clever hit detection I described has been turned off.

 

I'm not making this up and I know it's complex, so if there's anything your not convinced about feel free to question it and I will do my best to explain.

 

Dersom noen skulle komme med motstridende informasjon, så vær så god, men jeg holder meg nok til default intil videre ;)

 

- AvieN

Endret av Munch
Lenke til kommentar

Opprett en konto eller logg inn for å kommentere

Du må være et medlem for å kunne skrive en kommentar

Opprett konto

Det er enkelt å melde seg inn for å starte en ny konto!

Start en konto

Logg inn

Har du allerede en konto? Logg inn her.

Logg inn nå
  • Hvem er aktive   0 medlemmer

    • Ingen innloggede medlemmer aktive
×
×
  • Opprett ny...