Skip to main content
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
  • 136k
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
  • 136k
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
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
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
  • 136k
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
  • 136k
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
  • 136k
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
  • 136k
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

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,870
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

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
  • 136k
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
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
  • 15k
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
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
  • 136k
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
  • 121k
2 votes

How can I improve the seemingly capped framerate of my flash game?

Flash Player has frame rate capped to 60, ignoring Stage.frameRate = 1000 property since FP10. In Flash Player 9.0c, both frame ...
ivan866's user avatar
  • 141
2 votes
Accepted

How can I improve the seemingly capped framerate of my flash game?

According to AS3 documentation: frameRate: Gets and sets the frame rate of the stage. The frame rate is defined as frames per second. By default the rate is set to the frame rate of the first SWF ...
Lazy Developer's user avatar
2 votes

Does anything need to be done to support variable refresh rate?

Roughly speaking, no, nothing special. For some drivers/systems you must run in exclusive fullscreen mode, but otherwise these technologies are transparent to the application. Note that you need to ...
Sean Middleditch's user avatar
2 votes
Accepted

How do games with a low tickrate but high framerate work?

Minecraft is pretty much the only game that has a lower physics frequency than rendering. (As @DMGregory pointed out, this only applies to offline games, because most servers run on lower rates, and ...
Bálint's user avatar
  • 15k
2 votes
Accepted

In Unity, how do I use the extra time in every frame to do some extra processing?

This (general) approach is used in several AAA engines, but isn't very compatible with the way current Unity (2017) works. To do what you've described, you'd have to build your own task system that ...
Zebraman's user avatar
  • 819
2 votes
Accepted

Converting Frame-Dependent Movement to Frame-Independent

There are two main ways of doing frame independent update loops. I highly recommend reading through and understand this: Fix your timestep! What you are trying to do is a variable timestep update ...
János Turánszki's user avatar
2 votes

Do sprite animations usually run at the same framerate as the game itself?

how do you fit sprite frames into a higher frame rate? The trick is to run animations at spritesheet framerate (e.g. 12fps) and run character/entity movements (physics, camera, particles, GUI, etc) ...
Kromster's user avatar
  • 10.7k
2 votes

Is it good to use 24 fps animation in 60 fps game?

Most 3d animation systems work with keyframes and interpolation curves between them. Your 3d animation program might use a 24 FPS timeline as an UI convention. But that doesn't mean that the engine ...
Philipp's user avatar
  • 121k

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