Large delta after pause/resume (Android)
See original GitHub issueIf a game (or in my case a live wallpaper) is paused for a long time, after resuming, Gdx.graphics.getDeltaTime() will give the delta of the entire pause duration. This causes freeze/stutter on resume as the game tries to process possibly hours worth of delta.
Adding this to onDrawFrame before the delta calculation in AndroidGraphics/AndroidGraphicsDayDream/AndroidGraphicsLiveWallpaper should fix this I believe.
if (lresume)
lastFrameTime = System.nanoTime()
I’m currently using this workaround
private boolean resuming;
public void render()
{
float delta;
if(resuming)
{
delta = 0f;
resuming = false;
}
else
{
delta = Gdx.graphics.getRawDeltaTime();
}
...
}
public void resume()
{
resuming = true;
}
However, now I can’t use the smoothed delta because it includes the large delta from the pause.
Issue Analytics
- State:
- Created 10 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
LibGDX stop time counter on pause - java - Stack Overflow
Because delta is now 0 the timer will not increase and not increase until the game state it back to GAME_RUNNING after resume()...
Read more >Pause or resume data for a Flexible group plan - Google Fi Help
Under "Your group plan," select Manage Plan. Select Pause Data. View a tutorial on how to pause data for an account member on...
Read more >Uploading and copying objects using multipart upload
Pause and resume object uploads – You can upload object parts over time. After you initiate a multipart upload, there is no expiry;...
Read more >How Do I Pause a Recorded Activity? - Garmin Support
Select Garmin watches feature Auto Pause, which will pause the timer ... Select watches come with the Resume Later function, which allows you...
Read more >The right way to pause a game in Unity - Game Dev Beginner
deltaTime when moving objects. When pausing the game using the time scale method, instead of the time since the last frame, Time.deltaTime will ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Look into #1133, this is maybe what you need.
This bug still exists in iOS. I’m porting my game using Intel MOE and the delta value adds up when paused and resumed. I have a countdown in my game depending on the delta time and this bug is causing problems.
Edit: I guess capping is a workaround for me.