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
@Stregoica777 is imagining a forest maze for a forthcoming quest, and I have been wondering about ways to add randomness to Threadbare to add a bit of spice/seasoning to our menu of challenges. Inspired by a talk by Jackie Codes at GodotFest 2025 I thought I would try making a forest using a TileMapLayer whose TileSet contains scenes that are composeable blocks of forest.
Here's a simple scene. It's 64×64 tiles in size, with the origin in the centre. It has a 2-tile-wide path at the north, east, south and west face. The forests are a StaticBody2D using an AreaFiller.
The idea is that we would make a few more of these, some of which only have exits on 2 or 3 edges; and then put them together to make a maze.
Here's a scene that contains a TileMapLayer whose TileSet has one scene collection source containing just this one scene. I placed 3×3 copies of the scene in it.
Initially I thought it seemed quite promising but then I looked at the joins. The y-sorting doesn't work correctly:
The scene tree for a simplified version with just 2 scene-tiles looks like this:
You might hope to just tick "Y Sort Enabled" on lots of things but no: you don't want the TileMapLayers in the child scenes to be y-sorted, only the trees.
I tried a little script that hoists nodes from the tile-scenes' OnTheGround node to the host scene's OnTheGround node, and this does work:
# SPDX-FileCopyrightText: The Threadbare Authors# SPDX-License-Identifier: MPL-2.0extendsNode@onreadyvartile_map_layer: TileMapLayer=$"../TileMapLayer"@onreadyvaron_the_ground: Node2D=$"../OnTheGround"func_ready() ->void:
# Child scenes are only added at the end of the current frame. Force an update now.tile_map_layer.update_internals()
# "Promote" all on-the-ground entities (which should be y-sorted) out from each# tile-scene to the host scene.fortile: Node2Dintile_map_layer.get_children():
varsub_ground:=tile.get_node(^"OnTheGround")
forchild: Node2Dinsub_ground.get_children():
varp:=child.global_positionsub_ground.remove_child(child)
on_the_ground.add_child(child)
child.global_position=ptile.remove_child(sub_ground)
The other thing I wanted to explore was whether you can rotate a scene-tile when placing it, and the answer is no:
This kind of makes sense because I wouldn't actually want to have the trees rotated 90°, and our tiles aren't rotationally symmetric, but still I was a bit disappointed because it would have meant that designing 1 tile would in fact give 16 options (4 rotations × horizontal flip × vertical flip).
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
@Stregoica777 is imagining a forest maze for a forthcoming quest, and I have been wondering about ways to add randomness to Threadbare to add a bit of spice/seasoning to our menu of challenges. Inspired by a talk by Jackie Codes at GodotFest 2025 I thought I would try making a forest using a TileMapLayer whose TileSet contains scenes that are composeable blocks of forest.
Here's a simple scene. It's 64×64 tiles in size, with the origin in the centre. It has a 2-tile-wide path at the north, east, south and west face. The forests are a StaticBody2D using an AreaFiller.
The idea is that we would make a few more of these, some of which only have exits on 2 or 3 edges; and then put them together to make a maze.
Here's a scene that contains a TileMapLayer whose TileSet has one scene collection source containing just this one scene. I placed 3×3 copies of the scene in it.
Initially I thought it seemed quite promising but then I looked at the joins. The y-sorting doesn't work correctly:
The scene tree for a simplified version with just 2 scene-tiles looks like this:
You might hope to just tick "Y Sort Enabled" on lots of things but no: you don't want the TileMapLayers in the child scenes to be y-sorted, only the trees.
I tried a little script that hoists nodes from the tile-scenes' OnTheGround node to the host scene's OnTheGround node, and this does work:
The other thing I wanted to explore was whether you can rotate a scene-tile when placing it, and the answer is no:
This kind of makes sense because I wouldn't actually want to have the trees rotated 90°, and our tiles aren't rotationally symmetric, but still I was a bit disappointed because it would have meant that designing 1 tile would in fact give 16 options (4 rotations × horizontal flip × vertical flip).
Beta Was this translation helpful? Give feedback.
All reactions