Need help on design
I have (or will have) a coordinate-based world in my game and I can't find a good way to do it. Should the coordinates, in a hash table, contain the objects in the game?
Or, should each object in the game have coordinates, and write a function to compare distances between objects? Each object type (people, items,...) would have to be in separate lists/trees, and each list would have to be searched, which seems very expensive.
What is a good data design to represent multiple objects in a coordinate-based world, where it is fast to find the distances between them?
Im kinda high, hope that made any sense.
The way it's normally done in 3d is that you have a bunch of objects, and then a world file - essentailly a map. The map contains data about where objects are located (object name, position, orientation). That way, you can use your "tree" object in 173 different places in the world, but you only need to store the object once.