New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

# Questions tagged [timestep]

A timestep (commonly represented as dt or deltaTime) is the amount of in-game time that elapses between two discrete updates of a piece of the game's internal state, or the duration that an update operation is meant to model. Timesteps arise in game loops, physics simulations, animation timelines, interpolation, and other systems modeling change over time.

99 questions
Filter by
Sorted by
Tagged with
67k views

### How to get and use delta time

I have mice looking and walking in my game, but they are very slow and hard to use. I think it's because I'm using fixed speed. I heard that in big projects developers use delta time. How do I ...
• 173
8k views

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

I have the following code to calculate the translation required to move a game object in Unity, which is called in LateUpdate. From what I understand, my use of <...
• 1,553
3k views

### What is Unity's definition of time?

So I've been messing with both Avelog's Mouse Simulator and GameGuardian. Mostly out of fun, but partially out of finding weird game quarks that might be useful in a speedrun. I'm going to be writing ...
2k views

### Timestep in multiplayer game

I'm trying to wrap my brain around the concept of creating a server/client multiplayer experience. My problem is mainly related to timestep. Consider the following scenario: A client connects to ...
• 8,424
1k views

### Why is my gameloop slightly faster than 60 per second?

Here is my gameloop (taken from http://www.koonsolo.com/news/dewitters-gameloop/) which is supposed to limit the game (logic) updates to 60 per seconds and render as fast as the device allows: ...
• 1,927
5k views

### Frame-rate independent friction on movement in 2d game

I have been trying to implement a simple physics system for a 2D space game I am making. I have it pretty much working, but I have encountered an issue with the way I apply friction. I have tried ...
2k views

### How to measure time interval (different languages)

What is the recommended way to measure time intervals for a game loop? Consider the situation in which a developer is writing their own game loop. Using a third party game engine such that you do not ...
• 26.9k
1k views

### How does an FPS like Overwatch have client time run ahead of the server?

In watching the GDC talk about Overwatch netcode, it mentions that the client is always ahead of the server, that the "current tick" on the server is behind that of the client. From their ...
• 594
2k views

### Smooth interpolation with variable time steps

My game engine just went through a small overhaul that changed its fixed time step loops into variable time steps ones. Though everything has already been adapted steadily to the new environment, ...
• 817
2k views

### Should camera rotation be framerate independent?

I currently have my own custom first person controller, and the code to rotate the camera and controller based on the mouse position deltas looks like this: ...
• 1,710
614 views

### Fixed Timestep with Interpolation | Blurry & Choppy

I've been implementing a game loop with a fixed timestep which uses interpolation as described in the (legendary as I have come to find out as it is referenced in almost every post I have read trying ...
• 201
761 views

### Glenn Fiedler's fixed timestep with fake threads

I've implemented Glenn Fiedler's Fix Your Timestep! quite a few times in single-threaded games. Now I'm facing a different situation: I'm trying to do this in JavaScript. I know JS is single-threaded,...
• 1,935
520 views

### Fixed timestep with interpolation in AS3

I'm trying to implement Glenn Fiedler's popular fixed timestep system as documented here: http://gafferongames.com/game-physics/fix-your-timestep/ In Flash. I'm fairly sure that I've got it set up ...
4k views

### Can I always assume that fixed time step in Unity is reliable?

I was thinking about games on low end machines or phones where the CPU would be limited. If I were to move all of my game logic into FixedUpdate() can I assume that ...
• 3,641
1k views

### Finding average input value over time in seconds

I'd like to find the average input value from a controller over the last n seconds (say the last 0.1 seconds) and do this every frame. I can see how to do this for the past n frames by storing a list ...
2k views

### Why do we put deltaTime as an argument in render() LibGDX?

I know that deltaTime is the time the last frame took to be rendered. However, I have no idea why we have to put it inside the parameter of the render method. I ...
• 43
1k views

### Tile based smooth snake movement

while making my own Snake implementation I decided to use delta time for smoothing movement on screen. The problem is that before Snake was moving fixed amount of pixels every frame, but now when ...
• 67
104 views

### To implement a game object that expires, should I store the start time and total, or store the remaining time?

Example: There is a bomb (like in Counter Strike) which explodes after 45 seconds. Should I— store the 45 seconds in a variable, and decrease it by the delta time at every update, or store the time ...
• 257
682 views

### Fixed timestep and interpolation question

I'm following Glenn Fiedlers excellent Fix Your Timestep! tutorial to step my 2D game. The problem I'm facing is in the interpolation phase in the end. My game has a Tween-function which lets me ...
• 148
194 views

### Game runs at different speeds in Chrome versus Firefox

I am using Box2D for physics on the server side. Player position is updated on the server, so there is nothing the client can do except give input. But running game in Chrome only, the player moves ...
435 views

### How do I make a sine wave without using an infinitely-increasing time value as input?

I have a basic understanding of sine wave generation. The problem I am facing is that as the input parameter for time gets larger, my sine wave falls apart and starts to look really ugly. I'd like to ...
• 43
2k views

### Physics engine deltaTime and force acceleration

I am working on a physics engine that uses basic Euler integration to compute forces. So, here is the thing: ...
• 920
2k views

### How to handle player input with fixed rate variable fps time step?

I've made a system which uses the ideas from "Fix your Time Step" in order update physics. I'm having trouble finding standard methods for dealing with this when user input affects player movement ...
• 1,763
694 views

### How to use multiplication operation in game render delta time?

We are using delta time like this: ...
• 219
157 views

### Spawn rates and variable time steps

How would I work a spawning algorithm into a sim engine with variable time steps? If each engine step is, say, 1/30 of a second and I have some event occur with a 0.001 probability each step, how do ...
• 269
825 views

### Fixed-Timestep still updating too fast

I'm trying to figure out if I'm approaching my simple fixed-timestep implementation correctly, following examples such as: Gaffer (without RK4), and DeWitters Currently, I have a game object which ...
• 133
1k views

### Simulation step size in a physics engine

I am trying to integrate a physics engine (Bullet) into my game engine, but I immediately found that I do not know how big should I make the simulation step. I think of 2 options: Use a fixed step ...
320 views

### How do I use delta time time-stepping in a triple-buffering scenario?

I am creating a graphics application in Metal. One of the things we are suggested to do is to use triple buffers in order to allow for the GPU and CPU to work more in parallel. Essentially instead of ...
• 289
2k views

### What is the correct way to update a physics frame rate?

I've searched around the Internet, and eventually read a suggested article, "Fix your Timestep!". In accordance with the article, I came up with an update method, but I still have problems. Whenever I ...
• 367
56 views

### Xna 4 Model Rotation with inertia not working as expected with variable updates

I am trying to rotate a model with inertia damping with the keyboard. The code works great with a fixed time step but it doesn't behave the same with a variable update frequency. Update method: <...
1 vote
1k views

### Movement doesn't look smooth (slight lag)

Currently I'm using a variable time step and when the FPS drops by even a small amount you can easily notice a slight lurch forward of the player. I'm making a platformer and I'm wondering whether I ...
• 159
1 vote
2k views

### What is a Frame and Frame Per Second?

I'm new to the unity Editor, trying to understand Unity scripting. What is frame? I can't tell from how it's used whether "frame" is a function, or a measure of time. I see this term used in ...
1 vote
1k views

### Is Time.deltaTime different on various devices?

Can someone say what is wrong with my code. I have custom timer implemented like this: ...
1 vote
83 views

### Better way to timestep?

So I know how timestepping works. As I understand it if I wanted to move a character at the same speed in real-world time I need to simply multiply the movement of the character by DT on each frame. ...
• 289
1 vote
3k views

### Should I accumulate state time based on a global or a parameter?

Generally, we associate a "state time" with our sprites. Libgdx provides a method to do so: float deltaTime = Gdx.graphics.getDeltaTime(); However, in the main ...
• 21
1 vote
855 views

### Player Movement

I started developing games recently, teaching myself using a german book about C++ and Direct3D 9. The author states, player movement should be implemented using a time delta, like this ...
• 1,792
1 vote
618 views

### Fixed timestep, updates per second keeps changing?

I've been trying to create a deterministic, fixed gameloop. The game loop should run TICK_RATE # of physics updates per second, and then render as quickly as possible (didn't do interpolation yet). ...
• 13
1 vote
2k views

