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:
- Have a rule that derives which entities present in which cells.
- 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?
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:
What do you think? Would expressing it as a ruleset introduce significant overhead? Are there any other options?