Log In  


I've been experimenting with wave function collapse a bit, got some basics working, and wanted to share the results.

Restart the cart or press X to run the map generation again.

The rules so far are hard-coded and unsophisticated. As of now, there are a number of rules defined about which tiles can border which, without regards to direction.

I'm still experimenting and planning to add more complex rules with the ability to handle lining up mixed color tiles properly. There's also an issue with top-left tile always being black, but haven't tracked that down yet.

I'm also working on a snowball game, so you can hit Z/circle to get a glimpse of that as well.

Cart #yipihahuf-0 | 2023-01-14 | Code ▽ | Embed ▽ | No License
1

1


I tried to add more rules to make a more impressive example, but found that I had a lot more bugs in the underlying code than I expected.

I went back, made some simple rules to highlight the underlying issues, and got everything working much better. Here's the result so far.

Cart #thtroyer_wfc_demo2-0 | 2023-01-21 | Code ▽ | Embed ▽ | No License

More to come later.


Alright, finally generating something closer to my original idea. Now that the underlying wave function collapse code is working, I put together a function that builds out the rules for it based on which map tiles fit together.

There's a lot of tiles so it's a bit slow.

Cart #thtroyer_wfc_demo2_1-0 | 2023-01-21 | Code ▽ | Embed ▽ | No License


1

Last one for now. Much faster.

This version is much more likely to generate maps with unresolvable sections (due to only propagating changes to immediate neighbors), but is significantly faster.

Cart #thtroyer_wfc_demo2_2-0 | 2023-01-21 | Code ▽ | Embed ▽ | No License
1


Very interesting work! I've been curious about WFC, but haven't the brain (or time) to tackle it yet. I'm happy to see it working for you! -- Jds

PS -- Love the snowball effect, but if I throw when running diagonal, it doesn't fly.



[Please log in to post a comment]