Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit/AppGameKit Studio Showcase / Wave Function Collapse for Tier 1

Author
Message
Kakise
AGK Tool Maker
7
Years of Service
User Offline
Joined: 25th May 2016
Location: Paris
Posted: 4th Jan 2019 00:08 Edited at: 9th Feb 2019 08:13
Hello everybody.

Last year, I came here to ask some questions about how to begin procedural content generation. And today, I am glad to telle you that I've come a long way and put together a really nice plugin for Tier 1: a Wave Function Collapse algorithm in Tier 1 !

In the beginning, I implented the algorithm in pure Tier 1 but I found that it was way too slow to be useable, and I wanted to use it to make, for example, dungeons for procedurally generated levels so it was not possible to have it in full Tier 1. Instead, I programmed a little plugin to speed up the generation process and I'm quite proud of the result !



Platforms:
Windows 64 bits (W7 and higher)
Windows 32 bits (W7 and higher)
Linux
Mac OS

Store Link/Avaliability:
I joined a demon version of the plugin (only overlapping generation) with full doc and an example. But if you want to buy the full, commercial version of the plugin, you will find it in the tgcstore: https://www.tgcstore.net/product/32303

How does it work?
There are 2 methods to generate something using Wave Function Collapse:
- Overlapping
- Tilemap generation

The overlapping method generates a png file that is locally similar to the input while the tilemap method generates a tilemap using tiles and tiles' constraints.

Examples:

Generating worlds:
->

This plugin is now avaliable on the store for the small price of 5.00$

If you want to try it out before buying, you can use the attached DEMO with a documentation. It only includes the overlapping algorithm though and can't be used for commercial projects.
PCG Lover
Using AppGameKit Tier 1&2

My creations:

[Tier 1 PLUGIN] Wave Function Collapse for Tier 1

Attachments

Login to view attachments
Kakise
AGK Tool Maker
7
Years of Service
User Offline
Joined: 25th May 2016
Location: Paris
Posted: 4th Jan 2019 14:04
Hello again !

I've put together a little working demo (Windows 64 bits) for you ! Just launch the file "WFC.exe" and enjoy.

Watch out: The generation process can be very long and depends on your CPU. On my computer, this program takes about 1.5Gb~2Gb of ram !

It is a demo of the overlaping function (it can be used to generate worlds, images, textures, ...), the tilemap method is far more appropriated to generate game levels but I still need to do some extensive testing before putting together a demo.
PCG Lover
Using AppGameKit Tier 1&2

Attachments

Login to view attachments
puzzler2018
User Banned
Posted: 4th Jan 2019 15:40
Nice work Kakise - well done...
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 5th Jan 2019 15:36
Quite nice stuff!

Quote: "In the beginning, I implented the algorithm in pure Tier 1 but I found that it was way too slow to be useable,"


What exactly made it too slow? The reading from an image? I did notice that looping through an array list that is looping through a map list with X and Y can get slow very quickly, but as long as you don't do that it can be very fast I think.
Kakise
AGK Tool Maker
7
Years of Service
User Offline
Joined: 25th May 2016
Location: Paris
Posted: 5th Jan 2019 17:23 Edited at: 5th Jan 2019 17:25
Quote: "What exactly made it too slow? "

It was mainly the generation part, I had to loop through the hole output memblock several times.

But in both the tier 1 and C++ implementations, the overlapping method takes way too long to be used to generate maps and stuff and should be restrained to the generation of icons, props, weapons, ...

I still have some work to finish the tile methode, I need to find a way to implement some easy to way to define tiles and tilemaps in tier 1 and pass them to the C++ plugin.
PCG Lover
Using AppGameKit Tier 1&2
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 6th Jan 2019 00:28 Edited at: 6th Jan 2019 00:29
Yeah I see what you mean. I'm working on some generation code myself and it is a bit difficult to keep things fast. The video below shows generation with a sync() and some sleep(10) code in the loops so I can see what it does. Otherwise it would obviously be much much faster:




I have yet to add all tile types I have for my game though.
Kakise
AGK Tool Maker
7
Years of Service
User Offline
Joined: 25th May 2016
Location: Paris
Posted: 6th Jan 2019 00:34
Hello everyone !

I have implemented a fully working Tiling Generation method. To be honest, because we can't use custom data types with plugins, I kinda had troubles to figure how to do it so I ended up inspiring myself on already existing method because I think the way they implement tilemaps is easy to understand.

Anyway, here are some nice results:


