Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: Simple Wave Function Collapse (github.com/victorqribeiro)
43 points by atum47 39 days ago | hide | past | favorite | 27 comments

Big confusion time on the algorithm name, like many other I was also coming in expecting this to be some sort of visualization of the concept of wave function collapse from quantum physics: https://en.wikipedia.org/wiki/Wave_function_collapse

This is referring to a Procedural Generation algorithm named the Wave Function Collapse algorithm: https://github.com/mxgmn/WaveFunctionCollapse

Oh, thanks. I clicked on that and saw a patch of grass and some water and was wondering what the heck that had to do with wave function collapse (in the quantum physics sense). Kind of waited to see if there was some animation, maybe some particles would hit the grass or water or something... but it was static.

Is this related to how generative neural networks work?

Not really

Hi everyone, I finally got around to implement my version on the wave function collapse algorithm. WFC uses rules to define what tiles can be placed around each other. In order to achieve this rules, I wrote I simple tool that helped me to visualize every tile and all the tiles that can be placed around it (top, right, bottom and left sides). My code is very simple, I haven't looked at the original WFC code at all, I just "learned" the concepts.

So, first I place a random tile at a random position, from that I grow the map chosing the neighbor with the lowest entropy (smallest number of possible tiles).

Hope you like it.

May I suggest that you add this comment, and perhaps also some of the links that have been given in these comments, to the readme? Apparently I am not the only person for whom 'wave function collapse' means we're talking about quantum mechanics.

I'm going to guess that at least 80% of us were thinking quantum physics when we read "wave function collapse".

Definitely feeling the same, sorry about the confusion

For sure, I'll do that. Sorry about the confusion

Man I hate that name. It's a Markov chain where the input is the neighbors to the tile being generated. "Wave function collapse" makes it sound like there's something much more complicated going on.

I think the name is the main reason it's gotten as much attention as it has. It's really a basic technique and idea but I'm seeing people all over the place overhype it.

A great explanation of Wave Function Collapse: https://www.youtube.com/watch?v=2SuvO4Gi7uY

So, about the name, the first time I've heard about WFC was when this post was released https://github.com/mxgmn/WaveFunctionCollapse

I did not included it on my readme because I did not used or even looked at their code, but that's the WFC I was referring to when I named my project.

I learned the basic concepts of WFC from different sources and try to implement them on my own.

Pretty unclear what we're looking at here ... any context you'd like to provide?

Not OP, but I happened to see a good video on this recently: https://youtu.be/2SuvO4Gi7uY

In short, it’s an algorithm for procedural generation of tiled content, like 2d/3d game maps.

Thanks, very good video.

How is this related to making a measurement of a quantum system and the ensuing wavefunction collapse to one eigenstate?

No offense, but it looks like a rendering of my lawn after the gophers got into it.

It isn't, its a constraint solver, a closer analogue would be sudoku solving.

The name arises because you start by population all grid squares with all possible tiles, and use the constraints to progressively eliminate tiles until there is only one for each grid square.

Sometimes you need to make a random choice between equally valid tiles, so in a sense you start with a superposition of possible tilings, and reduce to a single one, hence the name.

It's a pretty well known algorithm for procedural terrain generation. No need to be snarky.

Just my opinion on the visual.

I did my doctoral work in the area of quantum dynamics, and wavefunction collapse does have a well-known definition and context.

While it might (now) apply to the generation of terrain imagery as well, it's hardly related to the accepted definition and meaning in quantum mechanics.

Perhaps a better title would be "Procedural Terrain Generation."

Just my $0.02.

You should message the creator and let him know your thoughts https://github.com/mxgmn/WaveFunctionCollapse

> I did my doctoral work in the area of quantum dynamics

Then why would you have any understanding of terms of art from outside of that field? I understand the confusion, but there's no need to imply that the OP is objectively wrong just because you don't like that (someone else) named their algorithm wave function collapse.

It's not just about terrain and the original version is seeded with a prototype image that the algorithm learns a pattern from that it then replicates with variations.

It's not described that way but it is a one-shot pattern learning algorithm that is much more interesting than just a procedural generation algorithm, or even a constraint solver as others have said.

See the link to the creator of the original version given by platz in the sister comment. There's more going on than just "procedural terrain generation".

its not

Everyone, I was monitoring this thread a while back and it got no traction. I only now seeing the comments (we really do need a notification system for HN) I'll try to answer them all right now.

Reload the page for a new map

[Note: The Github page has a static image. Reload the live version linked there https://victorribeiro.com/simpleWFC/ ]

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact