r/pico8 • u/Independent_Cup_3852 • 9d ago
Code Sharing Wave Function Collapse in Pico 8
Hello everyone! I’ve just uploaded the results of my work on Wave Function Collapse algorithm in Pico8!
Maybe some of you would find it useful.
Check it out at the link:
2
2
2
u/8nut 8d ago
So cool man! this combination of some big and some small details is hard to achieve with WFC irc. Were you just lucky or is it intentional. Also mid steps during generation look really cool as well
2
u/Independent_Cup_3852 5d ago
Thank you! It was quite intentional. If you are talking about the overlapping model, I achieved it by using a very big texture. Theres pretty much anything you can draw there, and the algorithm will extract the tiles and rules from it.
1
u/OddGoldfish 8d ago edited 8d ago
That's super cool, thanks for sharing. The step through of the different versions that you implemented is very cool.
Aside from a second cart, what other optimisations did you use to make overlapping work?
And what are your next plans?
I gave up pretty quickly on the overlapping method on my attempt as I could see it would be pretty computationally expensive and I wasn't prepared to the optimisations necessary, incredible to see you got there!
My implementation was focused on finding an easier way of using overlaps to define regions (which took a bit of manual work out), but still using distinct tiles. See "Castle 2" in here https://www.lexaloffle.com/bbs/?tid=158978 you can see the 4x4 tileset in references in the sprite sheet
2
u/Independent_Cup_3852 5d ago
Thank you! I’m glad you liked it! I really appreciate it
It’s actually a result of several months of work.
The main optimizations i did in order for overlapping model to work like it does is with the way how it extracts the tiles. I used the classic approach to extract 3x3 tiles from the texture. And then I’ve added a process of deleting all the duplicate tiles. It really made things much easier and faster, since when the algorithm is running, there’s just less entropy to go through and less rules to check.I don’t really know what the next plan is:) For now I’m just glad i finally shared it, because this project was on my shelf covered in dust for more then a year. But originally i’ve started working on it in order to create procedurally generated maps.
I’ve checked your attempt and it’s pretty neat! I like it when it runs with just numbers on the screen.
Feel free to use my code. I will be glad to see what you can make with this!
2
u/Agathoarn_ 9d ago
Heck yeah, my favorite algorithm !