Page 2 of 5
Re: Performance questions
Posted: Tue Oct 04, 2011 10:13 am
by Wombat
I fixed the Problem. Thanks for your help.
I use love.update(dt) and love.draw() seperately now. And it works.
At first it was too fast. But now i use love.timer.sleep(10) and the framerate is as i want it.
But isn´t the framerate different on every PC? Do i have to edit the love.timer.sleep() number for every PC?
Or should the framerate familiar on every Computer?
Is there any other way to control the framerate?
Thanks for your help
You definitely helped me
Re: Performance questions
Posted: Tue Oct 04, 2011 10:22 am
by kraftman
rather than changing the framerate, you should use dt to control the speed that things occur, that way it will be the same speed on any computer
Re: Performance questions
Posted: Tue Oct 04, 2011 10:29 am
by Robin
See
dt for more information.
Re: Performance questions
Posted: Tue Oct 04, 2011 1:18 pm
by miko
Wombat wrote:Hi there,
i am new in working with LÖVE. But i work with LUA since 4 years.
I wanted to edit a game i made with another Lua-wrapper to run it on LÖVE.
But unfortunately it runs very very slow
.
If another wrapper is SDL-based, there is no reason why it could be slower in Love.
Wombat wrote:
Maybe the problem exist, ´cause of i do the love.draw() in the love.update(dt).
Surely it is the problem.
Please try to understand the Love architecture:
http://love2d.org/wiki/Tutorial:Callback_Functions
Then modify your code according to that.
Re: Performance questions
Posted: Tue Oct 04, 2011 5:25 pm
by T-Bone
Another, worse, solution to things moving to fast, is to use vsync. It doesn't work on all setups though, and the speed will still vary depending on the screen's update frequency (which is 60 per second usually but not always).
The best solution is to multiply all speeds with 60*dt or something.
Re: Performance questions
Posted: Tue Oct 04, 2011 9:12 pm
by Wombat
I tested my Programm on 3 PC´s: 2 Dual Core and 1 Single Core One.
I found out that my game runs always very, very smoothie on the 2 dual core pc´s and always bad on the single core.
And it made NO difference when i used this code structure:
Code: Select all
function love.load()
--code
end
function love.update()
function love.draw()
--all the code
end
end
or this code structure:
Code: Select all
function love.load()
--code
end
function love.update()
--all the code
end
function love.draw()
--all the code
end
Thanks for your help until now.
I only have to set the Timestep correctly, so that the game has an equal speed on every PC. I hope it works when i add (60*dt) on every counter variable^^.
Re: Performance questions
Posted: Tue Oct 04, 2011 9:17 pm
by tentus
Wombat wrote:
And it made NO difference when i used this code structure:
...
Code: Select all
function love.update()
function love.draw()
--all the code
end
end
I hate to say it, but that simply cannot be true. Something is
horribly wrong in the method of your testing if putting draw inside of update gives you the same results as having them separate.
Re: Performance questions
Posted: Tue Oct 04, 2011 9:30 pm
by Wombat
but it´s still running with an extrem high rate of FPS
. And that´s what worth.
And to my "method" of testing: I only look what looks faster. That´s it. Sure there is a difference between the 2 code structures. But my eye can´t see it
.
Furthermore i can´t understand why this engine prefer to seperate these two things when so many programming languages have one main loop... It´s very difficult to seperate the most of my code ´cause maths and drawings are mixed.
Re: Performance questions
Posted: Tue Oct 04, 2011 9:37 pm
by kraftman
Wombat wrote:but it´s still running with an extrem high rate of FPS
. And that´s what worth.
And to my "method" of testing: I only look what looks faster. That´s it. Sure there is a difference between the 2 code structures. But my eye can´t see it
.
Furthermore i can´t understand why this engine prefer to seperate these two things when so many programming languages have one main loop... It´s very difficult to seperate the most of my code ´cause maths and drawings are mixed.
I.. I..... I'll leave this to someone else.
Re: Performance questions
Posted: Tue Oct 04, 2011 9:40 pm
by Wombat
? Now i delete the love.update() loop and the framerate is even higher...
I don´t know what´s going on here? First the IMPOSSIBLE results with this:
Code: Select all
love.update(dt)
love.draw()
--code
end
end
and now this with HIGHER framerate:
I think i missunderstand this engine
I.. I..... I'll leave this to someone else.
Sorry, I am new here