Collision detection performance

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
calebkemper
Prole
Posts: 2
Joined: Wed Oct 22, 2014 6:10 pm

Collision detection performance

Post by calebkemper »

Hi all, new to LOVE and Lua, looking to start some cool gaming projects. :)

Before I start, can anybody tell me what algorithms LOVE uses for collision detection? and how about performance?

This has always been the major roadblock when I have worked on previous projects, so I want to get this information up-front.

Cheers,

Caleb
User avatar
Tjakka5
Party member
Posts: 243
Joined: Thu Dec 26, 2013 12:17 pm

Re: Collision detection performance

Post by Tjakka5 »

Hubo is currently writing a blog about how to make a physics engine, which of course covers collision detection and handling.
Link: http://hugobdesigner.blogspot.com.br/20 ... ngine.html

For performane it's best to try and optimize the collision detection as much as possible, and try to not have it even try to detect it if it's not possible.
calebkemper
Prole
Posts: 2
Joined: Wed Oct 22, 2014 6:10 pm

Re: Collision detection performance

Post by calebkemper »

Thanks for the link!

But did I misinterpret what functionality LOVE has? I understand it implements collision callbacks, but it must be using some algorithm for deciding which entities to check against each other for possible collision?

EDIT: If someone could point me to the code that implements the above, I could definitely do a complexity analysis myself.

Cheers
User avatar
ivan
Party member
Posts: 1911
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

Re: Collision detection performance

Post by ivan »

The physics module in Love is Box2D: http://box2d.org/
Box2D uses space partitioning to reduce the number of collision checks.
I'm not sure but you can set collision filters which MIGHT improve performance a little bit.
For example you can set collision filters that will ignore collisions between bullets in your game.
User avatar
micha
Inner party member
Posts: 1083
Joined: Wed Sep 26, 2012 5:13 pm

Re: Collision detection performance

Post by micha »

LOVE has the love.physics module, which implements Box2d. This module can be used for collision detection. However, if you are going for a really simple game, then you should rather implement collision detection yourself or use one of the libraries made by community members (HardonCollider and bump). These libraries have less overhead and can be expected to be faster, if they fit your needs.
Post Reply

Who is online

Users browsing this forum: No registered users and 214 guests