how to make a procedural tile generation 2d side view

Godot Version

v4.5.1.stable.official [f62fdbde1]

Question

How can I make a 2D side-view world generator in Godot, like Terraria, using a TileMapLayer?

I want the world to build itself as the player moves, so it keeps going forever. The world should follow some rules, not just random blocks.

Here’s what I want it to do:

  • Terrain: Use noise to make smooth hills for the ground. Under the surface should be dirt and stone tiles.

  • Caves: Use noise again to make caves inside the ground. I want to control how many caves appear.

  • Trees and Ores: Trees should grow on the surface. Ores should appear in the stone at different depths.

  • Chunks: The world should be made of chunks (like 16×128 tiles). Chunks near the player load in, and far ones unload.

  • TileMapLayer: All blocks should be made inside a TileMapLayer for better performance and collision.

I want to understand how to plan this step by step — how to use noise, how to build chunks, and how to make the rules for tiles.

What is the best way to design this kind of system in Godot?

Aren’t there tutorials for this out there?