# 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.

100 questions
Filter by
Sorted by
Tagged with
1 vote
118 views

### Fixed timestep without cloning game state

I'm doing a JS game with hundreds of moving physical particles. I've read the famous "fix your timestep" article. So far I've implemented basic prototype with janky game loop tied to FPS and ...
• 185
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 ...
1 vote
77 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
151 views

### How to tell whether an expression is independent from frame rate?

I'm working on a videogame where part of the logic involves increasing a value each render frame (a render frame is equivalent to a simulation step where the result is drawn on the screen). Frames can ...
165 views

### How can I make a reliable time-based object updating system?

So an object has a position, velocity, and is affected by gravity. ...
• 143
1 vote
103 views

### Variable Timestepping & Unexpected Jerkiness/Stutter in a Simple Test Case Scenario

I have been bashing my head of an extremely simple case in my C++ game and would like some help. I have been researching about game loops, variable & fixed timestepping, rendering interpolation, ...
• 19
411 views

### Setting target framerate changes animation speed in editor, while Time.deltaTime stays the same

I have few animations that work similar to this: ...
2k views

### How to measure deltaTime? [duplicate]

I'm trying to make a simple console application and don't want to use Unity, but I want to implement a timer, so I would want to use Time.deltaTime.
256 views

### How to prevent a huge backlog of physics calculations from freezing browser when tabbing out of browser game?

I'm developing a browser game and am using the timestep implementation from the famous Fix your timestep! article. It works perfectly, but there is one problem. If you tab out of the tab and then come ...
• 225
551 views

### How to reconcile collision detection with delta time?

In my simulation, if an object is inside another object, it imparts a force proportional to the distance inside the object (basically a separation force). I am having an issue though where the ...
• 225
266 views

### Controlling the delta time in Unity

I record object data (position,rotation) for objects in a scene and store it to a file. At some stage the player can load this file and "play back" the recording to watch themselves. ...
150 views

### Timestep Jittering

I've been trying to implement the famous Fix your timestep in C++ and SDL2 using a simple example. I have a square that moves around on the screen but I cannot understand why it keeps jittering/...
• 141
1 vote
774 views

### How to make my Unity project deterministic for replays?

I am working on an arcade-style 2D shmup and recently started implementing a replay system that allows players to view their runs of the game. I use the technique of recording input each ...
• 1,307
5k views

### Time.fixedDeltaTime & Time.deltaTime in Unity

The old Unity 5.3 documentation said: Time.fixedDeltaTime The interval in seconds at which physics and other fixed frame rate updates (like MonoBehaviour's FixedUpdate) are performed. For reading the ...
• 383
1 vote
4k 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: ...
91 views

### Distance between moving, rotated rectangles in snake game

I am trying to implement basic Snake game with movement based on timestep. For now I've got something along those lines: Update function: ...
• 67
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 ...
124 views

### Scaling transforms by time, Eigen Decomposition of Affine Transforms

I posted this question in mathematics, but that sight gets flooded with homework problems... 8 views total, most of them me. Plus, I think this question is more geared to game development anyway. I am ...
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 ...
• 604
194 views

### How do you disable frame skips in a game, in SFML preferably

by frame skip off i mean that the game should just slow down if the fps drops, just like in terraria, i got this code currently and want to implement it to it: ...
306 views

### Java game loops with high tick times?

Take for example the first game loop from this question. A similar code is used in Minecraft (at least in older versions). I understand the concept and how this loop works in principle. But there is ...
• 101
1 vote
636 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
487 views

### Unity How does Time.smoothDeltaTime work

I can't seem to find any actual information on what Time.smoothDeltaTime does or how it works. I would assume it takes a rolling average of previous deltaTimes but how does it do that? Is the ...
• 287
1k views

### How to apply forces to rigidbody when Time.timeScale is changed?

My Task: I'm trying to replicate this virtual 3d creature evolution project. I'm using unity as my physics engine. Each limb part has a MonoBehaviour called an <...
• 141
2k views

### Mouse movement with deltaTime?

Is it good idea to multiply Mouse movement by Time.deltaTime? float mouseX = Input.GetAxis("Mouse X") * lookSens * Time.deltaTime; Should we use deltaTime with ...
196 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 ...
1 vote
289 views

### Implementation of continous, grid aligned, smooth movement (C / C++)

I've been trying to make my own implementation of Snake clone using Allegro 5 / C. Unfortunetaly I can't find a good method to align x & y position of snake to grid. I'm looking for some good ...
• 67
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
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 ...
24 views

### Correcting different dash distances depending on frame rate when using deltaTime

I'm trying to make a character do a short hop or dash. The player doesn't have control of the character for the duration of the dash, which is supposed to be about .4 seconds. I tried several ways of ...
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
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 ...
• 27.3k
341 views

### Adding some new velocity to player in FixedUpdate. Should I use FixedDeltaTime or nothing?

I am trying to learn how to move objects in Unity without using the built in features like AddForce etc. Some tutorials on Unity website (and other places) is where I have got most of my 'knowledge' ...
• 1,417
175 views

### Unity Events executed out of order

According to this page Events in unity are suppose to execute in a specific order. Specifically, OnCollisionEnter is supposed to be called right after OnTriggerEnter; however, FixedUpdate and Update ...
• 99
646 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
640 views

### Huge input delay although framerate is stable - possibly related to the DirectX Tool Kit?

I'm in the process of learning how to use the DirectX 11 API and came upon the following problem: Although my rendering function executes quite fast at around 150 fps (as one expects considering how ...
• 103
1 vote
85 views

### Keeping simulations in sync over long periods of time

I'm working on a multiplayer game which involves a huge amount of predictable AI enemies, and a few other players. The enemies are the most important to be accurate, because the game involves pixel ...
• 11
134 views

### Time loop/ticking architecture

Say I build a snooker game, where balls need to jitter around. Balls belong to a class (ball class), where all the ball functions are defined. In the animation, time evolves by a clock ticking ...
• 1,233
325 views

### Smooth behaviours at high Time.timeScale

When I set the Time.timeScale in unity very high, many scripts seem to do werid things (because of the high deltaTime they use for their logic). Is there an option ...
• 101
1 vote
544 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
328 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
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
436 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 ...
• 604
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
334 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
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
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
1 vote
788 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/...
162 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
1 vote