1. 14

  2. 5

    I wonder why they don’t store the entities in an hashmap with the entity ID as the key. Then each object can look up a referenced entity quickly, and will also know it if the object has been deleted and removed from the hashmap.

    1. 2

      I was wondering a similar thing since this is how I have actually done it on games I’ve worked on.

      I have an automatically incrementing id to give to new entities and used this as a key in a hash table and remove themselves when dead. Other entities only store entity ids and detect when those entities die when the lookup from the hash table fails.

      Maybe Doom/Quake/etc didn’t chose such a solution for performance reasons on older PCs?