Skip to main content

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.

Filter by
Sorted by
Tagged with
1 vote
1 answer
175 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 ...
Fen1kz's user avatar
  • 195
9 votes
3 answers
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 ...
qwerty keyboard's user avatar
1 vote
1 answer
97 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" ...
soxyo's user avatar
  • 13
0 votes
4 answers
162 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 ...
Marcos Pereira's user avatar
0 votes
2 answers
168 views

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

So an object has a position, velocity, and is affected by gravity. ...
CPlus's user avatar
  • 143
1 vote
0 answers
115 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, ...
desade's user avatar
  • 19
0 votes
1 answer
468 views

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

I have few animations that work similar to this: ...
daedal99's user avatar
0 votes
1 answer
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.
Astronautical's user avatar
0 votes
3 answers
278 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 ...
Ryan Peschel's user avatar
0 votes
2 answers
642 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 ...
Ryan Peschel's user avatar
0 votes
1 answer
287 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. ...
Charl Cillie's user avatar
0 votes
1 answer
160 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/...
Nubcake's user avatar
  • 141
1 vote
1 answer
855 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 ...
DyingIsFun's user avatar
  • 1,317
0 votes
2 answers
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 ...
Serg's user avatar
  • 383
1 vote
1 answer
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: ...
Yamiko Hikari's user avatar
0 votes
1 answer
95 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: ...
wixy0's user avatar
  • 67
2 votes
1 answer
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 ...
Vít Gardoň's user avatar
0 votes
0 answers
127 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 ...
user148279's user avatar
6 votes
1 answer
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 ...
Nairou's user avatar
  • 614
0 votes
2 answers
195 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: ...
random person's user avatar
0 votes
0 answers
325 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 ...
stonar96's user avatar
  • 101
1 vote
2 answers
692 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). ...
Edward's user avatar
  • 13
1 vote
0 answers
515 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 ...
Jay's user avatar
  • 287
0 votes
0 answers
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 <...
Koby 27's user avatar
  • 141
0 votes
1 answer
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 ...
Crypto Gamer's user avatar
3 votes
0 answers
202 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 ...
JustStarted's user avatar
1 vote
0 answers
302 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 ...
wixy0's user avatar
  • 67
3 votes
1 answer
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 ...
wixy0's user avatar
  • 67
1 vote
1 answer
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 ...
dips virag's user avatar
0 votes
0 answers
25 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 ...
hifumi's user avatar
  • 1
2 votes
2 answers
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 ...
Krupip's user avatar
  • 1,773
5 votes
1 answer
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 ...
Theraot's user avatar
  • 27.5k
0 votes
2 answers
349 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' ...
Big T Larrity's user avatar
0 votes
1 answer
181 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 ...
Caston's user avatar
  • 99
4 votes
1 answer
736 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 ...
whitwhoa's user avatar
  • 201
0 votes
1 answer
664 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 ...
K. Krull's user avatar
  • 103
1 vote
0 answers
93 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 ...
Stovoy's user avatar
  • 11
0 votes
1 answer
138 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 ...
feynman's user avatar
  • 1,243
1 vote
1 answer
339 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 ...
Erik Brendel's user avatar
1 vote
1 answer
554 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 ...
Kamigaku's user avatar
  • 177
2 votes
2 answers
350 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 ...
J.Doe's user avatar
  • 289
1 vote
1 answer
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 ...
flatterino's user avatar
1 vote
1 answer
447 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 ...
Nairou's user avatar
  • 614
1 vote
1 answer
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: ...
blablaalb's user avatar
1 vote
1 answer
352 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 ...
DyingIsFun's user avatar
  • 1,317
1 vote
1 answer
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 ...
sketcherskt's user avatar
3 votes
2 answers
105 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 ...
user's user avatar
  • 257
1 vote
1 answer
841 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/...
goodpoutine's user avatar
2 votes
3 answers
175 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 ...
Octopus's user avatar
  • 269
1 vote
1 answer
546 views

Timestep with multithreading

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 ...
davidkomer's user avatar