What's Colli-Da-Scope?

Colli-Da-Scope is a clean solution for the difficulties in dealing with collision detection, tracking, and resolution. It allows the client to provide the detection and resolution logic for various possible collisions through a functional interface so they can let the Colli-Da-Scope system determine the appropriate logic based on the specific collision.

Why Colli-Da-Scope?

Dealing with collisions can be frustrating due to the code required to detect and resolve all the unique possibilities. To aid in the process of selecting the appropriate logic it's tempting to fall into the trap of using mechanisms like the instanceof operator to determine which object types you're dealing with. But being a responsible developer you opt for the common approach to this recurring problem - The Visitor Pattern. However, the drawbacks are undeniably inflexible because it is bi-directional; code on both sides of the relationship have to be updated to support it. Colli-Da-Scope allows the addition of collidable objects without the need for the object it collides with to know about it.

How does it work?

Colli-Da-Scope relies on the Java functional interface to map detection and resolution functionality to a key which describes the collision in terms of the object types involved. Specifically, it uses BiConsumers for resolution and BiFunctions for the detection functionality. The client supplies the logic to the Collider system and the rest is handled automatically.