Skip to content

Efficient collision detection? #21

@ul

Description

@ul

On the one hand, iterating all entities to check for collision detection could be expressed as an elegant and concise rule. On the other hand, the naive rule will be grossly inefficient in the presence of many entities moving on each tick, leading to O(n^2) checks. What would be the recommendation? Is there an efficient ruleset to use, or should collision detection have its own implementation and just be fed data from the session?

I reckon uniform grid might be expressed as a ruleset and still be relatively efficient:

  1. Have a rule that derives which entities present in which cells.
  2. Have another rule that checks collisions for all entities spotted in the same cell.

What do you think? Would expressing it as a ruleset introduce significant overhead? Are there any other options?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions