View Full Version : Battlefield 3 hit detection, netcode and network smoothing

09-18-2012, 02:58 AM
Client side should have better hit detection for your client. It does not go:

Client: I hit that dude!
Server: No you diddn’t!
Client: Oh ok, sorry about that.

Its more like

Client: I hit that dude! *plays death animation*

Server: Sweet, lets kill him now then.
Other client: *Dies*

To highlight this you can die ducking behind walls to a player with a higher ping. The server would not have allowed you to kill them if it was verifying anything. The problem is not client side or server side hit detection, its just crappy hit detection, hit markers when you don;t deal damage and average netcode.
Also one person with high ping does not degrade server quality like many people seem to think. This isn’t 1998 anymore and I am really surprised people still think this can occur. Yes shooting at that HPB might be different and encounters may play out slightly differently because of client side hit detection, but the server does not degrade everyone because of one bad connection. I think we are somewhat past that.

What is the difference between high and low ping then in relation to client side hit detection?
First up latency, lag or ping represents the round trip of a packet to a server. Gaming pings on scoreboards have never been overly accurate and do not represent the ping you would get if you pinged the server from a DOS box. But they are something to work with and are handy because they give an indication that your connection is screwed without having to alt tab. Beyond that they are pretty useless.
Think of your world view as a combination of half your ping + half theirs. Why half? Because ping is typically a round trip measurement. They send their data to the server and then it is sent to you. This means if you both have a 20ms ping you should be seeing where they were around 20ms ago. If they have 200 and you have 20 you would be seeing their location around 110ms ago. And so on.

This may sound like you have a disadvantage because you are seeing where they are in the past but it works both ways – you see them before they see you when they step around a corner. You can die when you are behind cover because they are shooting at you in the past. Overall the lower ping player (if there is a large difference) still has the advatage. They can see, react to and kill you faster than you can kill them. You may be “behind” but if they kill you soon enough after seeing you and let the server know you will sill be dead.

However it is possible to abuse very high ping – 500+ on international servers. I think this is a major flaw of the BF3 engine. You should not be able to wield your latency like a weapon and step out from behind cover without any repercussions. Remember, with a 500 ping the other player is seeing you with your 50 pin (on average) around 275ms in the past. However because everything is client side they can step out and kill you before you are even seeing them. Why? Because even though they are seeing “the past” they can still shoot and kill “the past” before you can do anything about it. With Battlefield 3 TTK weapons 250ms is more than enough.

What about network smoothing in battlefield 3.

The final piece of the puzzle is network smoothing. Think of pushlatency or exinterp for those that remember Quake or Counter Strike. This setting can improve rendering of players by interpolating their animations/position when there is missing packets/player data. Why would there be missing data? Games use UDP which has no error checking, so a packet that is missing will never turn up. This is not really relevant for gaming as the player position in the packet data in the past is completely useless even if the client gets it down the road.
People talk about network smoothing in BF3 adding 150ms to ping. I assume the game simply renders everything in the past by 150ms. This way if there are any gaps it can easily fill them in. This assumption may be completely wrong but I am not sure how else they would achieve this.

The solution to this set a server ping limit, if a person is playing on a dialup connection or has a crappy internet connection or is trying to play from a location on the other side of the world then I guess they should playing on a server that is a bit closer to them.