Thread: Need help on design

  1. #1
    Registered User
    Join Date
    Aug 2003

    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.

  2. #2
    Pursuing knowledge confuted's Avatar
    Join Date
    Jun 2002
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. which design is better to wrap another class instance
    By George2 in forum C++ Programming
    Replies: 7
    Last Post: 04-13-2008, 12:27 AM
  2. any comments about a cache design?
    By George2 in forum C Programming
    Replies: 6
    Last Post: 09-14-2006, 12:53 PM
  3. Implementing Inheritence into your design
    By bobthebullet990 in forum C++ Programming
    Replies: 6
    Last Post: 08-05-2006, 04:40 PM
  4. Cprog tutorial: Design Patterns
    By maes in forum C++ Programming
    Replies: 7
    Last Post: 10-11-2004, 01:41 AM