Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice
  2. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  3. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

AI Planner for level generation

Discussion in 'AI & Navigation Previews' started by PassivePicasso, Mar 6, 2020.

  1. PassivePicasso

    PassivePicasso

    Joined:
    Sep 17, 2012
    Posts:
    100
    I was considering using AI Planner to try to do some level generation, because I'm obsessed with level generation. However, once I got it installed and started to try to put together some concepts I realized I didn't really have a clue how to get started on this.

    This is an open question, how could such a problem be solved using AI Planner?
    Perhaps this is a really bad targeting for the tool but I wanted to explore the concept and I'm hoping someone has some ideas on how you could start down this path.
     
  2. Blueprinter

    Blueprinter

    Joined:
    Nov 28, 2019
    Posts:
    10
    That's a good question!
    I don't know if it's possible (I'm a beginner when it comes to this feature), but my first idea was to set up actions that add things to your level, based on randomized traits that describe how the level should be (e.g. how vertical it is, how many platforms it should have, the type of environment). Then you could have a maximum level budget that you would consume based on the cost of your actions.

    It sounds possible in theory, but I think you would kinda have to fight AI Planner's way of optimizing plans to make things more random.
     
  3. amirebrahimi_unity

    amirebrahimi_unity

    Joined:
    Aug 12, 2015
    Posts:
    400
    I think this would be a good future sample!

    Currently, one of our early adopters has used the planner for level generation, but interestingly enough by reversing the direction of the plan. So, the initial state is the goal state and all of the actions in the plan are options for how to deliver on that goal state. The key here is what you want to reward in your level generation or consider a cost. I don't know all of the details of the level generation setup, but hopefully that would give you something to try. Keep in mind that the planner is essentially trying to maximize reward (or minimize cost depending on how you look at it).

    Re: what @renanalmeidainsane suggested - the randomness would come for setting the parameters of your initial state. You wouldn't want to try and put randomness in the planner actions themselves. You could create a single trait for holding all of those parameters.
     
    PassivePicasso and Blueprinter like this.