View Single Post
  Click here to go to the next developer post in this thread.   #2  
Old 11-09-2011, 04:37 PM
[TW]redeye's Avatar
[TW]redeye [TW]redeye is offline
Programmer
 
Join Date: Jun 2010
Location: Roswell, GA
Posts: 334
Default

Ok, here goes. Since this comes up quite often, I'll try to be as detailed as possible.

First some background. The game runs essentially on 2 main threads - a game thread and a rendering thread. The game thread calculates all gameplay aspects such as shooting, hit registration, animation, IK, etc. The rendering thread calculates shadows, updates particle systems (such as smoke), and sends all the draw calls to the GPU for rendering.

Although for most parts the rendering thread can run on its own, it is not entirely independent of the game thread. The game thread "tells" the render thread where your camera is so that the rendering thread can draw the environment from your current location. Another example would be when you shoot, the game thread evaluates your mouse click, computes the ballistics, and if it hits a wall, it "tells" the render thread the location where it hit so that the render thread can draw a bullet impact decal at that location.

Because of this, the game thread needs to "talk" with the render thread. However, it cannot do so anytime it wants (effective threading simply doesn't work that way). So, it syncs from time to time, but otherwise goes about its own business. This sync time is usually at the end of a frame.

Now, let's assume that your game thread is running faster than your render thread. The game thread computes the Nth frame, sync happens, and then your render thread renders your Nth frame. While the Nth frame is being rendered, the game thread can compute your (N+1)th frame in parallel. By the time the (N+1)th frame is finished by the game thread, the Nth thread MAY or MAY NOT be finished by the rendering thread. This is where "One Frame Thread Lag" comes in. If OFTL is off, the game thread will STALL at this point, waiting for the render thread, resulting in a performance drop. But, if you play with OFTL turned on, it will allow the game thread to queue up the (N+1)th frame and start working on the (N+2)th frame immediately, and the render thread can pick up and render the (N+1)th frame once it has finished rendering the Nth frame. This gives you MORE PARALLELISM, and hence better performance. Keep in mind that this will only happen for one frame - your render thread will NOT keep falling behind more and more as your game progresses.

Now to answer your questions.

Quote:
Originally Posted by Echo Black View Post
With it on, would your client's view stay one frame behind the information you received from the server (such as extrapolated player positions based on momentum, etc.)?
No. It is client side only.


Quote:
Originally Posted by Echo Black View Post
One frame may look like little but if you average 60FPS, one frame = 16.6ms, which is quite a substantial delay to stay behind
To put matters into perspective, I quickly wrote up a code snippet to calculate the time it takes to double-click a mouse as fast as you can without moving. And, the avg. time for that is 13.6ms.

Quote:
Originally Posted by Echo Black View Post
I guess what I really mean to ask is, would playing with it on give you a less accurate idea of what is actually happening (even if by one frame?). If so, I will have to think twice before leaving it ON, despite it netting me a good 10 extra average FPS.
This is a PC title and we like to give you as many options as possible to tweak the game to your liking. Note that most games will just have that on by default since it allows your game to run as fast as it can without any stalls. So, if you want to turn it off, you can. Just be aware of the performance implications. Hopefully, this post will give you a better idea of the pros and cons of this setting.

TL;DR Leave this setting on for better frame rates. It won't adversely affect your hit registration or give you a less accurate idea of what is going on in the game.
Reply With Quote