You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
General 2D games, though I have a focus on puzzle or casual games which rely heavily on tilemaps.
Describe the problem or limitation you are having in your project
The terrain system in 4.0 is a replacement for the autotiling system in 3.x. Whilst it is designed to be more powerful and usable, it has a number of issues and behaviors that impact its usability. It also regresses on a number of features from autotiling.
Editing terrains affects neighboring tiles in unexpected ways, often altering their type.
odd-tile-behavior.mp4odd-tile-behavior-2.mp4
Terrain sets do not play nicely at all.
terrain-sets-dont-mix.mp4
No substitute for _is_tile_bound in 3.x. No way to make different types of terrain interact like you could in 3.x with autotiling.
joining-tiles.mp4
Results depend on painting order.
order-dependent-painting.mp4
There are other similar behaviors, but hopefully you get the idea.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
There are four key changes which I believe will both improve the usability of the terrain system, and push it beyond what 3.x could do:
Tidy up some curious API (such as the removal of the ignore_empty_terrains flag)
Whilst each has a justification, the overall goal would be to reduce the complexity of the terrain matching algorithm, whilst also increasing its flexibility and stability of behavior. There are two key ideas here: solidifying the data-centric design of tilemaps, and linearizing the constraint satisfaction problem.
Enforcing that each terrain tile is correlated with a terrain type gives fixed constraints for fitting terrains. This is also generally good for the user, as the terrain types they place are invariant. If a user places a ‘water’ tile, for example, that should be adhered to by the engine, and not changed to a better fitting tile of a different terrain type at a later time. Any game with precision design is going to have that requirement (e.g. platform games).
Grouping terrains into terrain sets, as a feature, adds some complexity and constraint to the user, but terrain sets don’t really seem to offer any specific advantage. I understand that they are there to limit/define terrain interactions, but seeing as no such restriction existed with Godot 3’s autotiles, it feels like the terrain sets are only there because a similar feature exists in other editors such as Tiled.
Multiple peering bits to allow generalized connections between tiles will linearize the constraint satisfaction problem that occurs when trying to pick tiles for terrains. It would allow individual cells of the tilemap to select terrain tiles without needing to propagate constraints to their neighbors, nor care about how their neighbors connect to them (if at all). That way, tiles can be picked in any order, via a simple search of the possible options, and will behave consistently.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
When a tile needs to connect to its neighbors, it looks at all the tiles matching its current tile’s terrain type. For each tile, it checks the peering bit arrays against the neighboring tile terrain types. These are graded and the tiles that gets the best score is placed.
I have taken some time to mock up how this would appear:
These were calculated using the following scores for peering bit (arrays) for connections to neighbors:
Peering matches and neighbor is a different type: +5
Peering matches and neighbor is the same type: +3
No peering (array is empty): +1
Peering does not match neighbor: -5
If this enhancement will not be used often, can it be worked around with a few lines of script?
The terrain system will be used in a significant amount of 2D games, both in terms of editing and designing levels, and in playing them too. It will be used very often.
Is there a reason why this should be core and not an add-on in the asset library?
The terrain system itself is a vital feature. For example, here is a user requesting that they want to make a layout in a similar (but simpler) way to the incredibly popular game Celeste: #4689 (comment) Godot should be able to do such a common and popular design out of the box.
Describe the project you are working on
General 2D games, though I have a focus on puzzle or casual games which rely heavily on tilemaps.
Describe the problem or limitation you are having in your project
The terrain system in 4.0 is a replacement for the autotiling system in 3.x. Whilst it is designed to be more powerful and usable, it has a number of issues and behaviors that impact its usability. It also regresses on a number of features from autotiling.
Editing terrains affects neighboring tiles in unexpected ways, often altering their type.
odd-tile-behavior.mp4
odd-tile-behavior-2.mp4
Terrain sets do not play nicely at all.
terrain-sets-dont-mix.mp4
No substitute for
_is_tile_boundin 3.x. No way to make different types of terrain interact like you could in 3.x with autotiling.joining-tiles.mp4
Results depend on painting order.
order-dependent-painting.mp4
There are other similar behaviors, but hopefully you get the idea.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
There are four key changes which I believe will both improve the usability of the terrain system, and push it beyond what 3.x could do:
ignore_empty_terrainsflag)Whilst each has a justification, the overall goal would be to reduce the complexity of the terrain matching algorithm, whilst also increasing its flexibility and stability of behavior. There are two key ideas here: solidifying the data-centric design of tilemaps, and linearizing the constraint satisfaction problem.
Enforcing that each terrain tile is correlated with a terrain type gives fixed constraints for fitting terrains. This is also generally good for the user, as the terrain types they place are invariant. If a user places a ‘water’ tile, for example, that should be adhered to by the engine, and not changed to a better fitting tile of a different terrain type at a later time. Any game with precision design is going to have that requirement (e.g. platform games).
Grouping terrains into terrain sets, as a feature, adds some complexity and constraint to the user, but terrain sets don’t really seem to offer any specific advantage. I understand that they are there to limit/define terrain interactions, but seeing as no such restriction existed with Godot 3’s autotiles, it feels like the terrain sets are only there because a similar feature exists in other editors such as Tiled.
Multiple peering bits to allow generalized connections between tiles will linearize the constraint satisfaction problem that occurs when trying to pick tiles for terrains. It would allow individual cells of the tilemap to select terrain tiles without needing to propagate constraints to their neighbors, nor care about how their neighbors connect to them (if at all). That way, tiles can be picked in any order, via a simple search of the possible options, and will behave consistently.
Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
When a tile needs to connect to its neighbors, it looks at all the tiles matching its current tile’s terrain type. For each tile, it checks the peering bit arrays against the neighboring tile terrain types. These are graded and the tiles that gets the best score is placed.
I have taken some time to mock up how this would appear:
masked-tile-connections.mp4
masked-tile-corner-connections.mp4
These were calculated using the following scores for peering bit (arrays) for connections to neighbors:
If this enhancement will not be used often, can it be worked around with a few lines of script?
The terrain system will be used in a significant amount of 2D games, both in terms of editing and designing levels, and in playing them too. It will be used very often.
Is there a reason why this should be core and not an add-on in the asset library?
The terrain system itself is a vital feature. For example, here is a user requesting that they want to make a layout in a similar (but simpler) way to the incredibly popular game Celeste: #4689 (comment) Godot should be able to do such a common and popular design out of the box.