Game works differently on each computer

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
raen79
Citizen
Posts: 55
Joined: Sat Jul 21, 2012 11:58 pm

Game works differently on each computer

Post 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
LaserGuns
Prole
Posts: 33
Joined: Sun Apr 29, 2012 12:55 am

Re: Game works differently on each computer

Post by LaserGuns »

you forgot to use delta time, probably. look it up
User avatar
Boolsheet
Inner party member
Posts: 780
Joined: Wed Dec 29, 2010 4:57 am
Location: Switzerland

Re: Game works differently on each computer

Post 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".
Shallow indentations.
raen79
Citizen
Posts: 55
Joined: Sat Jul 21, 2012 11:58 pm

Re: Game works differently on each computer

Post by raen79 »

Thank you very much :)
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 70 guests