Page 1 of 1

Limited Updates per Seconds

Posted: Sat Oct 03, 2015 10:07 pm
by Sharkinmytea
Hi, I wanted to make sure that love could handle the game i wanted to do, so I checked how many times love would update per second.
I ran that code into it:

Code: Select all

function love.load()
        updates = 1
	seconds = 0
	updatepersec = 0
end
 
function love.update(dt)
	updates = updates + 1
	seconds = seconds + dt
	updatepersec = (updates / seconds)
	
end
 
function love.draw()

	love.graphics.setColor(255, 255, 255)
	love.graphics.print( updates, 0, 0)
	love.graphics.print( seconds, 0, (0+20))
	love.graphics.print( updatepersec, 0, (0+40))
end
The results I got was that it could do 44 updates per seconds.
Which i find is really low since my computer has an I3 cpu (not the best) and 8 Gb or ram.
So i was wondering, are these the limits of Love2d, or is it automatically restraining the amount of updates it can do in a single second.
And in the end, can it be boosted?

Re: Limited Updates per Seconds

Posted: Sat Oct 03, 2015 10:51 pm
by undef
Your update rate and you FPS should be identical if I'm not mistaken,
so you can actually just do this:

Code: Select all

function love.draw()
    love.graphics.print( love.timer.getFPS() )
end
But what kind of game do you want to make anyway?
You shouldn't have any trouble with most 2D games.

Re: Limited Updates per Seconds

Posted: Sat Oct 03, 2015 11:05 pm
by Sharkinmytea
The fps could be 10 it wouldn't make such a difference in my game.
I'm making a multiplayer rogue like game. The maps are 100 x 100 and there are 5 layers to them.
Since it's a 4 player game, it has to handle 20 layers which all have to receive calculation for the FOV, collision and multiples other instances.
Adding to that, there is the pathfinding algorithm that eats a lot and quite a few more stuf here and there that eat up ram and cpu usage.

I know i can code it in a way that it uses much less.
But I'm still curious if the Updates Per Seconds will change with that.

Re: Limited Updates per Seconds

Posted: Sun Oct 04, 2015 2:48 am
by Karai17
LOVE can update at 1000 times per second without modification. Higher if you customize love.run.