Monday 25 January 2016

Random 2D room generator

This is a small project I developed in Unity, the popular game engine.

It's a C# script I wrote that generates random rooms in a 2D environment.

this is what the script looks like in the inspector:


It generates the number of room required (if there's enough "room"). It will also create corridors to allow full navigation of the generated map.

By tweaking the parameters we can generate different sizes and general shapes of rooms.


Here are some screenshots of some of the maps generated:








If you are interested in the code, leave a message, I will be happy to provide it. 



4 comments:

  1. Paolo, I know this is a bit of an old post, but I'd love to see the code for the random room generator.

    ReplyDelete
    Replies
    1. Hi Chris, not a problem. I will need to go dig out the project, I will send you a link to a downloadable file once I get it.

      Delete
    2. Hi Chris, please follow this link to download the full project folder ->

      https://github.com/Paolo86/UnityRoomGenerator

      You should be able to open it with the latest version of Unity (checked with 5.6.1).

      Let me know if you have any questions.

      Delete
  2. Hey, Paolo!
    This is quite good. I am trying my hands on Unity AR/VR Development. Thanks for sharing this.

    ReplyDelete