mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
11.01k stars 1.74k forks source link

GameMaker Studio 2 support #1642

Closed bjorn closed 3 years ago

bjorn commented 7 years ago

Currently Tiled ships with an export plugin for GameMaker: Studio 1.4. With GameMaker Studio 2, YoYo Games has changed the map format entirely. It is now JSON based instead of XML and the tile layer data is saved in a very similar fashion as Tiled JSON maps.

Even though GameMaker Studio 2 ships with quite a decent tile map editor, it would still be interesting to add support for this new version as well. It would be helpful for those already using Tiled that are porting their game to the newer version, as well as for people who have reason to prefer Tiled for making their maps.

Requested in this forum post and this forum post.

mccordgh commented 6 years ago

Bump! Any plans for GMS 2 support in the works at all ??

bjorn commented 6 years ago

@mccordgh It's definitely in the plans (embodied by this issue), but I can't say when I would get around to it. There's a lot of other high-priority stuff I need to get around to first.

mccordgh commented 6 years ago

@bjorn Anyway I could help? :)

bjorn commented 6 years ago

@mccordgh Sure, you can either fund it or code it. I'm here for questions if you need any help to get started with implementing this. You can read this page about how to get started compiling Tiled yourself, and you could start the GameMaker Studio 2 plugin by copying the GameMaker: Studio 1.4 plugin that lives in src/plugins/gmx (probably to src/plugins/gms2).

The old format was XML-based, so the plugin used QXmlStreamWriter. The new format is JSON-based and you could probably use QJsonDocument to construct the contents. Unless the limited formatting options are a problem, in which case we could adapt the LuaTableWriter from the Lua plugin to be able to write JSON files.

mccordgh commented 6 years ago

@bjorn Thanks for that info, I would love to contribute if I can.

mccordgh commented 6 years ago

I am not going to be able to work on this right now, as my attention is needed elsewhere. Just wanted to let you know. Sorry!

Dene33 commented 6 years ago

Any progress on this? :(

bjorn commented 6 years ago

@Dene33 No. Maybe you'd be interested in helping out with this?

bjorn commented 6 years ago

While this export option is not available yet, people who want to export Tiled maps to GMS 2 can give GMTiled a try.

PoppyWorks commented 5 years ago

Would love to have this feature!

meseta commented 5 years ago

In case this helps, I made a runtime loader for TMX projects for GMS2: GMTiled2

olivermarshall2 commented 4 years ago

Would love to see this as well.

tibisoft007 commented 4 years ago

Hello, can we expect some update regarding this topic? Thanks.

bjorn commented 3 years ago

If the above linked GMTiled or GMTiled2 don't work, there's another potential tool for moving data between Tiled and GMS2 available here: https://leo150250.gitlab.io/tiledtostudio2/.

bjorn commented 3 years ago

I've started to work on a GMS 2 export plugin! The progress can be followed at the pull request #2979. The latest successful builds with this addition can be found at:

https://github.com/mapeditor/tiled/actions?query=branch%3Awip%2Fyy-plugin+event%3Apull_request+workflow%3A%22Build+Packages%22

Since I currently don't have a GMS 2 license I'll need to rely on others to test the result. Please help with testing if you can. The pull request #2979 has a checklist of things done and an incomplete list of stuff still to be done. Please provide any feedback at the pull request.

I'm currently a little undecided whether to try to finish up this plugin before the Tiled 1.5 release or whether to let this be one of the new features in Tiled 1.6. While it would be nice to still include it, reasons to skip 1.5 would be to not delay 1.5 further, to not rush this plugin and possibly to ship in 1.6 along with another feature I'd like to add, which would be project-wide export options.

bjorn commented 3 years ago

Since I currently don't have a GMS 2 license...

Well, what can I say. Today I was contacted by YoYo Games and they've provided me with a permanent GMS 2 license to help me with developing this export plugin! Thanks a lot, @YoyoGames! 🎉

I've spent today making various small improvements to the plugin, many based on the valuable feedback from @TrunXGIT. I've also committed to ship at least a basic functional version in Tiled 1.5.

meseta commented 3 years ago

You may not know this, but we discuss and recommend Tiled a fair amount on the Gamemaker discord server (a group run by users), I'd previously worked on GMTiled2, while Gabe (the person who eventually got in touch with YYG for you) worked on the original GMTiled. We're a small but close community. So when @TrunXGIT posted a link to the issue on the discord, we had a quick discussion about how we could help make this happen for you, and thanks to the kind folks at YYG, it seems like we he arrived at a great outcome!

Discord chat

On behalf of GMS2 users, thanks for your hard work on Tiled!

HeadClot commented 3 years ago

Super happy this is coming online for Tiled 1.5. Thank you so much :)

bjorn commented 3 years ago

I had originally estimated that it would take 2 full days to write this export feature, but in the end it took me 7 days and still left some improvements open for later (like exporting of paths and better handling of creation codes). Of course, that just shows how hard it is to estimate a programming task - or just how bad I'm still at it after all these years...

The export is otherwise pretty full-featured, turning a Tiled tile layer into multiple GMS2 tile layers (one for each used tileset), or falling back to a GMS2 asset layer when features are used that aren't supported by the GMS2 tile layer (like an image collection tileset, tiles with a different size than the grid size or non-orthogonal orientations).

In general, it works pretty similar to the existing GM:S 1.4 export, where objects are exported as view (when their Type is set to "view"), instance (for any other type) or graphic (tile objects without type). Also, almost all properties can be set using custom properties, using generally the same name (and type) as used in the .yy file.

When a background color is specified for the map, a background layer with this color is created.

As soon as the new export plugin is documented I'll push a new development snapshot and allow for a few days to give feedback before making the Tiled 1.5 release. Those who want to try the plugin now already can use the artifacts from last successful build of the master branch.