love.physics performance problem

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.
Post Reply
PartyCow
Prole
Posts: 18
Joined: Sat Nov 17, 2012 3:12 pm

love.physics performance problem

Post 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
Attachments
main.love
(1.06 MiB) Downloaded 122 times
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: love.physics performance problem

Post 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.
Attachments
main.love
(1.06 MiB) Downloaded 114 times
Help us help you: attach a .love.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 6 guests