How to Procedurally Generate Rooms in Godot's Tilemap

  • 🎬 Video
  • ℹ️ Published 2 years ago
preview_player
UCRs1QwQrxmgPpy604EEafWw

Just a video explaining how to procedurally generate rooms in Godot.

Code from the project right here:

If you have any ideas or questions, please comment them down below. I'll try my best to answer any questions.

For the Godot Icon used in the thumbnail: Original Author of the Godot Icon (Andrea Calabró), changes were made to this icon.

0:00 - Intro
0:40 - Setting up the scene
2:30 - Programming the tilemap
2:53 - Paint Explanation of the tilemap
4:03 - Back to programming the tilemap
6:35 - Making a box on the tilemap
9:00 - Placing the box on a random spot on the tilemap
11:01 - Making a bunch of maps
11:23 - Adding another tile
12:54 - Outro

💬 Comments
Author

A better approach for positioning the rooms is to generate the size of the room first, then randomly determine the (x, y) position within a range that accounts for the size of the room being spawned. This will get you big rooms that can be flush with the boundaries of the tilemap without causing small rooms near the edge to have large amounts of space between it and the boundary.

If we assume that the position of a room is in its top-left corner, then the range for its position would be (0, map_width - room_width) and (0, map_height - room_height). And you can still add a margin afterwards.

Author — Anase Skyrider

Author

Just came across your channel - great video, I really enjoyed it and like your teaching style. Looking forward to seeing more of your content.

Author — dirtymint

Author

Awesome stuff, can’t wait to see more

Author — Leonard Gassanov

Author

Awesome stuff, can’t wait to see more

Author — Bajista

Author

Can you create a tutorial how to convert multiple scenes into tile map resource. Such as a scene with collision, sprite, light2d and ysort working.

Author — Gilbert Cabigas Almazan

Author

Hai can you make tutorial on TileMap that can be drag when i play the godot and drag it around the screen

Author — szccornish