Skip to main content
GameDev.net gamedev.net
🔒 Locked

Map loading for Tile Engines

Started by PsYchOtroW Oct 27, 2000 at 10:04 AM 3 replies 200+ views
Original Post
PsYchOtroW
PsYchOtroW
Hi, i have an mini level loader how load the tiles for the map like this level: XXXXXXX XXX**XX XXXXXXX ... there are some problems with this loader. 1. how can i implement items... So has somebody good examples/tutorials for other levelmaps loader... and draw... Thanks Lutz Hören
psYchOtroW
C++ Freak
C++ Freak
You could create a map for the tiles and then a map for the items.

TILE MAP

XXXXXXX
XXX**XX
XXXXXXX

ITEM MAP

1=super gun
2=health
x=nothing

x1xx2xx
1xxx**x
x2xxxxx

Visit http://members.xoom.com/ivanickgames
Quantum
Quantum
yeah, layers are a good idea
just have one layer for each thing you want.. items, tiles, collision, etc.
Dino
Dino
There is an article on map file formats in gamedev under the isometric programming section. Check that one out. It''ll give you ideas
Dino M. Gambone
Good judgment is gained through experience. Experience, however, is gained through bad judgment. Currently working on Rise of Praxis MUD: http://www.riseofpraxis.net/

 
JonnyQuest
JonnyQuest
Just so you know, there are other approaches, too.

What I''m implementing into my game is as follows:

(I''m going to use binary files by the way, and this is for a turn based strategy game...)

In the actual map file I have three big sections:
  • The header. This is where all the really important stuff goes, like map size, max players, number of "things" in the map etc. This part also includes important file byte offsets like the beginning of the heightmap, the terrain map, etc.
  • The actual maps. This section contains the heightmap, the terrain map (i.e. what kind of terrain the current tile is) and maybe the light map. I''m not sure about this one yet - it *can* be calculated by the game itself but it takes 5-10 seconds on a slower machine. The downside of saving the lightmap is downloadability - the file size rises by up to slightly more than 64kb. (I have up to 256x256 tiles which have up to 257x257 corners) I might let the game save the lightmap when the map is first loaded.
  • The object section. This is where walls, buildings, trees, other decorations, neutral units, starting points etc. are saved. depending on the complexity of the object, each object will use a different amount of data (rock vs. automatic turret)


Now, the way I''ll handle this while the game is running:

(I''m using VB by the way so some of this may not make any sense to everybody else... apologies!)

I''m not sure exactly how I''m going to do it, but depending on how fast the following method is I may use method no. 2.

1) Have a map matrix (array of structs/classes) with each tile having a pointer to a collection (I think this is the VB equivalent of a linked list) in which I point to everything that is on that tile. When a unit moves I simply point to it from the new tile. Objects spanning multiple tiles are no problem either.

2) If that is not fast enough in VB (haven''t worked with collections yet) I simply use an array of pointers to point to the objects. If that runs out I simply point to the next array of pointers etc.

Hope this helped in a way

- JQ, PWC Software
"programming is all about wasting time" -me
~phil

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.