My game allows creating dynamic maps, which means there’s a root node called “maps” and individual maps below them.
those individual maps have their own tilelayers and, inside those tilelayers the enemies of each map will spawn
Does Y-SORT work here in this configuration? I did some tests but it seems the characters are not being sorted evenly, making the players defined in a map below to display above every other
I tried to set “y sort enabled” in the global map which includes all the maps. And in the characters. But it won’t work.
I’ve defined the origin of every sprite in the “foot” level. I’m not sure if I should adjust the Offset instead of defining the origin
Did you make sure Y-Sort is enabled on everything?
Also, are they centered the same way in each setting (i.e., is (0,0) the same place for each node-center of sprite, top left of sprite, etc.)?
Shall all nodes in the hierarchy be set with y-sort? that would complicate things in my case since most of my objects have nodes that do not have space (the root) and then have their “render” part which is a node2D or similar.
The documentation of y-sort says that, in order to be able to set freely the hierarchy that you want, you just need to set ysort in the root node
With Y-sorting enabled on a parent node (‘A’) but disabled on a child node (‘B’), the child node (‘B’) is sorted but its children (‘C1’, ‘C2’, etc.) render together on the same Y position as the child node (‘B’). This allows you to organize the render order of a scene without changing the scene tree.
You have scenes for the server, room, spawners, player and moblins but not the for Map?
I have scenes for the map, yes. They’re just not defined in this example because I don’t need to in these tests that I’m doing. Maps are generated and stacked at runtime.
A map in my game is a portion. It could be a dungeon, a forest etc. Then, maps would generate and stack using procedural generation. Since this is an online game I cannot unload maps. But loading/unloading or having multiple maps in memory is not relevant to y-sort issue, since a map, after all, is just a scene, like a tileset, or a dungeon, or even the players. The issue is more related on y-sort over complex hierarchy.
In my game I need to have a forest with their own mobs and a dungeon with their own mobs. If no player is around one area, the map will despawn and generate another one once someone enteres again. So all the instances inside will be removed/despawned too. This means that y-sort calculation between all the areas (and the player root node) should coexist and work with the same rules.