Performance questions

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.
User avatar
TechnoCat
Inner party member
Posts: 1612
Joined: Thu Jul 30, 2009 12:31 am
Location: Milwaukee, WI
Contact:

Re: Performance questions

Post by TechnoCat »

tentus wrote:
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.
haha yeah.
excerpt from love.run:

Code: Select all

        if love.update then love.update(dt) end -- will pass 0 if love.timer is disabled
        if love.graphics then
            love.graphics.clear()
            if love.draw then love.draw() end
        end
Wombat
Prole
Posts: 31
Joined: Mon Oct 03, 2011 8:38 pm

Re: Performance questions

Post by Wombat »

Do anyone understand why the program i made do those crazy thinks i wrote in my last posts?^^

I realy don´t know what´s going on. When i do things that should make the code faster, nothing happens. If edit the code in a horrible way, it just runs faster...

I don´t understand this world i am livning in :D :D :D
User avatar
Ensayia
Party member
Posts: 399
Joined: Sat Jun 12, 2010 7:57 pm

Re: Performance questions

Post by Ensayia »

Once again, provide us with the code in a .zip or .love format so we can look at it. If you do not want to share your code there is very little we can do to help you.
Wombat
Prole
Posts: 31
Joined: Mon Oct 03, 2011 8:38 pm

Re: Performance questions

Post by Wombat »

My Code has around 2000 Lines. Is that a Problem?
User avatar
kikito
Inner party member
Posts: 3153
Joined: Sat Oct 03, 2009 5:22 pm
Location: Madrid, Spain
Contact:

Re: Performance questions

Post by kikito »

For uploading, no.

For understanding it, it depends on how it is organized.

Definitively, upload it.
When I write def I mean function.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Performance questions

Post by miko »

Wombat wrote: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.
I would say that this is the OS problem. Are you using an antivirus software, or other resource-demanding task? Check disk/CPU usage while running your game (and while not running it).
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Performance questions

Post by Robin »

One thing about defining love.draw inside love.update:

The problem isn't performance. The problem is that it is completely useless.

What if you saw the following code:

Code: Select all

function something()
   local i = 0
   i = 309
   i = 0
   -- some more code
end
What would you do? You would remove the two lines that changed i without changing the meaning of the code, right?

And if we see

Code: Select all

function love.update(dt)
   function love.draw()
     -- drawing code
   end
   -- updating code
end
We change it to

Code: Select all

function love.update(dt)
   -- updating code
end

function love.draw()
   -- drawing code
end
because that makes more sense.
Help us help you: attach a .love.
Wombat
Prole
Posts: 31
Joined: Mon Oct 03, 2011 8:38 pm

Re: Performance questions

Post by Wombat »

Ok i attachet my code below. ^^
Last edited by Wombat on Fri Oct 07, 2011 8:19 pm, edited 1 time in total.
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Performance questions

Post by Robin »

Please include your whole project, not just your main.lua. :)
Help us help you: attach a .love.
User avatar
kraftman
Party member
Posts: 277
Joined: Sat May 14, 2011 10:18 am

Re: Performance questions

Post by kraftman »

You really need to add some formatting to that.
Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests