I need a map file structure for my game but does anyone know a good way to map it out? I was thinking something like this:
name=MyMap add[floor[stone]][solid][20, 640] add[playerspawn][20, 620]
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It only takes a minute to sign up.Sign up to join this community
Planning on making these map files by hand? You have 409,599 more lines to write if you want to fill a 640x640 tiled map.
You should store the map in a binary format. An easy way to do that is to serialize the data structure you're storing the map with in RAM.
It would be far easier to write a simple visual editor that allowed you to place tiles and write a binary file, than to write out so many lines by hand.
Depending on what you are going to do for a game, this is diffrent. In other words, An fps, might store additional stuff on the map like, monsters, spawn points of monsters, pickups, and more.
While a RTS might only store, the diffuculty to move there, the tile, and what kind of protection this tile gives.
But you structure there looks wery promising. seems like it will be easy to just add up stuff. and easy to remove stuff. And flexibility is allways a good choise.
This depends on various points. Since you didn't really go in-depth with your current setting (game-type, platform, etc.), all I can do here is do assumptions.
2D vs. 3D, the probably biggest aspect. While storing a pure 2D map (even if it has multiple layers) as a text-like file is still possible, doing the same with a 3D file would be madness.
As an example, the UDK example map "Day and Night" is 189214 kb big. If you were to type every byte per hand, this would take ~150 hours in total, given that you can type 6 days straight without pause.
So clearly, if you aim to create a 3D map, don't even think about creating those by hand.
Various different games require different features. For example:
I have no idea what platform you're working on, PC, Mac, iPhone, Android, GBA, etc., but I have to inform you that various gaming platforms already have either established game SDK's or Frameworks, such as GameKit for iOS, which already comes with every XCode install.
Do a Google-search for your platform and maybe ask around to see which frameworks fit your game and platform. While I do encourage you to do things on your own as you begin, seeing how "pros" do things can't hurt. (E.g. it helped me a lot to see how notch stores his blocks in Minecraft.)
Depending on the size of your game, you might feel the need arise to add a map editor to your game. Not just for the user, but also for yourself! I mean, if you write a set of ten maps, each consisting of a 25 x 25 x 1 tiles, then you could do it by hand, but as soon as events, layers and other more advanced things come in, I strongly advise to create such a tool.