Page 4 of 5
Re: Performance questions
Posted: Wed Oct 05, 2011 9:23 am
by Wombat
Here´s my project. The .love file didn´t run so i simply zip the project folder. Please draw the project folde on your love.exe
You really need to add some formatting to that.
You´re right. My code is just uncleaned^^.
Re: Performance questions
Posted: Wed Oct 05, 2011 1:40 pm
by Robin
Wombat wrote:The .love file didn´t run so i simply zip the project folder.
You probably zipped the project folder, am I right?
The way to make a .love file is not creating a .zip file from the project folder, but the from the
contents of the project folder (main.lua and the gfx directory in this case).
Re: Performance questions
Posted: Wed Oct 05, 2011 2:22 pm
by Wombat
Yes, i already know.
But it didn´t worked when i do the main.lua in the top-level.
Re: Performance questions
Posted: Wed Oct 05, 2011 3:30 pm
by tentus
Wombat wrote:Yes, i already know.
But it didn´t worked when i do the main.lua in the top-level.
I think its because you have some case inconsistencies. If a folder has a capital letter in it, the code has to also have a capital letter (myBlaster vs myblaster)
Re: Performance questions
Posted: Wed Oct 05, 2011 3:41 pm
by Wombat
I have another question: How can i generate a constant framerate in my programs?
Somenone said it´s good to use love.timer.step() others say that it´s better multiplie all counters with dt.
And i think there are a lot of other possibilities...
Do you know a good and testet way to make a constante framrate in .love programs?
Re: Performance questions
Posted: Wed Oct 05, 2011 4:22 pm
by Robin
Wombat wrote:How can i generate a constant framerate in my programs?
Simply put, you can't.
There are certain tricks you can use, but they are all imperfect. Instead it is a good idea to anticipate the variability of the world. This means using dt, among other things.
Re: Performance questions
Posted: Wed Oct 05, 2011 6:38 pm
by GijsB
Wombat wrote:I have another question: How can i generate a constant framerate in my programs?
Somenone said it´s good to use love.timer.step() others say that it´s better multiplie all counters with dt.
And i think there are a lot of other possibilities...
Do you know a good and testet way to make a constante framrate in .love programs?
The easiest way is like :
Code: Select all
local Timer0 = 0
local SOMENUMBER = 1
function love.update(dt)
Timer0 = Timer0+dt
if Timer0 > SOMENUMBER then
--do things here
Timer0 = 0
end
end
this way you have a somewhat constant update every 1(SOMENUMBER) second
Re: Performance questions
Posted: Thu Oct 06, 2011 12:06 pm
by Wombat
The easiest way is like :
Code: Select all
local Timer0 = 0
local SOMENUMBER = 1
function love.load(dt)
Timer0 = Timer0+dt
if Timer0 > SOMENUMBER then
--do things here
Timer0 = 0
end
end
this way you have a somewhat constant update every 1(SOMENUMBER) second
Unfortunately this doesn´t work for me.
But thanks for your help
I found a solution that works for me:
Code: Select all
function load()
fps_buffer = 0
factor = 0.01
max_frame = 60
end
function update(dt)
fps = love.timer.getFPS( )
love.timer.sleep(fps_buffer)
if fps < max_frame then
fps_buffer = fps_buffer - factor
elseif fps > max_frame then
fps_buffer = fps_buffer + factor
end
end
At first you have to wait some seconds until the framerate has the value you want. I think i have to optimize it, so you don´t have to wait until the value max_frame is like you wish.
Re: Performance questions
Posted: Thu Oct 06, 2011 1:32 pm
by Robin
Wombat wrote:Unfortunately this doesn´t work for me.
But thanks for your help
He should have said love.update(dt) when he said love.load(dt).
Wombat wrote:I found a solution that works for me:
Are you using LÖVE 0.5.0?
Re: Performance questions
Posted: Thu Oct 06, 2011 1:45 pm
by GijsB
Robin wrote:Wombat wrote:Unfortunately this doesn´t work for me.
But thanks for your help
He should have said love.update(dt) when he said love.load(dt).
Wombat wrote:I found a solution that works for me:
Are you using LÖVE 0.5.0?
thanks for clearing out my horrible mistake