Jump to content
  • Advertisement
Sign in to follow this  
EricsonWillians

Coding a Map Parser

This topic is 2043 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I find myself now in the necessity of creating maps for my game. The very concept of "levels" or "arenas" or "maps" is a concept that almost automatically evokes the necessity of some kind of parser. I want a game not with just one simple "default level", but a game with 10 or 20 or 50 levels, and I want to be able to customize them quickly without having to mess up the source code. 

 

So that's it, the solution is obvious: Let's write a parser!

 

Oh.. wait.. But I never did that before. "How do I do that?" That's the question!

The game I'm developing is a platform game and my whole engine is based on a quite complex grid system, so, naturally, it shall be quite natural to try something like this in a .map(txt) file:

{0,0,0,0,0..............}

 

So, I'm going to philosophize on the subject to develop my parser, but I would like to know your experience with it, no matter if you wrote a simple grid-link text representation or a whole language with its own syntax. Anything shall be useful and interesting :).

Share this post


Link to post
Share on other sites
Advertisement

Take a look at tiled, it is a tile (grid) editor, supports objects and multiple layers and you can export it to some really useful formats like simple text or xml, even lua. Writing a parser for this should be quite simple.

Share this post


Link to post
Share on other sites

Helllo.

 

for my maps I have a head structure that holds things like the size and general things about the map

then after that data is written to file I store a type and size then a data chunck of size.

remember you don't need to save all things some stuff can be recreated at run time.

like I don't save every cell in the map only ones that differ from default.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!