31 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 ...
Kelly Thomas's user avatar
  • 3,882
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: ...
DMGregory's user avatar
  • 134k
8 votes
Accepted

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

I'll usually use System.Diagnostics.Stopwatch for this. ...
DMGregory's user avatar
  • 134k
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.
user3362964's 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 ...
Stephane Hockenhull's user avatar
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 ...
Nox's user avatar
  • 900
6 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 ...
DMGregory's user avatar
  • 134k
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 ...
EvilTak's user avatar
  • 922
5 votes
Accepted

How to implement accurate frame-rate-independent physics?

You can fix this problem by averaging the initial and final velocity: ...
Peter's user avatar
  • 66
4 votes
Accepted

Frame-rate independant movement with acceleration

Most of what you want can be handled by typical deltaTime multiplication just like the example you link. For example, with a simple Euler integration: ...
DMGregory's user avatar
  • 134k
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. ...
DMGregory's user avatar
  • 134k
4 votes
Accepted

Coroutine delay isn't consistent on different framerates

The smallest delay that WaitForSeconds can give you is one frame. That's because the way it's implemented is it checks once each frame (after ...
DMGregory's user avatar
  • 134k
3 votes

Using 60 frames per second causes the screen to leave a drawn trail of textures, when there is movement

You don't need to limit the framerate yourself within LibGDX. The framework handles that for you. You can enable vsync in your game by adding this line to your desktop configuration: ...
Charanor's user avatar
  • 7,840
3 votes

Locking the frame rate in pygame?

clock.tick() only sets the loops at intervals of milliseconds, so at 60 fps, it will make each game loop at 16 milliseconds, not 16.6666 (which is what you need) ...
William Hou's user avatar
3 votes
Accepted

How to change FPS during runtime in LibGDX?

So you want to change a member of a class in your desktop launcher from the code in your game. A very easy (but not scalable) way is to override a method of your game class in your launcher. So in ...
Xoppa's user avatar
  • 181
3 votes
Accepted

How to calculate fps in GLFW?

You can get the amount of milliseconds passed between 2 render calls by storing the time the last render happened and subtracting it from the current time. Then you can get the exact fps count by ...
Bálint's user avatar
  • 14.9k
3 votes

Accelerated movement in a specific time to a specific point

I've run into this kind of trouble a few times, but not yet on 3d. First of all, I'm not really sure you transformed correctly the acceleration formula... maybe this source can help in that way. ...
DavidTaubmann's user avatar
3 votes
Accepted

Multi-threading for rhythm game?

TL,DR: The SDL2 event/render system is not yet thread-safe, but you can overcome this limitation by using OpenGL to decouple the renderer system from your application (and then perform all rendering ...
Breakthrough's user avatar
3 votes

Pygame time.get_fps() value

Looking at the implementation of clock.tick() and where in that module the FPS value is set (search for _clock->fps =), the documentation seems to be correct ...
Thomas Perl's user avatar
3 votes

What framerate should I aim for on a mobile phone?

So first off, a disclaimer: I'm a Director at GameBench, and we make tools for measuring mobile app/game performance (frame rate and other metrics) for a lot of major companies (Rovio, Samsung, ...
Xarus's user avatar
  • 131
3 votes

How can I make the main game loop frame-rate independant?

The State is meant to represent all of the data your program needs to render the current scene. So mCenterX and ...
Ryan1729's user avatar
  • 714
3 votes

Unity frame-rate drops / stall

As Nico says, your profiler seems to show a big spike of garbage collector activity, which is consistent with the symptom of a sudden isolated stall. This happens when your scripts allocate and then ...
DMGregory's user avatar
  • 134k
3 votes
Accepted

No performance gain from instanced rendering?

Instancing is an improvement relative to multiple draw calls, with state changes between each draw. Instancing exists to allow you to provide per-instance data to each instance, so that it can ...
Nicol Bolas's user avatar
  • 26.1k
3 votes
Accepted

Is Updating Sprite/Entity Movement Using Framerate Necessary?

No* * To a first approximation, nothing in games is "necessary". If your code compiles, you can ship it. Whether or not anyone thinks the game is any good is another question. So, what is scaling by ...
DMGregory's user avatar
  • 134k
3 votes
Accepted

What is the correct way of implementing a deterministic frame update?

DMGregory guided me towards a good solution explained in this article: Use a fixed timestep This solution allows the total decoupling of the simulation and rendering frequency, while allowing for a ...
Lake's user avatar
  • 143
3 votes
Accepted

Why do we need more than 24 FPS?

The number of frames a human can perceive per second is not a constant number. It depends on a lot of factors. Age. Younger people can perceive more FPS than older people. High-fidelity 3d games ...
Philipp's user avatar
  • 119k
2 votes
Accepted

How to make score counter independent of framerate

You have to use the frame time, and make your score based on time instead of on frames: Here is the pseudo-code: ...
Vaillancourt's user avatar
  • 16.3k

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