Entity ID and IDs map in engine

Added an id to each entity, and the engine now keeps a map similar to the names one. We use grouped entities and needed a way to allow entity retrieval base on a primitive type.