deepnight / ldtk

Modern, lightweight and efficient 2D level editor
https://ldtk.io
MIT License
3.45k stars 192 forks source link

Creating an export from LDtk to Gamemaker Studio 2 rooms #646

Open Ailwuful opened 2 years ago

Ailwuful commented 2 years ago

This is a request to make an export option from LDtk to create room files that can directly be used in Gamemaker. The room.yy files from Gamemaker are already a JSON file, and it should be fairly simple to make an export for it. Here’s a link for the room file from Gamemaker for you to check out. It’s a pretty small file, it has only an Instance, Tile and Background layer. And the room is 4x4 tiles.

And here's a link to a document of me trying to explain to my best ability how you can create the room file.

I'll love it if you can do this.

Cammin commented 2 years ago

I wonder if YoYo games made some documentation on creating GMS rooms via JSON? It would certainly be cool if there's an official resource on that 🙂

Ailwuful commented 2 years ago

There doesn't seem to be. I could put a request for a documentation topic from the website. But the room file is pretty straightforward. There may be a lot of fields for customization that Gamemaker has but a lot of it doesn't get generally used. They can just stay as default values. If any questions arise from what certain variables are, I should be able to answer.

FaultyFunctions commented 2 years ago

Tiled does this so if this feature is considered, that might be a good place to get some information from as well. Here is their docs page on the export: https://doc.mapeditor.org/en/latest/manual/export-yy/

The room files are decently straight-forward, but I'm sure if you run into any snags, you'd be able to contact the creator of Tiled as well.

deepnight commented 2 years ago

Thanks for these info :) The Tiled author was super helpful and nice every time I had the occasion to chat with him, so I won't hesitate to get in touch if I have any issue with the yy format.

deepnight commented 2 years ago

I started working on something, but I would need more examples to reverse-engineer the format.

I especially need something like that:

I would need all the .yy files from such project :)

Side question: is there any equivalent of the IntGrid layers in GMS?

Ailwuful commented 2 years ago

Hi. This makes me very excited! I did link a download to a room file. I just noticed I can drag the file here, though. I'll do that. I'm putting a lot of files, including a pdf to the document I wrote in case you prefer it. Gamemaker files.zip

There's no equivalent to an IntGrid layer in GMS. If someone wanted to use the IntGrid in their game they would have to code something to use it. Personally I did something similar but by just reading the first layer of tiles, I always delete the IntGrid values layer since it has no use to me. Regardless, I don't think anyone expects an IntGrid layer to come along the export, but I can see how it could be useful to some people.

Let me know if you need any help.

HeadClot commented 2 years ago

I am very excited about this feature. Is this already in the beta or no?

deepnight commented 2 years ago

I am very excited about this feature. Is this already in the beta or no?

Not at all, available for now :) This will require quite a lot of work, so I can't give any estimate for now unfortunately.

HeadClot commented 2 years ago

I am very excited about this feature. Is this already in the beta or no?

Not at all, available for now :) This will require quite a lot of work, so I can't give any estimate for now unfortunately.

No problem! Take your time then :)

Gamer-XP commented 8 months ago

Just adding a note here for anyone who stumble upon this: https://github.com/Gamer-XP/LDTK2GMS2Pipeline I've written an external tool that allows to convert data back-forth between GM and LDTK. You can try using it if you need.