Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / [Tutorial] Using "Tiled" 2D Map Editor with DarkGDK

Author
Message
SushiBox
16
Years of Service
User Offline
Joined: 20th Sep 2008
Location: Ohio
Posted: 9th Mar 2009 04:28 Edited at: 9th Mar 2009 04:54
Hello, I realized while working on a project of mine that DarkGDK has really no productive way to create orthographic or isometric maps or load them.

The samples that come with DarkGDK show you how to create a map using an array, but that is not a very productive or flexible way to create maps. Here ill show you how to load a map from an XML file in one function!

However, this will not show you how to paste all the tiles to the screen and render a complete map. Because I don't know how yet lol. So if you have any input please let me know!

So lets get down to what we need first:
Latest Java Runtime Environment: https://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/ViewProductDetail-Start?ProductRef=jre-6u12-oth-JPR@CDS-CDS_Developer
Tiled 0.7.2: http://www.mapeditor.org/files/tiled-0.7.2-bin.zip
TinyXML: http://downloads.sourceforge.net/tinyxml/tinyxml_2_5_3.zip?use_mirror=superb-east

Once everything is downloaded preform the following steps:
1. Install the JRE package.
2. Extract Tiled and double click Tiled.jar
3. Extract TinyXML, open the solution and press F7. Open the Debug folder once its done compiling successfully and make sure you include this directory in your DarkGDK project.

Now we need a completed Tiled map to work with, I will not cover how to use it here, but an excellent tutorial can be found here: http://silveiraneto.net/2009/01/11/game-map-edition-using-tiled/

Now lets get to some source. Create the following source files and paste in their contents.

XML.h



XML.cpp



Example XML



Now that we have to code, and see the example XML file, lets see how we get from Tiled to our custom minimalistic map format. Once your done creating your map in Tiled save your map as a .tmx file (the default Tiled format). Go ahead and open it in notepad and make the necessary changes to the file to match my custom format. This will trim out all the unnecessary nodes.

I am currently working on a Tiled plug in that will automatically export the maps in this proper format, so I will release it here as soon as I am finished.

I haven't had a chance to test this full and i'm sure it can be improved. If you notice something that needs fixed or you find a bug please post it here and ill be more than great full and ill change it asap.

Hope this helps and provides a big building block to integrating the Tiled map editor into your DarkGDK game, or any C++ application!

I am working on a 2D Side Scrolling MMORPG, the journey is being blogged and I suggest you check it out. Will include all progress, road blocks even drama! http://exoengine.com/blog/

Login to post a reply

Server time is: 2024-09-30 19:30:47
Your offset time is: 2024-09-30 19:30:47