Jump to content


Photo

Tiled Importer For Game Maker Studio


  • Please log in to reply
48 replies to this topic

#1 Pasty

Pasty

    GMC Member

  • GMC Member
  • 38 posts
  • Version:GM:Studio

Posted 06 June 2013 - 09:50 AM

Tiled Importer for Game Maker Studio (current version: 0.9.8.1, thanks to gameus and DivideByNil for the revisions)
Requires .NET Framework 4.0

 

Tiled Importer for Game Maker Studio converts Tiled Map Files (.tmx) to Game Maker Studio files (.gmx). Not only does Tiled Importer for Game Maker Studio handle normal tile data files, it also handles tile offsets and isometric maps with ease.

tiled_importer.png

 

Usage:

  • Converting: add all the .tmx files you want to convert using the "Add" button, set a destination folder, set your initial depth and depth spacing (see the manual), and click "Batch Process". The program will spit out everything you need - rooms, backgrounds, and tileset images - to make importing your Tiled maps into Game Maker Studio easy. (In addition to depth auto-spacing, depth can also be set manually, see the program information for more details.)
  • Importing: open a Game Maker Studio project. First, add the background.gmx files by right-clicking on the Backgrounds folder and selecting "Add Existing Background..." If your tilesets aren't already alpha transparent, you'll need to use the GMS image editor in order to eliminate the color you used to denote transparency. After all the backgrounds are imported, then add the rooms the same way you added the backgrounds. Finally, save your project to copy your new rooms and backgrounds to the project folder.

Notes:

  • This program is only compatible with Game Maker: Studio projects!
  • Your .tmx files need to be in XML format! The program will highlight tilesets in base64 or CSV format so you can easily save them as XML files in Tiled.
  • I'm still accepting test data for this program. If this program breaks your Tiled map, let me know in this topic (and, if you can, supply me with the map both before and after conversion so I can see what went wrong and fix it for the release version).

Source:

 

Tiled Importer 0.9.6 (edits by gameus)

Tiled Importer 0.9.8.1 (edits by DivideByNil)

 

Tiled Importer for Game Maker Studio (current version: 0.9.8.1, thanks to gameus and DivideByNil for the revisions)
Requires .NET Framework 4.0

 

Other versions:

 

0.9.7

 

If you have any questions or comments, do feel free to let me know.


Edited by Pasty, 05 July 2014 - 02:09 PM.

  • 4

#2 TheMagician

TheMagician

    GMC Member

  • GMC Member
  • 601 posts

Posted 06 June 2013 - 07:10 PM

Let me be the first one to thank Pasty for his great work on this project. 

A few month ago, after he had released the Tileset Champion and the Offset Champion I contacted Pasty via PM and asked him whether he could create an importer for the Tiled map editor. I am working on a large project that requires a lot of tilesets and even though GM:S' built-in tile capabilities have improved over the last couple of updates they are nowhere near the ease of use of Tiled.

 

Pasty agreed to look at the Tiled editor and came up with this program which can take exported Tiled data and import it into GM:S' room format. 

There is another Tiled Importer which you can find on these forums but that loads the tile maps during runtime. Pasty's program has the advantage that the imported rooms can then be further modified in the GM room editor.

 

Thanks again for taking on this project without even knowing who I am. It is very much appreciated.  :thumbsup:

I'm sure this will benefit a lot of level designers by speeding up their workflow.


  • 1

#3 gadgetmawombo

gadgetmawombo

    GMC Member

  • GMC Member
  • 204 posts
  • Version:Unknown

Posted 09 June 2013 - 12:08 AM

This is a really nice little program, legit work!


  • 0

#4 Manuel777

Manuel777

    InvaderGames

  • GMC Member
  • 3536 posts
  • Version:GM:Studio

Posted 09 June 2013 - 03:02 PM

I am not much of a fan of tileset editors, but I can see this is super! great work Pasty  :thumbsup:


  • 0

#5 Crhonos

Crhonos

    GMC Member

  • GMC Member
  • 235 posts
  • Version:GM:Studio

Posted 11 June 2013 - 03:42 PM

