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
love.physics performance problem
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
love.physics performance problem
- Attachments
-
- main.love
- (1.06 MiB) Downloaded 122 times
- Robin
- The Omniscient
- Posts: 6506
- Joined: Fri Feb 20, 2009 4:29 pm
- Location: The Netherlands
- Contact:
Re: love.physics performance problem
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.
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.
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 6 guests