Jump to content
  • Advertisement
Sign in to follow this  
jchmack

Does the aim lag in all FPS games?

This topic is 3613 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I recently noticed that all the raycasts in my engine are a little behind (i believe exactly one frame) where they should be. I tried everything I possible could to get it working right. I can get it to LOOK like it is casting in the correct spot but it also creates some errors. So I looked at a few of the FPS games I have to get some insight. (Note: I tested in single player to make sure that I am not just mistaking network latency for this error) I have always known that the Lightning gun in quake3 arena has similar issues. It hits a little behind where the player is aiming (if he is moving or turning the camera) I know in later patches they fixed this (graphically but not programatically). Looking at UT2k4 i believe they are hiding the problem with graphics as well. The link gun beam itself looks accurate graphically but the particles it creates from hitting a wall are behind (like the q3 lighting gun) leading me to believe they are just hiding it graphically as well. Do all FPS games have this aiming delay? I believe that Q3 and UT2k4 are pretty old games is there a way around this sort of problem?

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by jchmack
I recently noticed that all the raycasts in my engine are a little behind (i believe exactly one frame) where they should be. I tried everything I possible could to get it working right. I can get it to LOOK like it is casting in the correct spot but it also creates some errors.
This is a basic issue of any simulation where rendering occurs before updating - new values are derived from the current frame, but not displayed until the next frame. However, if your game runs at 60 Hz, I find it doubtful that anyone will notice the single frame delay (unless they are specifically looking for it).

Share this post


Link to post
Share on other sites
It's almost unavoidable with the way GPU's work.
A typical game loop looks something like

1 Get input
2 Update game states
3 Render
4 Present

However, the scene isn't actually drawn on screen when you call present. Present tells the GPU "I wont be rendering more this frame". At that point the GPU starts processing all the render calls you made while your continue running on the CPU. So the GPU is really rendering the previous frame while you are running through steps 1 to 3, hopefully flipping it onto screen just before step 4, so both GPU and CPU are working 100% all the time.

Some games (for instance Unreal I believe) used to lock a 1x1 pixel area of the back buffer just after the Present command because this lock only returned when the scene was fully rendered. That way the logic and graphics was synchronized. But it meant that the CPU was idle while the GPU was active and vice versa.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!