How does this program choose which tileset it will use in GMS?

 

 

 

Edit: Sorry didn't see the importing instruction u.u


Edited by Crhonos, 12 June 2013 - 12:49 AM.

  • 0

#6 TheMagician

TheMagician

    GMC Member

  • GMC Member
  • 601 posts

Posted 11 June 2013 - 06:55 PM

Read the instructions in the first post. The program also produces background resources for you that you then import into GM:S. These backgrounds are referenced in the room file that the program also creates.


  • 0

#7 Destron

Destron

    GMC Member

  • GMC Member
  • 1243 posts
  • Version:GM:Studio

Posted 13 June 2013 - 05:15 AM

Just tried this out, and I have to say that this is awesome work! I used Tiled for prototyping layouts, now I can just export them straight in to GMS. The only thing I would change is to have it show you it did its job. I converted the first map 3 times because I thought it wasn't doing anything when I hit the button. Also, since I have never actually used a finished product from Tiled for anything before I didn't know how to change it to save in XML format - I dug around and found it - but you may want to be more clear about that in the manual.


  • 0

#8 underscore_underscore

underscore_underscore

    GMC Member

  • GMC Member
  • 71 posts
  • Version:GM:Studio

Posted 14 June 2013 - 11:00 PM

This is excellent. Thank you.

 

Is there a GM:S misc resource list somewhere? I think this should be added (or pinned!).


  • 0

#9 Pasty

Pasty

    GMC Member

  • GMC Member
  • 38 posts
  • Version:GM:Studio

Posted 20 June 2013 - 04:23 AM

Hey, thanks for the comments!
 

I converted the first map 3 times because I thought it wasn't doing anything when I hit the button. Also, since I have never actually used a finished product from Tiled for anything before I didn't know how to change it to save in XML format - I dug around and found it - but you may want to be more clear about that in the manual.


I'll keep this in mind for the next version, thanks.

P.S: Also, as a clarification, I didn't make Tileset Champion, only Offset Champion and this program.

Edited by Pasty, 20 June 2013 - 04:24 AM.

  • 0

#10 jtn0514

jtn0514

    GMC Member

  • GMC Member
  • 137 posts
  • Version:GM:Studio

Posted 30 July 2013 - 07:01 AM

Had some issues with this at first using this and importing the converted room to GM studio would crash or hang and never come back., however i finally figured out i was overlooking something simple..

 

Turns out when specifying the room size in Tiled map editor, you need to take the room size you want in gm studio (2048x2048 for instance) and then divide the width of the room and height of the room by the tile size and the outcome must be an even number and not a fraction.

 

So for 16x16, you would use  128x128 sized tile map within Tiled map editor program. Then once imported, the room size should be 2048x2048..

 

My problem was just taking the room size 2048x2048 and putting that into the tiled map editor program and it was doubling the size and crashing on importing the room to GM studio as it was generating a MASSIVE map that took forever to save in xml format in Tiled map editor.

 

Hope this bit of info helps anyone else using this later on down the road.


  • 0

#11 Pasty

Pasty

    GMC Member

  • GMC Member
  • 38 posts
  • Version:GM:Studio

Posted 30 July 2013 - 04:48 PM

I'll look into this. Thanks for the tip!


  • 0

#12 Andy

Andy

    GMC Veteran

  • GMC Member
  • 1889 posts
  • Version:GM:Studio

Posted 05 August 2013 - 06:53 PM

Very nice work!


  • 0

#13 marcosromeroj

marcosromeroj

    GMC Member

  • New Member
  • 12 posts
  • Version:GM:Studio

Posted 29 October 2013 - 03:31 PM

Excellent work!! It's really easy to edit rooms with Tiled map Editor instead of Room editor..

 

But after tried this out I found some problems when import .tmx files.

 

I have uploaded a gms.project example with 3 rooms in it. An isometric, and 2 orthogonal rooms.

 

https://www.dropbox....er_test.gmx.rar

 

Isometric problem: I made a 32x16 grid room in Tiled and I add a tileset with 32x32 tiles in it because of walls and high objetcs. When I import to GMS, It is like the importer only draws 32x16 tiles, so walls are not properly drawn. If I use 32x16 tileset the program import the map ok, but you can only draw flattern maps without walls or higher objects...

 

