Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

registerWorldFormat for worlds with embedded tilemaps #4049

Open
swoolcock opened this issue Sep 6, 2024 · 4 comments
Open

registerWorldFormat for worlds with embedded tilemaps #4049

swoolcock opened this issue Sep 6, 2024 · 4 comments
Labels
feature It's a feature, not a bug.

Comments

@swoolcock
Copy link

I'm attempting to write a map import/export handler for a platform game that has rooms of arbitrary size that can be moved around. In Tiled this translates to a world with multiple tilemaps. Reading the Tiled documentation it doesn't look like worlds can have the tilemaps embedded.

The problem is that this game stores this data in one file per "world", and I can't see a way to write a registerWorldFormat that would then generate the world and all of its tilemaps in a single data structure (and be able to save that entire structure back to a single file).

It would be great if tilemaps could be embedded in the world data, and if you could then register a file handler instead of being restricted to .world JSON files.

Although I could just load the entire world into one great big tilemap, it loses the ability to define room sizes.

@swoolcock swoolcock added the feature It's a feature, not a bug. label Sep 6, 2024
@eishiya
Copy link
Contributor

eishiya commented Sep 6, 2024

I don't think it's necessary to refactor the way Worlds work in order to allow you to import/export files like this. Rather than a custom world format, you can write a pair of actions for importing/exporting a world in your desired format. The import would create multiple maps (potentially writing them to files if desired), while the export would take the current world's maps and write them to a file as you need.
This could be done as a custom map format as well, in which case you'll probably want to prompt the user which map(s) from the "world" you want to read/write (using the existing data for unmodified maps). It might be a little intuitive though, compared to actions that clearly deal with the entire "world".

@swoolcock
Copy link
Author

Yeah if possible I'd prefer to work using only the game's file format. Preferably the Tiled world/map formats would be completely invisible to the mapper.

@bjorn
Copy link
Member

bjorn commented Sep 10, 2024

Although I could just load the entire world into one great big tilemap, it loses the ability to define room sizes.

Are there multiple layers per room? If not you could derive the room size from the each layer's contents. Alternatively, you could place rectangle objects to mark the rooms.

I do think the suggested feature's would be nice to have, though I think it's quite an uncommon need.

@swoolcock
Copy link
Author

swoolcock commented Sep 10, 2024

Are there multiple layers per room?

Yes, there's two tile layers and two decal layers.

If not you could derive the room size from the each layer's contents

Unfortunately the game has the ability to store entities outside of the room boundaries, so it's possible for an entity to have coordinates in one room but actually belong to a neighbour room; it wouldn't get loaded until the player enters the room it belongs to.

It's probably going to be too difficult I think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature It's a feature, not a bug.
Projects
None yet
Development

No branches or pull requests

3 participants