Page 1 of 1

Game works differently on each computer

Posted: Thu Aug 09, 2012 7:38 pm
by raen79
Hey guys, I made a game, and fortunately right after releasing the demo, I found out that the game works differently on each computer, do you guys know what the problem is? (it is not canvases, I mean the game's physics are different on each computer.
http://www.gamefront.com/files/22102835/PauZ_Source.zip

Re: Game works differently on each computer

Posted: Thu Aug 09, 2012 11:41 pm
by LaserGuns
you forgot to use delta time, probably. look it up

Re: Game works differently on each computer

Posted: Thu Aug 09, 2012 11:55 pm
by Boolsheet
Like LaserGuns said, you didn't take the variable update time into account for some things. Disable vsync and you can test it on your system.

For the jump, you set the vertical linear velocity of the body to -2000 every update. If the update happens every millisecond, the physics engine has less time to work the gravity on it than it would if it only happens every 16 milliseconds and the player will go higher.

A simple but somewhat ugly solution would be to accumulate the dt until it reaches the 16 ms and only execute the update stuff if it is equal or over 16 ms. Maybe you even need to to a fixed time step to make sure it's the same for everyone. I never tried platformer physics with Box2D and it's probably not going to work very well unless you know how to work Box2D for it.

Also, don't do this:

Code: Select all

function love.conf(t)
    t.identity = "'%appdata%\Love\'"
end
You're not supposed to give a path, but just a name which will be used for the directory. Like: t.identity = "PauZ".

Re: Game works differently on each computer

Posted: Fri Aug 10, 2012 11:16 am
by raen79
Thank you very much :)