Orthogonal 2 is ok.

 

Orthogonal 1 problem: This is a simple map but when I import to GMS, you can see some tile replacement. Maybe the size of the tileset background? Orthogonal 2 background is square (128x128) and this one is rectangular ¿?¿?

 

I uploaded too a tiled map folder with .tmx maps to open in Tiled.

 

Thank you again for your good work with that program!!


  • 1

#14 Pasty

Pasty

    GMC Member

  • GMC Member
  • 38 posts
  • Version:GM:Studio

Posted 07 November 2013 - 09:35 PM

Thanks, I'll take a look at the problems as soon as I can get to them. This program is probably overdue for a second look, anyway.


  • 0

#15 Pasty

Pasty

    GMC Member

  • GMC Member
  • 38 posts
  • Version:GM:Studio

Posted 29 November 2013 - 08:17 AM

Updated the program to 0.9.5.

 

Fixlist:

  • Fixed a bug in importing isometric maps. If the map had different grid snapping dimensions and tile dimensions, the program would only use the grid snapping dimensions, leading to a bad offset figure when calculating tile origin.
  • Fixed a bug in importing orthogonal maps: the map spacing wasn't being calculated right. The tile origin calculation code has been refactored as a result.
  • Fixed a bug in GID offset: if two tilesets have the same name in Tiled, the second tileset's GID offset is not obtained, resulting in unusable tile data for the second tileset. This fix explicitly disallows running the program on a map that has two tilesets with the same name.
  • Added various usability fixes to the program.

Enjoy.


  • 0

#16 marcosromeroj

marcosromeroj

    GMC Member

  • New Member
  • 12 posts
  • Version:GM:Studio

Posted 07 December 2013 - 08:01 PM

Updated the program to 0.9.5.

 

Fixlist:

  • Fixed a bug in importing isometric maps. If the map had different grid snapping dimensions and tile dimensions, the program would only use the grid snapping dimensions, leading to a bad offset figure when calculating tile origin.
  • Fixed a bug in importing orthogonal maps: the map spacing wasn't being calculated right. The tile origin calculation code has been refactored as a result.
  • Fixed a bug in GID offset: if two tilesets have the same name in Tiled, the second tileset's GID offset is not obtained, resulting in unusable tile data for the second tileset. This fix explicitly disallows running the program on a map that has two tilesets with the same name.
  • Added various usability fixes to the program.

Enjoy.

 

How great you are Pasty!! Good work!!

 

I'll take a look :D


  • 0

#17 gameus

gameus

    GMC Member

  • New Member
  • 17 posts
  • Version:GM:Studio

Posted 13 March 2014 - 01:58 AM

I've been trying to convert a map with only one tileset and I keep getting an error.

7tign.png

I can assure you my Tiled map is in XML format and only has one tileset.

Spoiler


I'd absolutely love to use this, I ended up making my own importer since Tiled supports exporting to JSON format, but this seems like it'd be much more easier to use.

EDIT:

I was also gonna request a feature, or maybe would you be willing to share the source code? I do like the Depth feature and the spacing, but some layers should be above the player (such as the tops of tress in RPGs) and maybe have it check to see if a "depth" property exists in each layer as it's getting converted, if it is, use it instead.

EDIT 2:

I fixed the error. Even though I had the image in the same directory as the map, the map itself was still referencing to the image when it was in a different directory. Fixed it in the XML file and it converted it just fine. Awesome tool!

Edited by gameus, 13 March 2014 - 05:54 AM.

  • 0

#18 gameus

gameus

    GMC Member

  • New Member
  • 17 posts
  • Version:GM:Studio

Posted 16 March 2014 - 02:47 PM

So I got a hold of Pasty and he was kind enough to share the source code with me. I made a couple of modifications and fixed the error it gives you if the image isn't in the same folder.

*Images no longer have to be in the same folder. It can be anywhere on the computer, even on a separate hard drive. I've tested the code pretty thoroughly and haven't had it throw me an error yet.

