I'd like to create a large 2D dungeon map with a top-down view, where the tiles are procedurally drawn and positioned.
Nothing too complex: the tiles are simple polygons with solid colors and a darker border.

The AI (Chatgpt, Gemini, etc.) suggests me to use the TileMap node or the newer TileMapLayer.
This seems like the best choice for performance reasons and because it makes integrating pathfinding, physics, etc., easier.

However, I can't figure out how to do it procedurally.
TileMapLayer seems designed for manually placing tiles via the Godot editor, not for procedural generation.

Am I missing something? Any advice would be appreciated!

Note: I'm a beginner, I apologize if the question may seem stupid.

tilemap thing is a tool, you have to instruct the tool to procedurally generate your dungeons..

Again, its not as easy as calling .procedural_go() function... you have to have understanding how to set up the code to generate your desired level then use "procedural" function to make it more randomized..

also, insted of using retardation chatjeepeetee, i suggest you query youtube. it took me as long as to write the question, to get the answer to your problem


While it does not provide exact code, it gives you concepts on how to go on about this problem.

Thank you. I've seen that video. It covers the general logic for procedural dungeon creation that makes sense, but it's not what I'm looking for.
I need to know how to get TileMapLayer to place tiles at runtime using GDScript, rather than doing it manually in the editor

Use the set_cell function as outlined in the docs followed by _update_cells. Note that since you're creating the rooms at runtime you will have to put extra effort into controlling all the things the editor typically does for your tiles before the game has initialized (such as navigation).