How to subdivide a 2d game world for better collision detection

I’m developing a game which features a sizeable square 2d playing area. The gaming area is tileless with bounded sides (no wrapping around). I am trying to figure out how I can best divide up this world to increase the performance of collision detection. Rather than checking each entity for collision with all other entities … Read more

To use the JNI, or not to use the JNI (Android performance)

I just added some computationally expensive code to an Android game I am developing. The code in question is a collection of collision detection routines that get called very often (every iteration of the game-loop) and are doing a large amount of computation. I feel my collision detection implementation is fairly well developed, and as … Read more

Open source, pure Java physics / dynamics library [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 6 years ago. Improve this question I’m looking for a lightweight, pure Java physics engine to do some simulations for robotic motion control. My requirements: … Read more

How to compute the smallest bounding sphere enclosing other bounding spheres

I’m looking for an algorithm which someone has access to that will compute the smallest bounding sphere that encloses a set of other bounding spheres. I have thought about this for a while and have come up with some initial solutions, but I don’t believe these are necessarily the most accurate or the least computationally … Read more

An efficient way to simulate many particle collisions?

I would like to write a small program simulating many particle collisions, starting first in 2D (I would extend it to 3D later on), to (in 3D) simulate the convergence towards the Boltzmann distribution and also to see how the distribution evolves in 2D. I have not yet started programming, so please don’t ask for … Read more

Collisions between game objects and the floor with regards to gravity?

How do games with gravity handle the relationship between moving things like players, monsters, or objects and the floor? Is the player constantly “falling into” the floor and being bounced back up? Two ways to react to collisions that I have found are moving the player back to his previous location before the collision, and … Read more

Fast circle collision detection

I’m trying to write a method that will calculate if two circles are overlapping. I’ve come up with the following and I’m just curious to know if there is anyway it could be optimised further. private static boolean isCollision(Point2D p1, float r1, Point2D p2, float r2) { float a,dx, dy; a = (r1+r2) * (r1+r2); … Read more