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. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    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


    Unity Technologies

    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.