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
1answer
43 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 ...
0
votes
2answers
263 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 ...
1
vote
1answer
278 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: ...
0
votes
1answer
54 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: ...
1
vote
1answer
102 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 ...
0
votes
0answers
18 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 ...
5
votes
1answer
400 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 ...
0
votes
2answers
92 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: ...
0
votes
0answers
79 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 ...
1
vote
2answers
142 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). ...
1
vote
0answers
219 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 ...
0
votes
0answers
246 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 <...
0
votes
1answer
374 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 ...
3
votes
0answers
100 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
0answers
134 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 ...
2
votes
1answer
351 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 ...
-1
votes
1answer
392 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 ...
0
votes
0answers
16 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 ...
1
vote
2answers
610 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 ...
2
votes
1answer
781 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 ...
0
votes
2answers
243 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' ...
0
votes
1answer
102 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 ...
4
votes
1answer
288 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 ...
0
votes
1answer
347 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 ...
1
vote
0answers
53 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 ...
0
votes
1answer
105 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 ...
0
votes
1answer
177 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 ...
1
vote
1answer
368 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 ...
3
votes
2answers
217 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 ...
1
vote
1answer
988 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 ...
1
vote
1answer
309 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 ...
1
vote
1answer
661 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
1answer
196 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
vote
1answer
47 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 ...
3
votes
2answers
95 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 ...
1
vote
1answer
549 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/...
2
votes
3answers
84 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 ...
1
vote
1answer
335 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 ...
0
votes
1answer
506 views

How to use delta time when your speed needs to be always the same?

I am using Bezier curve, and that curve positions the entity when the step reaches 1, so anthing between 0 and 1 is his travelling distance. So in my game, according to the speed I set, I want the ...
1
vote
1answer
158 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 ...
0
votes
2answers
807 views

What is wrong with my deltatime?

I have this simple struct that is supposed to calculate the time difference between 2 frames: ...
3
votes
2answers
560 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 ...
0
votes
1answer
2k views

How can I accurately lerp Colors over seconds?

I have some code to lerp between two colors over a set number of seconds, and the lerp works fine: ...
1
vote
1answer
1k views

Multiplayer networking and understanding snapshots between client and server

Please note: Although this question involves a link to the Source Engine, its really a generic question about client-server interactions in multi-player games, and I think can be answered by anyone ...
0
votes
2answers
236 views

Do I still need limit FPS when I have a variable timestep?

Lets say I have a simple game loop (variable timestep - but it applies also for other timesteps): ...
3
votes
2answers
824 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 ...
0
votes
1answer
120 views

What is the formula or algorithm used in libgdx delta time?

I'm studying time stepping algorithm and I need to know how delta time works in libgdx, because I think delta time uses some kind of time stepping algorithm.
2
votes
1answer
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 ...
0
votes
2answers
32 views

Timebased transition from start to end value

I'm trying to implement time line objects, the purpose of those would be to issue events at specific times. When and what is specified through objects called units, which is what you attach in the ...
1
vote
0answers
206 views

Physics fixed time step with client/server games

I'm trying to make a 2D platforming multiplayer game with client/server system. I want to use Node.js and Phaser for the display. I read a lot about fixedTimeStep : http://gafferongames.com/game-...