There are a lot of different ways of making procedurally generated terrains, but usually you use some kind of noise as a base for generating graphics.
For 2D, you could:
- Create tiles based on the noise map values, e.g. if noise > 0.5 then create ground, else create water
- Apply a shader directly to a noise texture to modify its color and look
- Probably the simplest is to use a noise as a heightmap for a subdivided plane
- Create meshes using marching cubes, surface nets, dual Contouring etc.
- Create cubes if noise value is above some threshold
There are lots of tutorials out there already, try searching "procedural terrain godot" on google/youtube.
Here's a couple:
Godot Procedural Generation with BIOMES tutorial part 1 - https://www.youtube.com/watch?v=zoE-mosUJ-I
HOW TO GODOT: Infinite procedural terrain generation - https://www.youtube.com/watch?v=rWeQ30h25Yg
Infinite Terrain in Godot 4 - The 'Wandering' Clipmap Terrain Technique (with LOD) - https://www.youtube.com/watch?v=rcsIMlet7Fw