I was wondering two things about the built in shape detection of Slick2D. When executed on a lot of shapes, how performant are the intersects and containsmethods, and what kind of algorithm is behind those.

I have implemented SAT collision detection but I don't want to execute this detection on all my entities. So I thought I would use the built in methods to look for entries which are near my player, and for those do the SAT detection.

But if the built in methods are as good as or better than SAT, this wouldn't be good. Also if the built in methods need more time or are kind of heavy for the cpu.

What is the proper way to have my collision detection on the smallest amount of game objects. How would I filter only the near objects?


1 Answer 1


All collision detection methods can benefit from pruning the list of objects to test before testing.

One of the ways is to partition your world so you can query the objects that may intersect with some area (false positives are allowed) then only do the collision test on those objects. For example store the axis aligned bounding box in a grid and knowing that you can just index into the grid to know which objects are in each grid cell and you don't have to worry about those across the world.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .