Recent

Author Topic: wfc (wave function collapse algorithm)  (Read 565 times)

mr-highball

  • Full Member
  • ***
  • Posts: 220
    • Highball Github
wfc (wave function collapse algorithm)
« on: January 24, 2021, 05:27:22 pm »
Hello, for anyone looking to do some procedural generation, I've written a wfc library with a pretty comfy api to use. supports 2D & 3D graphs and planning to make some tools to integrate a bit better with castle engine
https://github.com/mr-highball/wfc

I'll be adding better examples and finishing up with the tests over the next few days, but it's in a state that people can play with now. Since I don't have any good examples finished up, here's some links showing what other people have done.
https://www.gridbugs.org/wave-function-collapse/
https://www.youtube.com/watch?v=bHr-A2r9N9s

Bart

  • Hero Member
  • *****
  • Posts: 4170
    • Bart en Mariska's Webstek
Re: wfc (wave function collapse algorithm)
« Reply #1 on: January 24, 2021, 08:26:50 pm »
Isn't making a single measurement enough to collaps the wave function  O:-)

Bart

mr-highball

  • Full Member
  • ***
  • Posts: 220
    • Highball Github
Re: wfc (wave function collapse algorithm)
« Reply #2 on: January 24, 2021, 08:45:43 pm »
yep, not sure if I'm missing something to your statement, but the default behavior for mine is a random coord is selected (can be defined other ways, min entropy, fixed location etc...) then the "measurement" is taken and recursively collapses all of the other entries.

Bart

  • Hero Member
  • *****
  • Posts: 4170
    • Bart en Mariska's Webstek
Re: wfc (wave function collapse algorithm)
« Reply #3 on: January 24, 2021, 08:55:00 pm »
yep, not sure if I'm missing something to your statement,

In quantum mechanics the wave function of a particle or a foton collapses once a measurement is taken.
Before the measurement the particle can be in all states at the same time, after the measurement it's state can only be one.
E.g. in the famous double slit experiment, if you make a measurement to observe through which slit the foton has passed, it's wave function collapses, and there will be no more interference pattern.
Another example is of course Schrödingers cat: before the measurement the cat can be thought of being alive and dead at the same time, after the measurement (opening the box in this case), the cat is either dead or alive: it's wave function has collapsed.

Bart

mr-highball

  • Full Member
  • ***
  • Posts: 220
    • Highball Github
Re: wfc (wave function collapse algorithm)
« Reply #4 on: February 12, 2021, 12:51:55 am »
Hah yes ^ if only programming it was easy as "observing".

side note, wanted to try and generate music with this. not much right now, but constraints can be setup to play the A major scale, next I'll try something a bit more "exciting"
https://youtu.be/DS09g-GRhv0

cappe

  • Full Member
  • ***
  • Posts: 125
Re: wfc (wave function collapse algorithm)
« Reply #5 on: February 12, 2021, 08:48:34 am »
I'll take a look at it, it looks beautiful

mr-highball

  • Full Member
  • ***
  • Posts: 220
    • Highball Github
Re: wfc (wave function collapse algorithm)
« Reply #6 on: February 12, 2021, 04:11:19 pm »
thanks!

 

TinyPortal © 2005-2018