Monday, March 18, 2013

BF3 Hit Detection Investigated

I really don't wanna do this again as some people just go all jumpy whenever things turn out not exactly what they thought.... but meanwhile I really have to do this as some false statements have been already widely spread and EA/ DICE are getting away from this.. (I may not be perfectly right on this topic but I've tried my best)


 There's this common thinking that BF3's client side hit detection makes players with high ping harder to kill, and get you killed easier. And things would have been much different if the hits were server sided.

 But is it true?





Conflicting Experiences


The following comments are from this youtube video

1) People saying foreigners gain advantages
"Saw a UK player in an AUS server go 70-2 he couldn't be killed by AUS/NZ players in there"

2 ) People saying playing outside your region gains no advantages
"On PS3, this only happens to me when I play in servers outside my region (Australia), so just stick to your own region and your hit detection will be much more reliable. There is a HUGE difference when I play in US west or Asia servers (about 5.-1 second), very noticeable. It's been like this in all Frostbite engine BF games."

"Sadly, there are no latin American servers...."

We often hear people ranting about foreigners abusing hit detection. But on the other hand, we also hear people complaining about game being unplayably laggy when playing outside their region.



3 ) People saying playing locally still makes you lag
"It's probably less noticeable on consoles for the game being a bit slower paced than on PC. But I can tell it happens even when you play locally."

 So even if you play locally you'd still lag? You might be thinking "wait, that must because of the foreigners hording in". But as shown in 2 ) , those from other regions often suffer from playing in your region.


The conflicting results suggests that the so called client side theory rumored across the community could only explain this much.





The Real Client Side

(This is in short of what I've learned from this thread, wikipedia, Valve)


 There are generally three hit detection methods in FPS games - pure server side, server sided lag-compensation, and client sided lag-compensation.

 The later two were invented to make up the downside of pure server side hitreg, as in pure server side hit detection, your shots would be unreliable and inconsistent, you have to lead your targets, or worse you calculate them in mind but have to expect to still miss.


Pure server side is easy on server but clients suffers from inconsistent hitreg


 So the spirit is the same for both server sided lag-comp, and client sided one - they both seek to give players instantaneous feel in gunfights. 

Lag-comp on server side uses time stamp of players movements and adjusts the game world's state, which stresses the server a lot, while client side on the other hand, it makes players send their hits and server verifies them, and then update the game state.

 You might be thinking - "Isn't that making the game a big hell of mess with different pingers all joining in?"

 Well that's why we have server as authority. As pure client side hit detection would only work in LAN networks, we still need a server to coordinate and sync everyone in the game. With every client doing part of the lag-comp job, the server could run with a lot less stress.

 Actually it should be called server-side hit detection with client side lag-compensation.



server side compensation makes gameplay smoother, but stresses the server



client side compensation also smooths out the gameplay, and clients share the load 



 "But how do you know BF3 isn't using pure client side?" You may ask.

 Well according to the theories and experiences, if BF3 used pure client side hitreg, it'd have been much worse for everyone no matter the ping. It'd be the WYSIWYG effect to the max - Your hits all count, but so do others, and more likely the getting-shot-around-corner thing would be unpredictable as well. 

 This actually happened back in the 90s with games like Duke Nukem 3D and the first Quake World add-on, where pure client sided hit-reg were expected to be perfect but turned out otherwise because most people only had dial-up connection at the time, so even playing locally it was far from ideal.



Pure client based hit detection on WAN connection






So What's with BF3's Awful Hit Reg Anyway?


 After a long time, probably half of a year of reading and digesting here and there, I've come to the conclusion - BF3's hit detection problem could have less to do with its methodology, but more with the game's nature and EA/DICE's decision making.

 How so? Well, let me explain it in one pic:


Both server and clients are running hot



 This is a portrait of the current state of a game session in BF3. As seen in the pic, both sever and clients are running pretty hot.


 This maybe caused by:

1 ) The game itself is a resource hog
2 ) Most Physics are server sided


 For the game to look new and cool, DICE gave us the Forstbite 2 engine, at a cost of higher resource usage. Granted Battlefield is a large scale shooter game, with a lot of vehicles, destructions, explosions, and 24+ players, all being server sided, the data flow on your device and on the server would be considerably high. So to relieve the load, EA/DICE simply make the tickrate slower.


 Hence:

1 ) Server's tickrate (server's refreshing speed) being too low


 You can have a super fast hardware but for online gameplay it would only go as fast as the server can, which is the tickrate. Anything you send that is too fast for server to pick up would get delayed/ dismissed. So even with latest machine built, your connectivity potential would be still limited.


