There has been a problem with some non updated gfx drivers for PC that seems to not enabling the vsync. Make sure they are updated to the latest and also see if vsync enabled could make a difference.
Hm… I’ve changed the refresh rate of my monitor from 144Hz to 60Hz and now the speed is the same but… What if players will have different refresh rates? I’ll affect gameplay. Is there any way to resolve this issue?
In the meantime, can’t deltatime be used to control animation speed on the user side? Relying on vsync or frame limiting for movement and animation is always unreliable, must factor in tic deltatime.
Vrav is right. I have very little experience with programming but i learned very recently about this very topic. different speeds are caused by different processors and also how much processing the computer is doing. Little known fact: in the original “space invaders”, the game gets faster with every alien you shoot, because the frame rate increases when the processor has to render fewer objects. However, in your case (and in many cases), this is not a desired behaviour. That’s why we have dt.
dt is a variable that is the time between frames. Other calculations are only based on frame rate, and will therefore vary device to device (and also processor to processor, and also depending on how fast the game is rendering).
Here’s an example of code with dt. This code moves a star from the bottom of the screen to the top, then changes itself to a random x position, and starts again.
local speed = 250
function update(self, dt)
p = go.get_position()
p.y = p.y + speed * dt
if p.y > 800 then
p.y = -200
p.x = math.random(10,250) *3
print(p)
end
go.set_position(p)
end