How to create a dungeon generation for a 2D platformer?

Godot Version

4.3

Question

How to create dungeon generation for a 2D platformer?
Required:
There should be a room in which spawn player.
All rooms are already stocked, so the generation must be from them.
Doors are a separate scene, so you need to make them appear in a certain place in the room.
It is necessary that the rooms are generated infinitely, but we need to make it so that the rooms are generated as the player advances, that is, there is a certain zone around the player and if the room does not fall into this zone, the room disappears well and vice versa. You can organize it in any other way.

So, are you saying you already have the rooms designed you just want to randomly place them?

I have an idea how I’d go about that, though not sure if it is the best way, unfortunately, I’m going to bed so can’t fully explain.

The loading and deloading you can use a system like chunking, where you’d check distance to rooms in possibly a dict, and then free them once they are a certain distance.