Getting different speeds on different PC's

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
Stryder
Prole
Posts: 2
Joined: Wed Jan 22, 2014 6:52 pm

Getting different speeds on different PC's

Post by Stryder »

Hey, people! First of all, LÖVE is awesome, and thank you all for your time :D.
So, I've been developing this game that moves in 8 directions, top down. I tried to add acceleration and deceleration (took me a while, I don't know if it's done correctly, it was all made through deduction), tested the prototype on my PC, and everything went smoothly.
Now, today my PC was being used, so I tried to code and test the prototype on my netbook. When I ran the game, I got a totally different speed. Not in the way you may be thinking. The game ran faster on the netbook, a lot faster. A delay that I put for the option selection in the menu became useless, and the acceleration and deceleration were faster too on the character movement.
So, I'm trying to find the problem that's altering my speed. There is different hardware, but I believe the problem is in the way I'm coding, as I find really weird that the game runs faster on the lower end hardware. Anyway, here are the specs of both computers:
Netbook:
Intel Atom N450 1.6Ghz
1GB of RAM DDR2
Windows XP 32bit

PC:
Intel Core i5 750 2.6Ghz
Sapphire AMD Radeon HD 7850 OC Edition
3GB of RAM DDR3
Windows 7 64bit

And I'll attach the love file (be aware: there is a lot of hardcoding, incomplete stuff, and comments are in Spanish).

I'm totally lost on this one. My only experience with game programming was with XNA, and I didn't have any of this problems. I've been trying to find any thread about this, but I completely ignore the origin of this issue, so I don't really know what I should be searching for.
Hope anyone can point out what I'm doing wrong that's making the game unstable, and excuse me for my poor English!

Thanks! :)
Attachments
TK02.love
(4.39 KiB) Downloaded 58 times
User avatar
veethree
Inner party member
Posts: 877
Joined: Sat Dec 10, 2011 7:18 pm

Re: Getting different speeds on different PC's

Post by veethree »

You're not using dt (delta time). There's an article on the löve blogs explaining it. It's a quick read, but basically what you have to do is whenever you're changing the players speed, Multiply it by dt.
like this:

Code: Select all

self.actualYSpeed=self.actualYSpeed-self.speed*dt
Stryder
Prole
Posts: 2
Joined: Wed Jan 22, 2014 6:52 pm

Re: Getting different speeds on different PC's

Post by Stryder »

That seems to be the issue! Thank you very much, veethree! :D

I'll try to repair this, though I have the suspicion that the prototype will crash and burn the very moment I change something, HAHAHA.

EDIT: managed to do it! Though I had to change some stuff, but everything is going smooth in both computers. Again, thanks!
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 4 guests