Made level generator with a Planner AI (GOAP)

General Mar0 discussion has been moved to this subforum!
Post Reply
Fietspomp
Posts: 5
Joined: 14 Nov 2016, 15:27

Post » 14 Nov 2016, 16:08

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

User avatar
alesan99
Posts: 2335
Joined: 30 May 2013, 21:42
Contact:

Post » 15 Nov 2016, 05:14

This looks fantastic! Great job
I'd like a playable demo sometime.

User avatar
Technochips
Posts: 608
Joined: 12 Mar 2015, 16:05
Contact:

Post » 15 Nov 2016, 05:16

that's amazing
btw you picked up the wrong cloud

Fietspomp
Posts: 5
Joined: 14 Nov 2016, 15:27

Post » 15 Nov 2016, 10:58

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.

Fietspomp
Posts: 5
Joined: 14 Nov 2016, 15:27

Post » 15 Nov 2016, 11:27

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.

MF064DD
Posts: 719
Joined: 20 May 2014, 00:08

Post » 16 Nov 2016, 03:48

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

Fietspomp
Posts: 5
Joined: 14 Nov 2016, 15:27

Post » 16 Nov 2016, 20:22

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

User avatar
Qcode
Posts: 1479
Joined: 05 Feb 2012, 18:00
Contact:

Post » 16 Nov 2016, 23:08

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.

Fietspomp
Posts: 5
Joined: 14 Nov 2016, 15:27

Post » 16 Nov 2016, 23:44

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.

User avatar
Technochips
Posts: 608
Joined: 12 Mar 2015, 16:05
Contact:

Post » 17 Nov 2016, 18:04

remember that mari0 uses the LOVE framework

BrokenScreenPro3
Posts: 6
Joined: 03 Dec 2016, 05:22
Contact:

Post » 03 Dec 2016, 05:27

Are you going to release a demo of it? I really want to test it out

User avatar
CatLuigiGamer
Posts: 47
Joined: 22 Sep 2021, 15:54

Post » 28 Sep 2021, 15:25

Release this great project please

User avatar
HugoBDesigner
Posts: 2188
Joined: 19 Sep 2012, 02:23
Contact:

Post » 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.

User avatar
CatLuigiGamer
Posts: 47
Joined: 22 Sep 2021, 15:54

Post » 28 Sep 2021, 20:03

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

Post Reply