Dynamic levels using tiles or code

Godot Version

v4.2

Question

Hi All,

I’m new to Godot and trying to figure out my approach to a top-down level design. The requirements are as follows:

  1. Static ground (hand crafted, never changes)
  2. Info layer - mostly transparent “glowing” elements that appear on top of static ground tiles and aligned to the same grid. This has to be drawn based on the game state. (hand crafted, only visibility changes)
  3. Physics layer. Walls and doors that player can interact with and destroy. Tiles have to be re-drawn/deleted based on changing world state. Also aligned to the same grid. These will have transparency to reveal first layer below.
  4. Modifier layer - these elements have to modify the physics of 3. For example a lock on the door. I want to draw this on top with transparency, to reduce number of tiles I have to create.

The structure I have so far, which seems messy when coding, is as follows:
Node2D:level
->Node2D: visual layers
->->TileMap: Background (1)
->->TileMap: Info (2)
->Node2D: physical layers
->->TileMap: Physical(3)
->->TileMap: Modifier(4)

Problems:

  1. An issue is the tile updating. I used terrains to create initial level design, but if I destroy a tile during run time, surrounding tiles are not updated. Is there a way to update a TileMap to redraw terrains during run time? Or do I need to write a custom function for it?

  2. Minor issue is having so many separate tilemaps makes code very confusing and presumably inefficient. Currently I’m using set_cell an calling it for every TileMap. Is there a way to create multiple layers within a single tile map and redraw multiple layers with one function call.

I assume I’m missing something obvious, so any guidance is appreciated.