Skip to content

ammarsufyan/Procedural-2D-Dungeon-Unity

Repository files navigation

Procedural 2D Dungeon in Unity

Using random walk and binary space partitioning to create a 2D procedural dungeon in Unity

How to:

  • Clone the repository
  • Open Unity
  • Go to assets -> import package -> custom package

image

  • Import the 00_StarterProjectAssets.unitypackage

Generators

  • Select the generator
  • RandomWalkDungeonGenerator -> Generate only random room without corridor
  • CorridorFirstDungeonGenerator -> Generate random room and corridor
  • RoomFirstDungeonGenerator -> Generate random room (random walk) and corridor using binary space partition

image

  • Edit the generator parameter (ex. RoomFirstDungeonGenerator)

image

Create a New Parameters (ex. BigDungeon, SmallDungeon, etc)

  • Right click Project in Data Folders -> Create -> PCG -> RandomWalkData

image

  • After the file created, you can change the file name

image

  • Finally, edit the parameters and select randomly each iteration to make a different start position

image

Tools:

  • Unity 2020.3.25f1 Personal License
  • Visual Studio or Visual Studio Code

Assets:

Results:

Random Walk Room:

image

Random Walk Room + Corridor:

image

Binary Space Partitioning:

image

Binary Space Partitioning + Random Walk (rooms):

image

Credit:

Thanks to Sunny Valley Studio (https://github.com/SunnyValleyStudio)

About

Using random walk and binary space partitioning to create a 2D procedural dungeon in Unity

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages