Thread: How to represent a map

  1. #1
    Registered User gavra's Avatar
    Join Date
    Jun 2008
    Posts
    265

    How to represent a map

    hi,
    I couldn't find anything on web about ways to represent a map. I sometimes improvise, but I thought that maybe there are some "known ways" to represent a map. so?
    (generally speaking of game or simulation program maps that include some info, nothing specific). Also what should I use, a database or a txt file?

    Thank you (:
    Last edited by gavra; 08-11-2011 at 10:43 AM.
    gavra.

  2. #2
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    A map of what?

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Back in my day, we made our own!


    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Hehe I remember those days. Only I was making the map for Zork instead of Wizardry.

  5. #5
    Registered User gavra's Avatar
    Join Date
    Jun 2008
    Posts
    265
    Whatever.. >_<

    Hum, let's say that we want to represent a map of roads that contain intersection of roads and permissible speed..
    gavra.

  6. #6
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Why not store it as a graph of nodes and edges (with the edge value being the speed limit)?

  7. #7
    Registered User gavra's Avatar
    Join Date
    Jun 2008
    Posts
    265
    What do you mean?
    Can you demonstrate this way?

    By the way, I'm also talking about represent a map using a file (save the map) not only how to use it in code.
    gavra.

  8. #8

  9. #9
    Registered User
    Join Date
    Sep 2011
    Posts
    5
    Does anyone know what kind of data structure is used in a game like Terraria to model the world?

  10. #10
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    I'd use a 2D grid of layers. The world doesn't get any wider or taller, so the rows and columns remain fixed. All that changes is what each cell contains, and each one seems to contain a wall and an object (say a dirt wall background, and a dirt square therein). So a simple structure that contains background and foreground should be sufficient.


    Quzah.
    Hope is the first step on the road to disappointment.

  11. #11
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Does anyone know what kind of data structure is used in a game like Terraria to model the world?
    No but I do know that you revived a dead thread for no reason. Closed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to represent list using trees
    By C_Enthusiast in forum C Programming
    Replies: 17
    Last Post: 07-30-2010, 09:27 AM
  2. Represent Maze
    By iamnew in forum C++ Programming
    Replies: 37
    Last Post: 04-28-2010, 08:47 PM
  3. shorter way to represent alphabet
    By cdkiller in forum C++ Programming
    Replies: 5
    Last Post: 09-30-2006, 12:38 PM
  4. Which characters represent EOF in windows?
    By hitesh1511 in forum C Programming
    Replies: 10
    Last Post: 08-11-2006, 12:07 PM
  5. how do you represent the arrow keys in c++
    By ArseMan in forum C++ Programming
    Replies: 5
    Last Post: 09-20-2001, 11:37 PM