Page 1 of 1

Made level generator with a Planner AI (GOAP)

Posted: 14 Nov 2016, 16:08
by Fietspomp
I Wanted to share a project ive been working off and on again for a while.

The idea I had was to use an Planner AI technique (GOAP) to construct video game levels. (I dream of automating most of the design department - those gits ;) )
GOAP - Goal Oriented Action Planning - is a system that takes a goal, a set of provided actions it can perform, and an algorithm(A*) that arranges the actions into a sequence that fullfills this goal. The action sequence is then executed and you get the following result:

Image



The system has the following nice properties:
- Guarantees logical buildup
Every action the system can perform has preconditions and effects.
All the preconditions will need to be met before an action can be executed.
In order meet the preconditions the system will execute actions with the corresponding effects.
Example: The goal is to create a platform with a goomba on it. We start with the action PlaceGoombaOnPlatform which has the precondition: Platform.
The system now looks for an action has the effect Platform. It finds the action PlacePlatform. PlacePlatform has the precondition: JumpPosition etc. etc.
We end up with the sequence: GetJumpPosition -> PlacePlatform -> PlaceGoombaOnPlatform

- Reusability
As the system is highly modular you can easily mix and match actions
GetJumpPosition -> PlacePlatform -> PlaceGoombaOnPlatform
GetJumpPosition -> PlaceMushroomPlatform -> PlaceCoinsOnPlatform
GetJumpPosition -> PlacePlatform -> PlaceCoinBlocksOnPlatform
etc

- Guarantees playability.
Now this is a bit of a bold claim. But because every object placed will go request a position from a dedicated position generating function
every object should be placed in a position that ensure mario will be able to get to the end of the level.

- Dynamic difficulty scaling
You can add preconditions and effects that depend on how many levels the player has already played. This way you can replace
actions that place goombas with actions that place Buzzy Beetles or redshells.



More results:
Image

Re: Made level generator with a Planner AI (GOAP)

Posted: 15 Nov 2016, 05:14
by alesan99
This looks fantastic! Great job
I'd like a playable demo sometime.

Re: Made level generator with a Planner AI (GOAP)

Posted: 15 Nov 2016, 05:16
by Technochips
that's amazing
btw you picked up the wrong cloud

Re: Made level generator with a Planner AI (GOAP)

Posted: 15 Nov 2016, 10:58
by Fietspomp
Julien12150 wrote:that's amazing
btw you picked up the wrong cloud
thanks :P
Ghah you are right. Im using the red ones for the night levels :P Didnt even notice.

Re: Made level generator with a Planner AI (GOAP)

Posted: 15 Nov 2016, 11:27
by Fietspomp
alesan99 wrote:This looks fantastic! Great job
I'd like a playable demo sometime.
Im not sure im going to continue on this. it has been quite annoying as I had to change the underlying Love2D engine in order to add the AI planner.
Also, I did not have a plan after the proof of concept.

Re: Made level generator with a Planner AI (GOAP)

Posted: 16 Nov 2016, 03:48
by MF064DD
Fietspomp wrote:
alesan99 wrote:This looks fantastic! Great job
I'd like a playable demo sometime.
Im not sure im going to continue on this. it has been quite annoying as I had to change the underlying Love2D engine in order to add the AI planner.
Also, I did not have a plan after the proof of concept.

This looks amazing dude. If you don't plan on finishing it, please at least give us what you have so far ^^ i mean if you dont want to thats fine

Re: Made level generator with a Planner AI (GOAP)

Posted: 16 Nov 2016, 20:22
by Fietspomp
MF064DD wrote:
Fietspomp wrote:
alesan99 wrote:This looks fantastic! Great job
I'd like a playable demo sometime.
Im not sure im going to continue on this. it has been quite annoying as I had to change the underlying Love2D engine in order to add the AI planner.
Also, I did not have a plan after the proof of concept.

This looks amazing dude. If you don't plan on finishing it, please at least give us what you have so far ^^ i mean if you dont want to thats fine
I havnt set up the project with the understanding I would ever share it with anyone. I think it will work on most windows machines with a bit of tweaking I think.
The project includes the whole of C++ Love2D though and adds up to a size of 700mb. (Though much of that might be unnessesary files)
Ill see this weekend if there is a way I could share this stuff.



I wanted to test another thing. Difficulty Scaling.
At level 3, goobas are no longer generated, and only beetles are placed.

Image

Re: Made level generator with a Planner AI (GOAP)

Posted: 16 Nov 2016, 23:08
by Qcode
Was writing parts in C++ over Lua a comfort thing? I'm curious as to what it was in specific that you were unable to write in Lua.

Re: Made level generator with a Planner AI (GOAP)

Posted: 16 Nov 2016, 23:44
by Fietspomp
Qcode wrote:Was writing parts in C++ over Lua a comfort thing? I'm curious as to what it was in specific that you were unable to write in Lua.
GOAP contains a Tree and an A* search system that plans the Actions required to fullfill the specified Goal.
Writing tree traversal and a A* stack system in Lua is not only difficult and silly, but also dangerous.

Difficult
Difficult because Lua has no real class system or non-default containers. Furthermore Lua has poor memory management.
Additionally, visual studio comes with many useful editor tools such as Visual Assist and Intellisense - Lua lacks any of these things

Dangerous
Dangerous because there is only limited debug support in Lua. Even if you hook up the visual studio debugger to the Mari0.exe you still have to wade through annoying lua boilerplate code to find any errors.

There are more things that are dangerous in Lua. It is loosely typed (But technically isnt)
Example:

Code: Select all

for y = 0, 10 do
  someArray[y/2] = 10
end
This code might not work in the Mario0 version of Lua. Any variable will become a float under the hood if a result cannot be expressed as whole number
I literally had to do this:

Code: Select all

for y = 0, 10 do
  someArray[math.floor(y/2)] = 10
end
^This piece of code should not exist.

Lua is Silly
Arrays start with 1... This is not only just retarded because it goes against 40 years of convention, it is also a hinderance as it causes various power of 2 related calculations to fail. It is a misunderstanding of what an array is. You do not access the third item when you do array[3]. What actually happens is that you start at the start of the list, and you move 3 steps to the right... ending at the 4th item.
Lastly... Global scope


:P That was good to get off my chest.

Re: Made level generator with a Planner AI (GOAP)

Posted: 17 Nov 2016, 18:04
by Technochips
remember that mari0 uses the LOVE framework

Re: Made level generator with a Planner AI (GOAP)

Posted: 03 Dec 2016, 05:27
by BrokenScreenPro3
Are you going to release a demo of it? I really want to test it out

Re: Made level generator with a Planner AI (GOAP)

Posted: 28 Sep 2021, 15:25
by CatLuigiGamer
Release this great project please

Re: Made level generator with a Planner AI (GOAP)

Posted: 28 Sep 2021, 19:53
by HugoBDesigner
CatLuigiGamer wrote:
28 Sep 2021, 15:25
Release this great project please
The author's last post was in 2016. I think it's pretty safe to assume this project is not gonna get released.

Re: Made level generator with a Planner AI (GOAP)

Posted: 28 Sep 2021, 20:03
by CatLuigiGamer
HugoBDesigner wrote:
28 Sep 2021, 19:53
CatLuigiGamer wrote:
28 Sep 2021, 15:25
Release this great project please
The author's last post was in 2016. I think it's pretty safe to assume this project is not gonna get released.
ok