### Is Update() called on the very first frame in Unity?

I'm calling Time.frameCount inside Update() and then immediately Debug.Break() to pause the ...
• 187
1 vote
328 views

### Converting Frame-Dependent Movement to Frame-Independent

I fine-tuned some movement physics for a 2D platformer in a frame-dependent manner and now I want to convert them to frame-independent. I though this would be as easy as multiplying a few things by ...
• 1,307
1 vote
184 views

### GameTime Replacement / Wrapper for Pausing , Slow-mo and 'Fast-mo'

I'm looking to change the way in which my game uses GameTime to run the game so that I can easily pause the game (elapsedTime = 0...
• 336
1 vote
569 views

### How to make camera rotation independent from frame rate?

I multiply the mouse movement by a given number to get camera rotation of a desired speed. But it only works at 60 FPS. When I don't limit the frame rate I get around 350 FPS and the camera rotation ...
• 5,731
1 vote
70 views

### What would be the best way to gradually increase the speed of a 2D arcade game with gravity physics in Unity?

I'm somewhat new to Unity, so I'd like to hear some more experienced thoughts on this. I'm using C# if that helps. I'm currently working on an arcade game somewhat similar to "Doodle Jump" ...
• 13
1 vote
3k views

### Delta Time FPS with SDL 2 in C++

I have tried achieving a good delta time and fps counter over the last few days, read and watched a lot about it, but still can't seem to get it to work. Here is an example: ...
1 vote
538 views

### MonoGame tick cannot go lower than 16ms

I'm trying to build play with MonoGame and I'm trying basing this regarding the GameTime steps. In my main Game class that is being run in the main entrypoint of my project, I'm doing something like ...
• 167
1 vote
429 views

### Fixed timestep without physics?

I read Gaffer's Fix Your Timestep article many years ago, and have since had the impression that game code should have a fixed timestep, with only non-gameplay related tasks outside of that in the ...
• 594
1 vote
60 views

### How to move while a timer is going in an event

I'm trying to make a switch activated gate and this is what I have setup so far "picture #1" but what happens when the timer is going on, I cannot move. so what I'm trying to do is go through the ...
• 292
1 vote
776 views

### Fixed timestep updates with a variable timestep update

Many suggest that a game loop looks something like this. See: http://gameprogrammingpatterns.com/game-loop.html http://www.koonsolo.com/news/dewitters-gameloop/ https://gafferongames.com/post/...
1 vote
506 views

There are several questions and articles which deal with timestep - for example: Should game logic update per second or per frame? https://gafferongames.com/post/fix_your_timestep/ Accounting for ...
• 485
1 vote
207 views

### Accounting for drift between ticks

What are some solid techniques to account for the gap between processing time and frame update ticks? In other words, the game/render loop looks like this: Some important points: Tick timings are ...
• 485
1 vote