I am more and more thinking about packing it together with a pdf documentation and selling it on the tgc store. What do you think about it?
PCG Lover
Using AppGameKit Tier 1&2
Kakise
AGK Tool Maker
7
Years of Service
User Offline
Joined: 25th May 2016
Location: Paris
Posted: 6th Jan 2019 00:36
Haha you posted while I was writing @PHeMoX !

I really like the effect ! But yeah looping through arrays is reaaaally long in basic :/ And the lack of recursive functions makes it even worse imho ...
PCG Lover
Using AppGameKit Tier 1&2
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 6th Jan 2019 00:49
Yeah true, of course taking out any 'sync()' makes it pretty much instant, but the more complicated the loops, the slower it is for sure. I don't use loops within loops though, that would really slow things down too much.

Your results look interesting!
Kakise
AGK Tool Maker
7
Years of Service
User Offline
Joined: 25th May 2016
Location: Paris
Posted: 6th Jan 2019 01:04 Edited at: 6th Jan 2019 01:06
Aaaaand here's what is probably my last tech demo haha.

I attached it as a Win64 exe:



As you can see on the screenshot, it literally takes one line to have this result !

By the way the dll is 0.5mb so it doesn't take that much space.
PCG Lover
Using AppGameKit Tier 1&2

Attachments

Login to view attachments
PHeMoX
6
Years of Service
User Offline
Joined: 9th Jan 2018
Location:
Posted: 6th Jan 2019 23:05
That looks very impressive! nice job!
Kakise
AGK Tool Maker
7
Years of Service
User Offline
Joined: 25th May 2016
Location: Paris
Posted: 7th Jan 2019 21:30
I attached a demo version, on the first post, of the plugin with the overlapping function and I submitted it to the store, it is fully working and comes with a documentation on how to use it. If anyone wants to try it by himself, you can now !
PCG Lover
Using AppGameKit Tier 1&2
Kakise
AGK Tool Maker
7
Years of Service
User Offline
Joined: 25th May 2016
Location: Paris
Posted: 14th Jan 2019 21:11 Edited at: 15th Jan 2019 09:45
Update: I uploaded my plugin to the tgcstore, with a full demo and an example, it is really straightforward to use: here's the link : https://www.tgcstore.net/product/32303 enjoy !
PCG Lover
Using AppGameKit Tier 1&2

My creations:

[Tier 1 PLUGIN] Wave Function Collapse for Tier 1
lucastyler
5
Years of Service
User Offline
Joined: 29th Jan 2019
Location:
Posted: 29th Jan 2019 06:42 Edited at: 30th Jan 2019 08:26
That looks impressive. Nice work!
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 30th Jan 2019 11:35
Looks intresting ..
Could maybe be used in my mapper for pixelstein to speed things up?
Plot out rough rooms i touch up?
Kakise
AGK Tool Maker
7
Years of Service
User Offline
Joined: 25th May 2016
Location: Paris
Posted: 9th Feb 2019 08:13
Could maybe be used in my mapper for pixelstein to speed things up?
Plot out rough rooms i touch up?


Yeah that could work !

By the way, I've also updated the plugin, it is now faster than ever aaaand avaliable on Linux !
PCG Lover
Using AppGameKit Tier 1&2

My creations:

[Tier 1 PLUGIN] Wave Function Collapse for Tier 1
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Posted: 10th Feb 2019 18:06
i will try it as soon as everything calms down for me ..
Resourceful
10
Years of Service
User Offline
Joined: 29th Jan 2014
Location: every ware
Posted: 15th Feb 2019 00:34
@Kakise

I tride to run the 32 bit version it said the dll was missing
I moved the files to the location and still was told missing dll's
also I tried with the regular install of AGK2 and the Steam Version

I tried to run the 64 bit it sat there for more than 2 hours with nothing more showing that it running

I have asus g74sx gaming laptop with 8 gb ram
windows 7 home premium

any idea whats not working ?
Kakise
AGK Tool Maker
7
Years of Service
User Offline
Joined: 25th May 2016
Location: Paris
Posted: 17th Feb 2019 14:32
@Resourceful You can't use 64 bits with the demo, that's normal and explains why you have an infinite loading screen.
Make sure you have put the WFC_DEMO folder in its entirety in the Tier 1/Compiler/Plugins folder of your editor.
It is working fine on my windows computer so I don't know what's wrong
PCG Lover
Using AppGameKit Tier 1&2

My creations:

[Tier 1 PLUGIN] Wave Function Collapse for Tier 1

Login to post a reply

Server time is: 2024-03-29 00:33:51
Your offset time is: 2024-03-29 00:33:51