Sorry if my English is not very good, I use google translation.
I think it is interesting to use layers with different sizes.
For example, for layers that loop and whose size does not need to be as large as the main layer.
Or on the contrary much more layers than the main layer (with a scroll faster) for the foreground.
What do you think?
Editing layers of different sizes was supported by the old Java version of Tiled, but so far I left it out of the Qt version since it was quite a confusing feature and not one that was commonly used. However, I do agree that in principle this is an interesting feature to support and the TMX map format in fact already does so. Tiled Qt should be able to edit and write back such maps fine but this was actually never tested.
So what is missing for this feature is most of all a visualization of the current layer boundaries, that would make clear where you can edit. And of course there needs to be a layer resize dialog.
Supporting repeating layers and parallax natively in Tiled would of course be nice as well.
It’s good that you found it interesting. I hope you have the opportunity to implement it.
Thank you very much for your work.
I found two workarounds that work reasonably well.
- Create multiple TMX. One for each layer that’s supposed to have a different size. For instance if the intention is to do parallax scrolling and you want smaller background layers, you put them in a separate TMX. However, depending on the TMX support it may be tricky (or ideally unnecessary) to merge the tilemaps together at runtime.
- Create the TMX file as large as the largest layer needs to be. Then just use less space on the other layers, ie fill a rectangular area from the top left or bottom left (whichever is more convenient for the engine to use) for as many tiles as the layer should be wide and high. Leave the other tiles empty. Downside is that most TMX readers will still reserve memory for the empty tiles, but if you use your own solution it shouldn’t be a big deal to cut off the excess area.
I find that #1 gives you more flexibility and fewer implementation issues. Since the layers are of different size anyway it’s not really needed to have them in the same TMX, ie you don’t need to see parts of the background layer in one of the corners of the map as it has no real relation to what you’re editing in the foreground layer.
The two solutions are having not really practical, rather it is a misery cache. It is too difficult to create a foreground layer or rear plan without seeing or will place the decor in the main plane.
For example, a large bush in the foreground could hide a bonus to recover but how stalling properly if you do not see in their entire layers.
It faudrais really have the opportunity to make SEVERAL different size layers and as for annimations of tiles can set the scroll speed.
thank you anyway for these tricks.
Yes, there are definitely cases where being able to see how things will actually look in the game is very useful. This is why I said earlier that supporting repeating layers and parallax would be nice. It’s just a matter of getting around to implementing it.
Those are the two use cases I had when I did a dummy space shooter with Tiled 3 months ago (used it to kick off my TMX parsing skills :)).
My parallax having the same size as the main foreground is a bit of a pain to calculate the difference to be apply (a part of the foreground layer has to be empty to represent what will never be seen… but we still need to make sure the scrolling part won’t allow to go there…
With 2 differents layers, we could automatically do the parallax. (Basically the scrolling speed is the ratio between the two layers…)
Same for autorepeat image… a black image with points representing the far far star as main background would be nice to be repeated without having to “hack” the TMX engine.
In a word: +1/+1 to those two features