Search Unity

Cellular Automata Procedural Level Generation

Discussion in 'Assets and Asset Store' started by DanielSnd, Nov 13, 2013.

  1. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382
    Hi there, I'm quite new here, have been using unity for a week and loving it so far. I wanted to make procedurally generated levels for my first game, but after searching a bit couldn't find a solution already made that pleased me. Found some scripts generating Square rooms with corridors between them, ( Like this tutorial and this tutorial ) but I was looking to do something more cave-like.

    So, I set on a quest to create my own. I started by following the logic on this roguebasin article implementing the suggestions of the article in the C# example they had there. Then used some pieces of wisdom from the other 2 tutorials I had found to do the spawning of objects and to fill the unconnected islands that escaped the creation logic.

    Now, I'm a hobbyist programmer, which means my code is probably way too messy for your taste, and there are also probably way better ways to do this than what I'm doing. But I wanted to share what I did to help the next newbie that comes like me looking for a solution like this.

    So, here is a webplayer of my result and the unity package:




    I've made it so it picks some spots around the map and places some premades there. That could be enemy spawners, decoration, goals, etc. It also picks 2 spots on corners for prefabs of the Player and a Door to next cave. It picks the door spot on the farthest corner it can find from the player. It also picks corners and spawn prefabs that could be treasures. You can choose how far apart those prefabs should be, so it won't spawn 2 enemy spawners too close to each other.

    It still has some rough edges and things I need to fix (and gets quite confused if you go too high on Wall Percentage), but it's working well enough for now :D

    Hope this helps someone somewhere, now back to working on the rest of the game :D can't wait to play my game on these levels.

     
    Last edited: Mar 17, 2016
  2. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    Importing. Thanks for sharing!
     
  3. MikeTon

    MikeTon

    Joined:
    Jan 10, 2013
    Posts:
    57
    Very cool work.
     
  4. capcaverna

    capcaverna

    Joined:
    Apr 27, 2013
    Posts:
    5
    ever a great soul. thanks for sharing. You are my teacher. hehehehe ;):D
     
  5. capcaverna

    capcaverna

    Joined:
    Apr 27, 2013
    Posts:
    5
    I think this is very usefull, to many games, like diablo 1, I remember the dungeon every change same you dungeon.
    I like this and learn more about this now. thanks.
     
  6. siba2893

    siba2893

    Joined:
    Apr 18, 2013
    Posts:
    10
    Hi Buddy I saw this is amazing, but the dropbox link for the Unity Package is broken is there a way you put it there again so I can check it because I loved your work.
     
  7. Kyle47

    Kyle47

    Joined:
    Mar 17, 2016
    Posts:
    1
    Hi, just seen this post and tried to download the Unity Package but the link no longer works, is there any chance you could fix the link because this would help me out greatly with a small project. Thanks.
     
  8. DanielSnd

    DanielSnd

    Joined:
    Sep 4, 2013
    Posts:
    382