Reputation: 4034
I have made a falling ball in libgdx with box2d.
On my PC the ball falls as it should with clean animation
But when I try this application on my Samsung Galaxy S then all of a sudden it seems to run very slowly... (looks like the fps is 1) however the fps that is printed to the logcat is around 60 (using FPSLogger.log()
).
so it seems it's not the drawing speed holding it back? But what is it? is this a bug with libgdx box2d?
Timestep is 1/60 and there is no special threads going on or something (this is mainly a test and all the code is basically in the render()
function)
Upvotes: 2
Views: 3422
Reputation: 4034
Ok.. So I figured it out...
My problem was the lack of understanding of how game loops and delta times should be used.
Resulting in my game speed depending on the frame rate (on PC it was around 2000)
If anyone has problems with this or something similar I recommend Gameloops and Fix Your Time Step
(P.S I recommend them anyway)
Thanks to kalle_h for helping me find these :)
Upvotes: 4