Why the same max speed value feels different on the different machines?

Hi,

I’m a bit confused. Today I’d tried to play my prototype at work and realized that my character moves much faster than when I play it at home.

Even if you try to launch this tutorial platformer on two different PCs or say PC and iPad you’ll see the difference.

http://imgur.com/9PCAPiy

Is it ok?

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.

1 Like

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?

We have a ticket for this, but I don’t know when we’ll get to this specific issue though.

1 Like

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.

Hello Hio,

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
4 Likes