*I also added the depth feature. If someone add's the depth property to any layer, it'll use that value instead. This helps to place things at a negative depth to be displayed above a player or other objects. If a layer has a depth property, it won't space out the depth until the next layer.
You have two options with depth. You can let the program automatically adjust depth as it goes through layers, or you can manually set it. To manually set the depth, right click your layer in Tiled, click Layer Properties, and add a property labeled depth. Then set the depth to any number you want.

*The program now remembers your last "Converted Folder" location. So when you reboot the program, it'll automatically fill that spot in. This has helped me since my converted folder was a deep child folder.

*I added my name to the About box as well. And changed the version number to 0.9.6.0. I might work on an object layer importer as well. Big thanks to Pasty for sharing the code with me, or these modifications wouldn't have happened.

Tiled 0.9.6.0 Build
Tiled 0.9.7.0 Build

Changelog:
0.9.7.0
*Fixed "depth" bug

Images:
Spoiler

Spoiler


I hope these changes can help a few people out! If you run into any bugs with this version, lemme know, I'll fix it right away!

Edited by gameus, 05 April 2014 - 12:40 PM.

  • 1

#19 jkamcmillen

jkamcmillen

    GMC Member

  • GMC Member
  • 37 posts
  • Version:GM:Studio

Posted 05 April 2014 - 04:39 AM

I hope these changes can help a few people out! If you run into any bugs with this version, lemme know, I'll fix it right away!

 

Hi gameus, thanks for the updates!

 

I suspect that this "depth feature" has actually broken it's initial automatic setting of each layer's depth values in the resulting GMX room file. It seems that if I do not add any "depth" (?) property to my layer in Tiled it just lumps them all into the same layer. Not what I really want to happen when I set my Initial Depth and Depth Spacing values in Map Settings.

 

There isn't really any instructions on how your depth feature works so that would be helpful. ie. should I be adding a case sensitive property name to Tiled and under what part of my layer's data? Tile Layer, Custom Properties?

 

A little more information and maybe a toggle option for your new feature would be a great fix. Thanks!


  • 0

#20 gameus

gameus

    GMC Member

  • New Member
  • 17 posts
  • Version:GM:Studio

Posted 05 April 2014 - 12:43 PM

Hey, glad you like the updates. :) My new feature I implemented broke the automatic depth feature. But I fixed it, if you just check my last post, I added a new download link. I also added a bit of information to my depth feature. It now either A) Automatically calculates the depth or B) If you add the property "depth" to a layer and give it an actual number value, that'll be the layer's depth in Game Maker. If you don't add this property, it'll still auto-calculate the depth for you.
  • 0

#21 nasty

nasty

    GMC Member

  • GMC Member
  • 21 posts
  • Version:GM:Studio

Posted 06 April 2014 - 02:17 PM

Thanks gameus for the various fixes/updates! :)


  • 0

#22 jkamcmillen

jkamcmillen

    GMC Member

  • GMC Member
  • 37 posts
  • Version:GM:Studio

Posted 08 April 2014 - 04:35 AM

Hey, glad you like the updates. :) My new feature I implemented broke the automatic depth feature. But I fixed it, if you just check my last post, I added a new download link. I also added a bit of information to my depth feature. It now either A) Automatically calculates the depth or B) If you add the property "depth" to a layer and give it an actual number value, that'll be the layer's depth in Game Maker. If you don't add this property, it'll still auto-calculate the depth for you.

That's perfect! Thanks so much for the quick fix.


  • 0

#23 Pasty

Pasty

    GMC Member

  • GMC Member
  • 38 posts
  • Version:GM:Studio

Posted 08 April 2014 - 04:58 AM

I haven't been able to be around a lot because of a few big things I've been working on, but I went ahead and open-sourced this. Feel free to futz around with the source if you want and make it do what you need it to do for your particular Tiled-dependent project.

 

Thanks for making the program ever better, gameus, you're way better at responding quickly than I am! If you want, you can ping me with updates and I'll put your latest version in the topic header.


  • 0

#24 gameus

gameus

    GMC Member

  • New Member
  • 17 posts
  • Version:GM:Studio

