Live data from Hacker News

Infinite procedurally-generated city with the Wave Function Collapse algorithm

marian42.itch.io

21–30 of 145 posts

Re: Infinite procedurally-generated city with the Wave Function Collapse algorithm

#22

Amazing work! I've been excited about this technique since I first saw the original demos of it ( https://github.com/mxgmn/WaveFunctionCollapse ) - but can someone explain (at a very high level) how Wave Function Collapse works? I've read through some of the documentation on various repos - it starts with the nitty-gritty details, and I haven't been able to grasp the concepts.

Here's my high-level understanding. You're going to tile (say) the plane with a set of tiles you've chosen beforehand. (In this example, it looks like the tiles are 3d.) There are rules for which tiles can go next to each other---the edges must match. As you go, there are two regions: a region in which you've settled on which tiles to use, and a boundary region in which you haven't. In the boundary region, you keep t…

Oh my....perhaps this backtracking to fix past inconsistencies could allow for a game environment in which "Mandela effect" events happen naturally from time to time. Could make for an interesting game mechanic.

Re: Infinite procedurally-generated city with the Wave Function Collapse algorithm

#25

Amazing work! I've been excited about this technique since I first saw the original demos of it ( https://github.com/mxgmn/WaveFunctionCollapse ) - but can someone explain (at a very high level) how Wave Function Collapse works? I've read through some of the documentation on various repos - it starts with the nitty-gritty details, and I haven't been able to grasp the concepts.

Here's my high-level understanding. You're going to tile (say) the plane with a set of tiles you've chosen beforehand. (In this example, it looks like the tiles are 3d.) There are rules for which tiles can go next to each other---the edges must match. As you go, there are two regions: a region in which you've settled on which tiles to use, and a boundary region in which you haven't. In the boundary region, you keep t…

This sounds like standard procedures for sampling from a Markov random field.

https://en.wikipedia.org/wiki/Markov_random_field

Re: Infinite procedurally-generated city with the Wave Function Collapse algorithm

#26

Earlier quoted context omitted.

Here's my high-level understanding. You're going to tile (say) the plane with a set of tiles you've chosen beforehand. (In this example, it looks like the tiles are 3d.) There are rules for which tiles can go next to each other---the edges must match. As you go, there are two regions: a region in which you've settled on which tiles to use, and a boundary region in which you haven't. In the boundary region, you keep t…

Two additions to this: - AFAIK, the probability distribution is based on how common any particular adjacency is in the input. If the input is just rules rather than a small sample map, they'd all be equal, but if the input is an image that shows (for example) that only one in ten roads dead-end, that would carry over to generated stuff. - It can also do an "overlapping" model, where it sets one pixel at a time but co…

In my case, the probabilites for each block are supplied manually.

Re: Infinite procedurally-generated city with the Wave Function Collapse algorithm

#28
post #22

Earlier quoted context omitted.

Here's my high-level understanding. You're going to tile (say) the plane with a set of tiles you've chosen beforehand. (In this example, it looks like the tiles are 3d.) There are rules for which tiles can go next to each other---the edges must match. As you go, there are two regions: a region in which you've settled on which tiles to use, and a boundary region in which you haven't. In the boundary region, you keep t…

Oh my....perhaps this backtracking to fix past inconsistencies could allow for a game environment in which "Mandela effect" events happen naturally from time to time. Could make for an interesting game mechanic.

You're right. There is backtracking in the demo and when it happens it looks quite eerie. The world around you just decides it wants to look different and changes.

Re: Infinite procedurally-generated city with the Wave Function Collapse algorithm

#29

Does this remember what’s been generated if you come back to an area you’ve been before?

Yes, it does. However the algorithm is not deterministic. If you close the game and start it again, you will see a different world.

Re: Infinite procedurally-generated city with the Wave Function Collapse algorithm

#30
post #20

Here's a collection of relevant links for the lazy: * Animated gif: https://twitter.com/marian42_/status/1061785383057440768 * GitHub page (demo in Unity): https://github.com/marian42/wavefunctioncollapse * Original Wave Function Collapse Algorithm: https://github.com/mxgmn/WaveFunctionCollapse

[deleted]
Post reply on HN