less_retarded_wiki/collision.md
2022-09-03 14:13:46 +02:00

1.1 KiB

Collision

Collision happens when two or more things want to occupy the same spot. This situation usually needs to be addressed somehow; then we talk about collision resolution. In programming there are different types of collisions, for example:

  • hash collision: When two items produce the same hash, they will map to the same index in a hash table. Typical solution is to have a list at each table index so that multiple items can fit there.
  • collision of bodies in a physics engine: See collision_detection. These collision are resolved by separating the bodies and updating their velocities so that they "bounce off" as in real life.
  • request collision: General situation in which multiple clients request access to something that can be used only by one client at a time, e.g. a communication bus. Resolution is usually done by some kind of arbiter who decides, by whatever algorithm, who to grant the access to.