2022 Developer Survey is open! Take survey.
30 votes

Movement appears to be frame rate dependent, despite use of Time.deltaTime

Frame based simulations will experience errors when updates fail to compensate for non-linear rates of change. For example consider an object starting with position and velocity values of zero ...
user avatar
  • 3,772
21 votes
Accepted

Framerate is affecting speed of object

You're moving the circle by one pixel per frame. It should not come as a big surprise that, if your rendering loop runs at 30 FPS, your circle will move 30 at pixels per second. You basically have ...
user avatar
12 votes

Locking the frame rate in pygame?

If you read the pygame.time.Clock.tick() and pygame.time.Clock.get_fps() documents, you'll find that: ...
user avatar
  • 14.5k
10 votes
Accepted

How to make a custom event system framerate friendly?

This looks like you could solve it with a priority queue or min-heap. The code to process the queue would look something like this: ...
user avatar
  • 113k
9 votes

Could frame interpolation like used by SmoothVideo Project be an option to increase the framerate of games without as big a performance hit?

Yes it's possible, but it's not without its complications. While frame interpolation can work real-time on videos, that isn't necessarily the case with video games. Even though this is processing ...
user avatar
  • 72.7k
7 votes
Accepted

Simple framerate counter?

To measure framerate you need two counts: How many frames (not draw calls) have passed, and, How much time has passed. Your framerate is therefore calculated as: ...
user avatar
7 votes

Framerate is affecting speed of object

Your code is currently running each time a frame renders. If the frame rate is higher or lower than your specified frame rate, your results would change as the updates don't have the same timing. To ...
user avatar
  • 148
7 votes

Dynamic frame rate in Unity

I think render to texture is still your best bet. If you took a "screenshot" of what the camera sees and just display that texture the rendering cost should be cheap even at 30fps.
user avatar
7 votes
Accepted

Handling variable frame rate in SDL2

The most consistent way to do this is to use a fixed time step for your game logic. This avoids game logic oddities due to rounding errors when frame rate changes (collisions or events that don't ...
user avatar
6 votes
Accepted

How do I implement a fixed delta time step with a SDL_Delay(15ms) precision

You can't reliably control the FPS with functions like SDL_Delay, they call the operating sleep function, which tells the operating system "Please don't give me any CPU time for at least N miliseconds"...
user avatar
  • 3,203
6 votes
Accepted

Could frame interpolation like used by SmoothVideo Project be an option to increase the framerate of games without as big a performance hit?

A system along these lines has been used in The Force Unleashed. I'm not aware of other titles that have used it though.
user avatar
  • 113k
6 votes

Movement appears to be frame rate dependent, despite use of Time.deltaTime

It depends on where you're calling your step from. If you're calling it from Update, your movement will indeed be framerate independent if you scale with Time.deltaTime, but if you're calling it from ...
user avatar
  • 880
6 votes
Accepted

How to get time since frame start in Unity for loading purposes

I'll usually use System.Diagnostics.Stopwatch for this. ...
user avatar
  • 113k
5 votes
Accepted

How to implement accurate frame-rate-independent physics?

You can fix this problem by averaging the initial and final velocity: ...
user avatar
  • 66
5 votes

How can I make sure my game runs on older GPUs than mine?

There is literally no good option other than testing on a range of target hardware. Simply testing on slower hardware isn't enough. Older cards are often on different driver series, meaning that they ...
user avatar
5 votes
Accepted

Should I cap the frame rate in SDL?

Should you cap the framerate: Yes Is a high CPU usage unwanted: Yes Or even dangerous!: Could be but if so not your problem You want to cap the framerate because you are extremely unlikely to ...
user avatar
5 votes

Framerate is affecting speed of object

That's because you limit your frame rate, but you only do one update per frame. So let's assume the game runs at the target 60 fps, you get 60 logic updates per second. If the frame rate drops to 15 ...
user avatar
  • 8,272
5 votes

Will unlocking the framerate in XNA/MonoGame tell me how efficient my code is?

I don't see why you couldn't use it! Keep in mind that you may have to code differently to account for the differences between fixed/variable timestep, so if you're planning on making it fixed when ...
user avatar
  • 419
5 votes
Accepted

Unity stats framerate vs Time.deltaTime

1 / Time.deltaTime is the actual FPS that the whole Unity window (or the game after building and running) is running at. The FPS that the Stats window shows is ...
user avatar
  • 872
5 votes
Accepted

What is a Frame and Frame Per Second?

Games inherited this term from animation, film, and video. There, a "frame" is one still image in the sequence. By playing lots of frames in rapid succession, we create the illusion of ...
user avatar
  • 113k
4 votes

Timing of coroutines in Unity is never precise

This is most likely down to the frame rate, which makes me wonder how can I make sure that a coroutine takes the precise amount of time it should take despite the fluctuating frame rate? I don't ...
user avatar
4 votes
Accepted

How to calculate FPS and what factors affect FPS?

In general to calculate the FPS, you need the following: cn: counter of how many frames you've rendered time_start: the time since you've started counting time_now: the current time To calculate the ...
user avatar
4 votes
Accepted

Java game runs slower and slower as game runs longer

You probably have object leaks. Objects that are still referenced somewhere in an array or list, creating more and more objects for the garbage collector to process as the game advances. Or more and ...
user avatar
4 votes
Accepted

Incrase framerate in XNA

I found I had to do the following to set the FPS limit free. In your Game class, do the following: ...
user avatar
4 votes
Accepted

Can you write the current frame number to a text file?

You can retrieve the number of frames that have passed with Time.frameCount();, if that's what you're looking for. http://docs.unity3d.com/ScriptReference/Time-...
user avatar
4 votes
Accepted

What's causing this stutter when framerate fluctuates?

You're averaging the total travel of the mouse on a frame. The travel of the mouse is proportional to the speed the player is moving the mouse and the duration over which you measure the movement. ...
user avatar
  • 113k

Only top scored, non community-wiki answers of a minimum length are eligible