Dungeon Generator β Procedural Dungeon Creation System!
New versions coming out soooonnn :3
Hey if u like my Scripts, would not mind u joining my dc server to see what im up too! MaxRealm!/M.E
Model Link: Dungeon Generator
- Status -
This project is in V2. if u find bugs report it in Max Realm Studio - DC
NEW:
Added Zombies and Props spawning!
Overview
The Dungeon Generator is a robust procedural room-placement system designed to generate rogue-like dungeon layouts using prebuilt modular rooms. It performs collision-aware room placement, supports weighted randomness for room selection, and auto-furnishes placed rooms with decorative objects.
Ideal for dungeon crawlers, adventure games, and randomized level design.
Features
Infinite room generation until no spawn points remain
AABB-based overlap checking
Weighted room selection (via
NumberValue
object in template)Automatic Place Objects from pre-defined room slots
Clean modular code split across multiple scripts
Script Breakdown
DungeonGenerator.lua
Handles the entire generation logic:
- Scans for spawn points and overlap boxes
- Aligns rooms based on designated
SpawnPlacer
parts - Rejects overlapping placements
- Recursively processes new spawn points
- Outputs full log of generation process to output
DungeonGenerator:Generate(rootRoom)
RoomRegistry.lua
Provides a weighted random pool of room templates stored in ServerStorage.RoomTemplates
. To adjust room rarity, insert a NumberValue
named Weight
under the model.
{
Model = RoomTemplate,
Weight = 3, -- Higher means more likely
}
FurnIsh.lua
Auto-furnishes each room after placement. Looks inside a folder named Objects
in each room and replaces placeholder parts with real object clones from ServerStorage.Objects
.
Setup Instructions
Folder Structure
ServerStorage
βββ RoomTemplates
β βββ Room1 (Model) [has Weight NumberValue]
β βββ Room2 ...
βββ Objects
βββ Water (Normal Part)
βββ Chest (Model)
ReplicatedStorage / ServerScriptService
βββ DungeonGenerator (Folder/Module)
β βββ DungeonGenerator.lua
β βββ RoomRegistry.lua
β βββ FurnIsh.lua
Workspace
βββ StartRoom (room with RoomSpawnPoints)
Required Room Parts
Each room template must contain:
SpawnPlacer (red part): Determines alignment point for placement
RoomSpawnPoints: Parts named
"RoomSpawnPoint"
used as connection pointsOVERLAPBOXS folder: Holds parts used for collision detection
How to Use
- Place the StartRoom manually in
Workspace
with at least oneRoomSpawnPoint
. - Call:
local DungeonGenerator = require(path_to_DungeonGenerator)
DungeonGenerator:Generate(workspace.StartRoom)
- Watch as rooms are placed in real-time until all spawn paths are exhausted.
Notes
- Rooms missing
SpawnPlacer
will be skipped with a warning. - Overlapping rooms are auto-removed during placement.
- Room weighting can control generation flow and room rarity.
Feedback & Suggestions
Feel free to reply here with improvements or showcase your generated dungeons!
This system is modular and designed to be extended (e.g., biomes, room types, custom room validation).
Example Output (Console)
π οΈ Starting dungeon generation from: StartRoom
β€· Queued spawn point: StartRoom.RoomSpawnPoints.Part
π― Processing spawn point: StartRoom.RoomSpawnPoints.Part
π Trying template 'RoomA' (weight=2.00), 5 left in pool
β
Placed room: RoomA
β New spawn point queued: RoomA.RoomSpawnPoints.Part1
...
π Dungeon generation complete. No more spawn points.
Example Video & Place
Is this help full?
- Yes
- No
- Needs some work