Forum Discussion

DeepSixxxx's avatar
DeepSixxxx
Seasoned Ace
3 years ago

EA Lag Compensation Deep Dive

Per EA Deep Dive article for Apex Legends, copied and pasted below - written by Samy (Ricklesauceur):

https://www.ea.com/games/apex-legends/news/servers-netcode-developer-deep-dive

(note lag compensation, no-registration, tickrate, etc explained in great detail in the link above for EA blockbuster title Apex Legends)

  I am being killed while behind a door/wall, and sometimes I roll back to my previous position (I added BF photo).

This is a spicy topic. It has to do with lag compensation.

In every game since the dawn of online gaming, the main problem for developers to solve is how to fake real time action in something that is not operating in real-time. Essentially, everything you do in online games is delayed because of the latency to the server and back. A lot of things add to this: inputs, rendering, and yes, even server tickrate.

Even worse, on top of all that is your opponent who almost certainly plays with a different level of latency than yours. To solve this, our servers have to constantly look at not only what’s happening for you and your opponent at that moment, but also what was happening from both your perspectives at the time both of you input your actions. Lag compensation is the art of merging slightly different experiences into one shared reality.

There is no perfect solution. There is not one truth. At the end of the day, the server is a sort of time machine. It constantly rolls back the world state to see if your shot hit someone, and then updates the world for everyone accordingly. 

To better illustrate this principle, my colleague Earl Hammon wrote a little essay about fairness and lag compensation, and how it all works in Apex Legends. I’m sharing it with you below:

Let's go through various scenarios with two players in Apex Legends called HIGH and LOW. Let's give HIGH a high ping of 300 ms, and LOW a low ping of 50 ms. The difference in their pings is 250 ms.

What happens if they shoot at each other at the same real-world time? Well, LOW's shot will arrive at the server long before HIGH's shot, so LOW has the advantage.

What happens if one of them rounds a corner, so that they can suddenly see each other? Well, LOW has the advantage here as well. LOW is less “into the past,” so they get to see HIGH first. Once again, LOW has the advantage due to their ping. This adds on to the advantage where LOW’s bullets get to the server faster.

These cases are "unfair" in the sense that LOW has an advantage, but they are "fair" in the sense that it's reasonable to expect that the player with lower ping would get the advantage in this situation.

Now, what happens if LOW goes behind a corner to get into cover? Well, HIGH is still in the past when LOW is not covered, so HIGH can shoot LOW before they get into cover, but LOW won't find out about it until HIGH's packets have made it to the server and then to LOW. By this time, LOW sees that they’re safely in cover, yet LOW still got hit. From LOW's perspective, this is a bit of nonsense.

However, this is exactly symmetrical to some of the earlier nonsense that was in LOW's favor! When LOW pops out of cover to attack HIGH, LOW gets to see and shoot HIGH while it appears to HIGH that LOW is still in cover. From HIGH's perspective, this is a bit of nonsense, that they get shot by somebody who was still in cover. This nonsense can’t be eliminated, only transferred between one player or another, because of the simple reality that ping is real and players have different amounts of it.

 

Some would suggest that it is unfair to LOW that HIGH can shoot them when LOW thinks they are behind cover. The alternative they suggest is that HIGH should have to compensate for their high ping themselves. This would require us to implement an unequal and asymmetrical way of handling latency.

 

It feels bad to get shot when you think you're behind cover due to bad ping, which is what can happen to LOW. It also feels bad to get shot by somebody before you could even see them due to bad ping, which is what can happen to HIGH. But the nonsense is distributed symmetrically.

We want to be super clear: not all online games work the way Apex does. Some games always give the advantage to players with lower ping, but we actively choose not to with our system. It’s a stance we’ve intentionally taken after looking at the tradeoffs and thinking seriously about fairness in online competition.

To explain our system in simple terms, players with low ping don’t always have an advantage over high-ping players, and sometimes experience nonsense (to us, that’s a technical term). 

That’s a tradeoff which is designed intentionally into our system. But the upside is that you can play Apex Legends and play relatively well even if you have higher than average latency, which is really important for rural players, or for players in regions where connectivity is unstable. We believe we should reduce “nonsense” at every opportunity, but when we have to deal with less-than-ideal experiences, we want to do so in a way that’s equal and fair to all players.

This is the reason that almost any time you deal with a bit of nonsense like getting shot while behind a wall or getting hit right as you come around a corner, it’s probably due to unavoidable variation in latency between players and the way our system distributes it. Still, we’re committed to reducing this at every opportunity we get. Not only do we want everyone to have a fair experience, we also want you all to have a fun one.

Thank you for reading!

- Samy (Ricklesauceur) & the Apex Legends team

38 Replies

Replies have been turned off for this discussion
  • doubleome's avatar
    doubleome
    Seasoned Ace
    3 years ago
    @DeepSixxxx And I guess that shows the problem marketing doesnt need coding knowledge and visa versa. Its the job of leads/directors/managers to create a team with a common goal and allow a space where impossible goals can be met with critisism internally. I agree if either department is lacking quality people the whole thing could suffer especially if they try to compensate with marketing.
  • I posted this in another thread but I feel like one of a couple things happen in a gunfight for me...I get killed almost instantly. After the first hit when I try to move, I "feel" the input lag, and then I'm dead. OR I drop the first few shots on target and then stop getting hits and end up dead with the enemy having somewhere around 56% or exactly 56% health. Happens far, far too often to be coincidence. I've also noticed a LOT of times when I die in the second scenario, I'm thinking, "There were two/three/more team mates shooting, why did we NOT get him?" And then I start to realize, by the time the "killer" cam shows up, the enemy is dead. Again, happens far, far, FAR too often to be coincidence. Is this a product of the bad net code? Perhaps you actually got the kill, but the net code doesn't register it until it gets overwhelmed by the incoming rounds from other players?

    It's really got me scratching my head and pulling my hair.

  • Sooxzay's avatar
    Sooxzay
    3 years ago

    If only we had a server browser for battlefield 2042 to set ping limites to avoid this * by just playing with people having somewhat the same ping. Hmm..

  • RayD_O1's avatar
    RayD_O1
    Hero
    3 years ago

    @Sooxzay wrote:

    If only we had a server browser for battlefield 2042 to set ping limites to avoid this * by just playing with people having somewhat the same ping. Hmm..


    100% this. 👍

  • ElliotLH's avatar
    ElliotLH
    Hero+
    1 year ago

    I'm going to close this one as it's not been active since 2022, but anyone is welcome to start a new thread if they'd like to continue the discussion.

  • "There is no perfect solution." yes there is, delete the whole idea! You can guess how i got to this old threat, with very low ping unplayable experience. It is so bad, anywone with a ping higher than 100ms look like a cheater to me, they virtually eliminate me including reaction and aiming on my screen in less than 100ms. Good players with ping around 70ms, virtually kill me before i, literarly, have been able to see them they fired already their weapon (BTF5).

  • I have re-locked this thread as it was re-opened during forum migration.

Featured Places