Skip to main content

Timeline for Implementing "Fix Your Time Step"

Current License: CC BY-SA 3.0

8 events
when toggle format what by license comment
Oct 31, 2016 at 7:58 comment added Domagoj I would check if the loop really is at fault here. Drop the drawing and log the frame times. It could be the drawing that's the bottleneck, or maybe even whatever goes on in this.gamePanel.update(). Stuttering can occur when Java's garbage collection kicks in. If you're instantiating a lot of objects when updating the game, that could cause a performance hit. In that case use a profiler. Some IDEs (Eclipse, IDEA) offer profiling plugins, but there are stand-alone tools available as well.
Oct 30, 2016 at 22:38 comment added Thomas Hartmann Update 2: Seems like Update 1 doesn't seem to work as well as I thought. I still drop a lot of frames and the game still has the same issues. Please help
Oct 30, 2016 at 21:07 comment added Thomas Hartmann Update: I have been able to get rid of most of the stutter (there is still some subtle sutter, but I hope interpolation will fix that). What I did was that I implemented this idea. I introduced a boolean that is set to true inside the nested loop (meaning the game updates) and only if that condition is true postInvalidate is called. The problem is that after (around) 20 seconds of running my game it suddenly drops a lot of frames and then goes back to normal. Do you know what could be the cause of that instability?
Oct 30, 2016 at 20:52 comment added Thomas Hartmann Thank you for your help. Problem 1 is solved. My game is running, however the FPS are really inconsistent. The game stutters a lot and sometimes even stops completely. I assume this is because of postInvalidate() (the draw call) being called as much as possible. I should mention that I haven't applied the interpolation yet, but that can't be the reason as it would only provide a subtle improvement as to smoothness? Do you know by any chance where the stuttering comes from and if so how I could resolve it?
Oct 30, 2016 at 7:44 comment added Engineer Granularity is not the same as failure to correctly convert between numeric types.
Oct 30, 2016 at 7:41 comment added Domagoj Precisely why I specified to check the granularity of the timing function.
Oct 30, 2016 at 7:28 comment added Engineer "Problem 1: That would mean your CPU is cycling through the operations in the loop within a millisecond of the system time" - no such concern. This is purely a numeric type issue. I've experienced it before.
Oct 30, 2016 at 7:25 history answered Domagoj CC BY-SA 3.0