Multiple tilesources in one tilemap?


two different tilesets


are being used on the same map

The utility of this I think is obvious, and this is the only way to make varied looking maps. I have around 100 tilesets and I’m making 20 areas. Each area relies on 10-15 different tilesets (sometimes shared, sometimes not).

Right now, to achieve this, I have to do either of those solutions, all of which are bad:

  1. One solution is to merge 10-15 tilesets into a single one for every area, which multiplies the amount of repetitive images the game would have. Consequently modifying areas and their tilesets is rendered much more difficult than it should be.

  2. Or I have to make sure I use a different layer for each tileset, then export them in a different tilemap one by one, which is extremely hacky (10-15 times 20 of doing hacky stuff). Or I have to make a script, which is not easy. Tiled is opensource, but extending it is quite difficult.

  3. Or I have to read .tmx and .tsx files in defold and create backgrounds at runtime, or make a small utility program that would read .tmx/.tsx, then automatically create tilesets and tilemaps and superimpose them in one collection, which is what I think I’ll end up doing, but I dread it.

The easiest solution would’ve been to simply allow multiple tilesources for a tilemap. Tiled has it. Defold should have it, what do you think, guys?

1 Like

Yes, that would be neat, but it would also mean that every time you switch from one tile source to another it would break render batching and result in a new draw call which could potentially mean a lot more draw calls for a complex map that mixes tiles from many tilesources. Allowing this from within Defold would introduce a source of really poor performance without our users knowing why.

Perhaps one tile source per layer would be more acceptable?

Or create a custom Tiled exporter that would spit out one tilemap per tilesource.

That, but spit it out in form of a collection that has those tilemaps already laid out correctly.

I was thinking of making a tool to do that based on Tiled’s JSON, because making a custom Tiled exporter seemed more difficult, however it could be more useful for the community, so I’ll give it a shot.

2 Likes

A tilesource per layer would be a huge improvement.

1 Like

Give this a try https://github.com/bjorn/tiled/pull/2084

1 Like

Woah, this is pretty nice! Thank your for sharing this!

1 Like