Page 1 of 1

love.physics performance problem

Posted: Thu Sep 18, 2014 7:44 am
by PartyCow
Hey there!
I'm getting some awful fps/performance issues when I'm testing my game. It happens when I shoot a lot, by pressing 'f'. Not in a 'I shoot 400 shots at once', but over a short amount of time it makes a 'permanent' slow on the program.
I tried a few things but no idea how to really fix it, so any help on how to do so greatly appreciated.

main.love attached

Re: love.physics performance problem

Posted: Thu Sep 18, 2014 8:13 am
by Robin
The problem was in your collision callback.

You see, you never destroyed the bullet if it had collided with a wall instead of with an enemy.

Also, the use of [wiki]Fixture:setUserData[/wiki]() and [wiki]Fixture:getUserData[/wiki]() together with making bullets a set rather than a sequence would make the collision O(1) instead of O(#bullets). Not that it matters too much, since you never have that many bullets in your game anyway, but still.