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. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  3. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

AI Planner for level generation

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

  1. PassivePicasso


    Sep 17, 2012
    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


    Nov 28, 2019
    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


    Aug 12, 2015
    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.