Posted 08 April 2014 - 03:14 PM

Sure thing! I'm really glad you guys like the updates! :)

I've been playing with it a bit more, I think I can make it parse Tiled's objects, I'm just trying to figure out how Game Maker generates Instance Names.
    <instance objName="obj_die" x="32" y="64" name="inst_C56F5029" locked="0" code="" scaleX="1" scaleY="1" colour="4294967295" rotation="0"/>
Basically, in Tiled, you can have shapes or images represent objects, and as long as you give that object a name, I can make the Exporter put the name in the room file and it should add the instance properly when opened in Game Maker.

EDIT:

Hey Pasty, might want to update your "Notes" section, let people know they can change the depth themselves and the image no longer has to be in the same directory.

Edited by gameus, 08 April 2014 - 03:24 PM.

  • 0

#25 rwkay

rwkay

    YoYo Games CTO

  • YoYo Games Staff
  • 2489 posts
  • Version:Unknown

Posted 08 April 2014 - 03:48 PM

Instance Names can be any valid id (i.e. any combination of alpha numeric characters that does not begin with a number) as long as it is unique over the whole project (i.e. does not match any other asset name or variable name) we generate the instance names as inst_<hex_number> the hex number is a CRC of all the instance data which should make it unique... but it can be anything at all (the user can name it, just right click in the room editor on the instance and select Rename Object Instance

 

Russell


  • 1

#26 gameus

gameus

    GMC Member

  • New Member
  • 17 posts
  • Version:GM:Studio

Posted 08 April 2014 - 03:55 PM

Okay, I see, thanks for the help. So I could just probably generate instance id's like so
tiledObj_IDHERE
I think if no one objects, I'll have people select their Project Directory (this is only if you plan on importing objects over from Tiled), then the program can scan each room and scan each instance to see if the name is unique or not.
  • 0

#27 jkamcmillen

jkamcmillen

    GMC Member

  • GMC Member
  • 37 posts
  • Version:GM:Studio

Posted 09 April 2014 - 10:15 PM

Okay, I see, thanks for the help. So I could just probably generate instance id's like so

tiledObj_IDHERE
I think if no one objects, I'll have people select their Project Directory (this is only if you plan on importing objects over from Tiled), then the program can scan each room and scan each instance to see if the name is unique or not.

 

May I suggest making this as an option rather than a fixed feature? A simple toggle box could allow us to turn this on and off in case we are comfortable without having to verify within our project. ie. we just want to use the tile editing and not the objects, etc.

 

Alternately you could also have a popup asking for the foloder location only when you are converting a tmx file that has object data in it.


Edited by jkamcmillen, 09 April 2014 - 10:16 PM.

  • 0

#28 gameus

gameus

    GMC Member

  • New Member
  • 17 posts
  • Version:GM:Studio

Posted 09 April 2014 - 10:18 PM

Of course, objects are going to be optional. I'm not going to force it upon people. For myself, I see it quicker for myself if I can sit there and map my invisible solid objects on the map than just straight import it into Game Maker. Place my characters and NPCs and call it good.
  • 0

#29 jimmbimm

jimmbimm

    GMC Member

  • New Member
  • 15 posts
  • Version:GM:Studio

Posted 15 May 2014 - 06:44 PM

Wow, thanks. This tool helps a lot :D


  • 0

#30 Yokan

Yokan

    GMC Member

  • GMC Member
  • 25 posts
  • Version:GM:Studio

Posted 18 June 2014 - 04:15 AM

Great little tool ! Thank you Pasty & gameus !

 

I've some suggestions to improve the workflow, still I use it heavily :

 

- Same export tree directories than GMS !

- Set the room speed

- Well, in fact, the whole settings that we already have in the GMS room editor ... haha.

 

Two others, more "exotic" :

- Something more clear for setting layer's depth. More like : Max depth & Min Depth, the tool then handle an automatic depth spacing based on the total of layers. Something like that, maybe.

- A kind of "save setting" for each map, so we don't have to put all the value again when updating the map. Not sure if it's really doable, though ... XD

 

Anyway, it's still very handy as it is !


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users