After visiting quite a few forums, it seems there is a common question being asked in regards to BF3's client-side hit detection, "What is the difference between server-side and client-side hit detection?" So, I figured I'd do some reading and take a stab at answering.
Server-side hit detection is where one, authoritative server decides whether or not a hit has registered. The server knows the exact location of each player and is responsible for processing the bulk of the gaming logic. Since the client is behind the server in time, a server-side system requires the player to predict enemy movements and therefore lead targets when firing.
A client-side model allows the player's client to determine whether or not hits have registered. This allows the player to shoot at what he sees, instead of leading a target. Client-side hit registration, however, is more susceptible to hacks and cheats as the server is depending on the honesty of the client. Most games use a modification of the two, allowing the client to report hits, while the server polices the data reported from the clients.
Client side hit detection is also effected by lag compensation methods, such as interpolation and extrapolation.
Interpolation is where the client operating in a buffered state (slightly in the past). The client receives updates in intervals from the server and fills in the gaps, so to speak, in between the intervals. This prevents jerky movements from point A to B, providing a smoother graphical experience. The problem with this method is that where a player sees an object on his screen is not necessarily where it is on the server, making objects more difficult to hit.
Extrapolation is where the client predicts the location of an object. This works well with ballistics, but with player movements it can be far from accurate, as players do not move in a deterministic fashion.
The main problem with hit detection is that what the player sees happening and what the server sees happening will always be out of sync by the time it takes for the data to transmit from the client to the server. This video does an excellent job demonstrating this discrepancy.
So, should the game determine hits based on what the server sees or what the player sees? Some ways to rectify this are as follows:
No! Let me figure it out.
Allow the players to do the predictions themselves by leading their targets. Problem with this is the lower ping players will generally see lagging players first and have a time advantage when responding.
Yes! I want to shoot at what I see!
Rewinding time by using time stamps from client data, the server compares the data and decides whether a hit should be registered. This allows the players to shoot at what they see, instead of having to lead their targets to compensate for lag. The effects of this can be seen when a player runs behind cover and then dies because the server is adjusting for the lag of the shooter. It can also be seen when a shooter registers a kill after a player has run behind cover.
Yes! My connection sucks but I still want to play!
Extrapolation allows the client to compensate for its lag and extrapolate the location of objects. The problem with this method is that, as noted before, players do not move in a ballistic or linear fashion. Often, players make erratic movements. The effects of this method can be seen when a player gets shot and killed before exiting a doorway or before breaking cover.
It appears to me that BF3 does a combination of rewinding time and extrapolating depending on the player's latency (???). The effects of both can be seen in the video below. It is also important to note that in the BF3 beta hit damage is increased on moving players. DICE has promised that this will be corrected in their final release.
Sources:
1. Lag (online gaming), Wikipedia.
2. Bernier, Yahn. Latency Compensating Methods in Client/Server In-game Protocol Design and Optimization, Valve.
No comments:
Post a Comment