Replies: 6 comments
-
That's for sure a good point, and could easily be achieve by looping through the layers and merge them until we reach a non tiledLayer. Only thing I would say against it, is that this is achievable today in Tiled, so why bother ? Now, that makes me think back about what I had in mind in terms of object management. Today Object Group is purely a view on Tiled side, and completely un-used if I can say on melonJS side. I don't know if it makes sense, and it's kind of a rough idea, but as an improvement we could really have a specific Object Layer (with a canvas of the size of the viewport, on which we would draw the entities). This will bring other small advantages like being able to add special effects to objects (like my previous attempt to color blending), ease with global viewport zooming, etc... |
Beta Was this translation helpful? Give feedback.
-
Does Tiled have a "bake" function that I'm unaware of? I know there's a separate script available for doing exactly this, because I went looking for such a thing when I was developing Neverwell Moor. https://github.com/falanxia/tileset_baker/wiki |
Beta Was this translation helpful? Give feedback.
-
yes, there is a "merge down layer" option available through the contextual menu. |
Beta Was this translation helpful? Give feedback.
-
Oh, yeah! It doesn't actually do what I need, though. It just replaces the tiles in the lower layer. A proper merge would actually draw the tile overtop, so the lower tile could still be seen where the upper tile had transparent pixels. That's what the tileset baker actually does (see the example images on the wiki page), and what I'm proposing for this ticket. |
Beta Was this translation helpful? Give feedback.
-
interestingly the next Tiled version will have a group layer features, which means that we now have a proper "standard" way to merge layers from the same group. |
Beta Was this translation helpful? Give feedback.
-
with #876 being done, this one should be one step easier to be done. |
Beta Was this translation helpful? Give feedback.
-
I can see this being a pretty big win for large maps with lots of layers. Most of the time, a map is entirely static... There might be a few parallax layers, and maybe an object layer sandwiched between two tile layers, etc. But there are cases where we could (and should!) merge static tile layers when pre-rendering is enabled.
One of the reasons for moving to the "dynamic rendering" method in 0.9.4 was to reduce memory cost. Pre-rendered layers have very high memory consumption with a large map, but memory usage is doubled when there are two layers in the map, and _quadrupled_ with four layers, etc. If we could determine at parse-time which layers can be merged into a single canvas, then we can benefit from the improved speed offered by the pre-render feature, as well as reducing the memory footprint AND overall drawing time.
Beta Was this translation helpful? Give feedback.
All reactions