Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Procedural Forest Generation

Discussion in 'Scripting' started by brizzelsprout, Mar 27, 2015.

  1. brizzelsprout

    brizzelsprout

    Joined:
    Mar 26, 2015
    Posts:
    7
    So I'm working on a simple mobile game where you are a bird flying through a forest and avoiding obstacles.

    I'm looking for opinions on methods used for random level generation. I'm not looking for randomly generating the trees themselves. I have a number of assets that we have created. I just want to randomize the layout of each level. I've been looking into using perlin noise, mass-spring scattering, pseudo particle systems, inhibit zones, ect... but i'm to the point where I've found too many options and can't decide on what direction would be best direction to take.

    This is for mobile so I want to find something that is efficient but still allows for acceptable level of variation. I also want to keep load times down as low as possible.

    So, what is your favorite method and why?
     
  2. GroZZleR

    GroZZleR

    Joined:
    Feb 1, 2015
    Posts:
    3,201
    What type of game is it? Is it an endless runner type game where you're moving constantly and you just need to place obstacles in front of the player?
     
  3. brizzelsprout

    brizzelsprout

    Joined:
    Mar 26, 2015
    Posts:
    7
    It's not an endless running. Each level should have a beginning and end to get to (You are trying to find your nest). I want to scale difficulty every time you pass a level.
     
  4. MikeUpchat

    MikeUpchat

    Joined:
    Sep 24, 2010
    Posts:
    1,055
    I am using MegaScatter for my game, it gives you tons of scattering options, define areas with splines or color textures, multiple layers of objects, but the main reason I got it was because it can do scattering at runtime so you set it up as you want and then set the runtime scatter option then build the game, that means much reduced load times and app memory size, and you can adjust the scatter amount per platform and so on.
     
  5. brizzelsprout

    brizzelsprout

    Joined:
    Mar 26, 2015
    Posts:
    7
    Cool, I'll keep that in mind. I am trying to stay away from tools that will do it for me because I'm interested in learning about how the algorithms/systems are built. I will keep MegaScatter in mind though. I have another project in the works that may lend itself to using it.
     
  6. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    8,999
    Could have like 10-30 pre-defined "patches" of trees, and then place those groups randomly in grid positions..
    (to avoid having un-passable locations from totally randomly placed trees)

    Some patches could be easier and some more difficult to pass, then can increase difficulty that way..
     
  7. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Can you draw us a picture of what your level design might look like if it were crafted by hand? Just something in paint will do. You can use very different techniques depending on what you are actually trying to build. For example you wouldn't use Perlin for a maze.
     
  8. brizzelsprout

    brizzelsprout

    Joined:
    Mar 26, 2015
    Posts:
    7
    This is a simple mock up using the assets we have finished so far.
    The area between the barn and the start is what I want to generate.


    I've also been thinking about using the built in terrain system instead of just normal objects.
     
    Last edited: Mar 28, 2015