2 ) Built-in In-game latency (such as interpolation)


 And there are issues at the client's side too. With the game developed for current gen consoles mainly. The game has rendering issues from time to time. Which DICE decided to lower the resolution on console to 702p (up-scaled to 720p), but that still isn't enough, as we all have experienced the constant freezes here and there. 

 Although I'm not sure of it, the hardware limitation and interpolation (to smooth out player movements and such) introduced could have led to the delayed rendering that often occurs in game, like one guy just popped out of nowhere and you're dead with no time to react.

 How do I tell if this is not because of high ping? Well first I've experienced this in local lobbies as well, and second, the lag often comes 1 sec late, which is far more than purely a 200ms ping can do.

 Another thing to notice is, if we are to have higher tickrate, the bandwidth requirements would raise as well. (For now it's already in the Mbps range)





You're Full of $h!t, Where's the Proof?

 This is the typical reaction I get when I try to explain something on forums (which is why I don't post a lot). I don't mind. But let's take a look at this video:



 In this video they tested with different ping from 30ms to 150ms. And no matter how low or high their pings were it's always lagging for like 1 sec. (From my experience on distant server with 250+ms ping it may lag for up to 1.5~2 sec as well.)

 This clearly indicates that the game doesn't run on purely client side, otherwise they wouldn't be lagging out that bad at 30ms.

 And it's definitely not only ping that made them lag-shotted either. The slow tickrate and interpolation also played a big role in the test . See test #3 for proof. If it were only ping, the shooter and his hits wouldn't have been out of sync that bad.




The Part Where EA Gets Shadowy


 As a developer, EA/DICE should know more than us in the first place. But they never announced anything related to this issue. The only source would be from an ex-employee who publicly criticized before he joined DICE that "Even a monkey could do a better coding job than DICE."

 In his posts, he mentioned that BF3 uses a hybrid hit detection [source], which have been proved to be true after further investigation above. But the part about the tickrate were never responded directly, only discussed by other enthusiasts . They would at least answer questions about client side/ server side, but no comments on the tickrate and interpolation??


 I can't help but wonder how they made every decisions........


--what happens next is only imagination--


Problem: Server is running too hot
Solution:

1 ) Rent servers with better specs


Do you know how much it costs??



2) Lower the tickrate 



I like smart thinkers!




Problem: Game on console lags too much
Solution:

1 ) Develop PC version first and tweak it from there


This is why your not the manager



2 ) Do nothing



Full of wisdom!





Problem: Customers complain about lag
Solution:

1 ) Explain everything?


Pack up your things, really



2 ) Tell them to contact tech support



You nailed it! Promoted!






























7 comments :

  1. very interesting. I have come to the same conclusion re the tick rate, if you turn the interpolation down you can see how abysmally low the tick rate is. Interpolation is not the answer either, as then there is a tradeoff between smoothness and latency. Simplifying the physics would work but I don't see that happening.

    ReplyDelete
  2. This article is very flawed. Without really truly knowing how the server and the clients work from a Assembly or Source Code level there are quite a few things DICE could have done without changing the netcode at all to make things work smoother. Aka like Multi-Threaded servers. The server is single threaded so all calculations for physics, movement, everything is being done "blocking" all other calculations (like player hitreg) that would be a first start. You say lower the tickrate, Most servers that I have personally seen running on not too bad hardware (even Emulated VM's with 4GB ram and 2 cores) get around 400-2000 FPS (ticks). On decent servers (Xeons, i7 3770k+ etc) get anywhere from 4000-7000FPS. The issue does not 100% rely on what you have wrote here. There are major discrepancies everywhere with this article because its mainly based on speculation. I love the references to the Quake engine and Duke Nukem, as they are good examples but don't 100% pertain to the new Frostbite 2 engine.

    P.S. Netcode for BF4 has been changed since BF3.

    My Website:
    http://blog.allenthinks.com
    http://emulatornexus.com

    ReplyDelete
  3. It's nice to see someone looking into this and presenting ideas. I've spent some serious time trying to like BF3 because it has so much potential. I've played with the "smoother" bar all the way off for some time now and it does seem to help a bit, but the hit detection in this game is still absolutely horrid. To the point where I just don't want to play it anymore. BF4 LOOKS really cool, but I won't be purchasing it unless I can play a demo that guarantees me that this problem won't be present anymore.

    ReplyDelete
  4. The first photo you are using as your homepage banner (Tehran at night) is mine. I would have appreciated a reference to where you got it.

    ReplyDelete
  5. Do you know that in BF2142 the hit registration is also bad! But your reasoning leads me to tell you : there is some players who have a perfect hit registration! in both game (2142 and BF3) so ok for explanations, but while speaking, there is a list of players that can always kill you with one shot only everytime with no fail (no cheat) just because of their connection. There also a multiple factor improving or unimproving the reg. As flow control in your network device or in the windows register Nagle's algorithm... and russian players have a big advantage in FPS vs europeans I don't know why but every euro player knows it

    ReplyDelete
  6. I'm really glad that my video has been used to show how bad the Netcode at BF3 is. It's just sad to see people relying on the excuse that high pingers have any advantage, whereas the bad netcode affects everyone, with any ping. I often play with a 150 ping (which is not so high) constantly die from '1-hit-kill' registration, which means that the other side player shot me much before I could even hear/see but you get all the bullets at once, having no time to react. Once I realised DICE would never do anything towards it, I decided to learn and deal with it, that's why I have kept playing until today. Consequently, I have a hell lot of 'material'to show again how bad it is to play with a high ping. Anyways, thank you again for using this video. Xanzo.

    ReplyDelete
  7. First I have to say that "This issue is real and thanks for this article"

    anyway,you are saying that the issue for BF3 to act like that is caused by advanced features that takes lots of calculations(physics, destruction, 64-player, vehicles etc.) and I think you are right. Mw3 on the other hand doesn't have something like that. A very simplistic 12 player game on a tiny map shooting at each other. The problem is THERE IS NO DEDICATED SERVERS in CoD games. So even with this kind of simple game cant be played smoothly. However, that is the main reason I've switched from MW3 to BF3. while both games have this problem, differences between general idea behind those games is making that issue in BF3 not-that-of-a-big-deal to play. This issue is generally affecting gunfights. Since the vehicular warfare aspect of the BF3 is still great; while this issue ruins %100 of CoD

    ReplyDelete