Jump to content

  • Log In with Google      Sign In   
  • Create Account

Banner advertising on our site currently available from just $5!


1. Learn about the promo. 2. Sign up for GDNet+. 3. Set up your advert!


Coding a Map Parser


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 EricsonWillians   Members   -  Reputation: 288

Like
0Likes
Like

Posted 13 March 2014 - 12:55 AM

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 :).


Creator and only composer at Poisone Wein and Übelkraft dark musical projects:

 


Sponsor:

#2 Ashaman73   Crossbones+   -  Reputation: 11675

Like
3Likes
Like

Posted 13 March 2014 - 01:00 AM

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.


Ashaman

 

Gnoblins: Website - Facebook - Twitter - Youtube - Steam Greenlit - IndieDB - Gamedev Log


#3 EricsonWillians   Members   -  Reputation: 288

Like
0Likes
Like

Posted 13 March 2014 - 01:16 AM

Wow, that's just incommensurably useful. Thank you very much! I'll use it Ad Nauseam :).


Creator and only composer at Poisone Wein and Übelkraft dark musical projects:

 


#4 LeTrappeur   Members   -  Reputation: 182

Like
0Likes
Like

Posted 13 March 2014 - 02:41 AM

https://github.com/bjorn/tiled/wiki/Support-for-TMX-maps

That is a parsers list for Tiled (tmx maps).

 

I use that one for my 2d engine ! :) 

http://trederia.blogspot.co.uk/2013/05/tiled-map-loader-for-sfml.html



#5 MarekKnows.com   Members   -  Reputation: 942

Like
0Likes
Like

Posted 13 March 2014 - 06:33 AM

Is your game 2D or 3D?  


---
Free C++, OpenGL, and Game Development Video Tutorials @
www.MarekKnows.com
Play my free games: Ghost Toast, Zing, Jewel Thief


#6 Avilius   Members   -  Reputation: 603

Like
0Likes
Like

Posted 14 March 2014 - 01:44 PM

I feel that it's safe to assume his game is 3D, based on his response to the 'Tiled' map editor.



#7 ankhd   Members   -  Reputation: 1844

Like
0Likes
Like

Posted 15 March 2014 - 06:53 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS