Superpositions, Sudoku, the Wave Function Collapse algorithm.

  Рет қаралды 671,540

Martin Donald

Martin Donald

3 жыл бұрын

In this video I explore the wave function collapse algorithm, and explain how I went about implementing it using Blender and Godot.
WFC demos on itch:
bolddunkley.itch.io/wfc-mixed
bolddunkley.itch.io/wave-func...
References:
marian42.de/article/wfc/
oskarstalberg.com/game/wave/wa...
github.com/mxgmn/WaveFunction...
robertheaton.com/2018/12/17/w...
Me:
Patreon / bolddunkley
Twitter / bolddunkley
itch.io bolddunkley.itch.io/
Software used for this video:
(Content)
Blender 2.8 www.blender.org/
Godot 3.2 godotengine.org/
OBS obsproject.com/
Kdenlive kdenlive.org/en/

Пікірлер: 605
@tonogram
@tonogram 2 жыл бұрын
With a name like Wave Function Collapse, I was expecting some really advanced mathematics, but this is actually beautifully simple and intuitive.
@aarondewindt
@aarondewindt 2 жыл бұрын
A lot of things in mathematics are beautifully simple and intuitive. It's just that mathematicians are really bad at explaining things. Or to be more exact, they are really good at explaining things to other mathematicians.
@jessiejanson1528
@jessiejanson1528 2 жыл бұрын
i dont know about beautiful, but simple for sure.
@Piotrek7654321
@Piotrek7654321 Жыл бұрын
Just like the Universe.
@rawallon
@rawallon Жыл бұрын
@@Piotrek7654321 i dont know about Universe, but you for sure.
@Piotrek7654321
@Piotrek7654321 Жыл бұрын
@@rawallon A stranger on the Internet just called me beautiful? Aww, thank you
@morganlak4337
@morganlak4337 2 жыл бұрын
Never thought about comparing it to sudoku, that's such a smart way of describing it!
@m4rt_
@m4rt_ 2 жыл бұрын
I thought of the game carcasone.
@ocaly
@ocaly 2 жыл бұрын
@@m4rt_ 2D representation for something that looks complicated in 3D. Nice!
@lucadeacha
@lucadeacha 2 жыл бұрын
@@ocaly Yes but interestingly, you can also see the sudoku as a 3d problem. You have an X and Y axis, but given that any number from 0 to 9 can be on the same space at the same time you can also represent this as a Z axis.
@ocaly
@ocaly 2 жыл бұрын
@@lucadeacha you could look at it from that way and there are many sudoku variants even using that (f.e. "skyscraper sudokus").
@ocaly
@ocaly 2 жыл бұрын
@@lucadeacha or cubedoku's which is precisely what you're describing. but skyscraper sudokus is more well-known example among the online sudoku peers.
@martinbecker2164
@martinbecker2164 2 жыл бұрын
This is literally the best explanation for how this algorithm works.
@OMGclueless
@OMGclueless 2 жыл бұрын
Well, the explanation is super simple because it completely glosses over/ignores what happens when the constraint propagation fails and you need to backtrack or start over. There is a split second at 12:04 where two big pink exclamation points show a failed propagation -- what to do with that is not explained at all, and in fact is the most difficult part of designing a WFC algorithm that doesn't run for hours or fail 99% of the time.
@martinbecker2164
@martinbecker2164 2 жыл бұрын
@@OMGclueless Well, Ok that's a fair point & I did notice that but didn't quite understand what they meant, but for an explanation on how it generally works, I've found a lot of other explanations to be super complex or not very intuitive, especially when compaired to this explanation.
@kenhaley4
@kenhaley4 2 жыл бұрын
@@OMGclueless Agreed. I was just about to reply with this same question.
@mrmartinwatson1
@mrmartinwatson1 Жыл бұрын
I see Martin, i like
@kyousouka
@kyousouka Жыл бұрын
@@OMGclueless Backtracking is not part of WFC itself and is thus probably just outside this video's scope - the original WFC implementation quits when it encounters a contradiction. Backtracking just happens to be a very helpful addition to WFC :] That said, the fundamentals of backtracking are fairly simple to explain and probably could've been mentioned - you push every collapse and the pre-collapse state onto a stack, and if the collapse causes a contradiction, you pop that collapse and remove that candidate from that cell's candidate list and propagate that. If that removal also causes a contradiction, you pop yet another collapse off the stack, and so on. The difficulty comes from storing the pre-collapse state in such a way that it won't eat all your memory or require recalculating most of the state at each Undo, and that's definitely beyond this video's scope.
@iankaranja7765
@iankaranja7765 3 жыл бұрын
This is one of the most well-presented videos, on a technical subject, that I have ever watched on youtube. Great work, looking forward to more content.
@noamrtdthesorcerer733
@noamrtdthesorcerer733 2 күн бұрын
Watched more than 3 hours of implementations and explanations about wave function collapse, Can confirm that this one was the best from every aspect, Thank you!.
@scottcourtney8878
@scottcourtney8878 Жыл бұрын
Terrific explanation! I recently finished reading "Doors of Eden" (by Adrian Tchaikovsky), a novel in which wave function collapse influences the plot outcome significantly. I'm going to share the link for this video with my wife and a friend who've also recently read the book but who are both humanities scholars rather than techies, because if they simply stop at the beginning of the programming section, they will get an extremely lucid and approachable explanation of the theory. Well done, and thanks for sharing.
@Ziboo30
@Ziboo30 3 жыл бұрын
Best WFC explanation I've watch. Thanks !
@fearian
@fearian 3 жыл бұрын
It really is! And even provides links to all the further reading you want. Great video.
@alejmc
@alejmc 3 жыл бұрын
Agreed. Definitely brings this ‘WFC’ that we have been seeing from the likes of Oskar Stalberg since some years now to humanly possible understandable levels. The Sudoku explanation is quite straightforward to grasp the concept, at least for me. Deserves the patron support hands down.
@Sergeeeek
@Sergeeeek 2 жыл бұрын
This is super useful for generating levels with a set number of points of interest. You add whatever things you want to have in a level at random points and maybe add roads between them and after that you can make this algorithm do its magic to fill in the details. Very nice!
@jessiejanson1528
@jessiejanson1528 2 жыл бұрын
though it would be different for every user unless you have some way to define what goes where specifically by the coordinate.
@Lord_Drakostar
@Lord_Drakostar Жыл бұрын
@@jessiejanson1528 as long as your pseudorandom selection process is consistent then it shouldn't be an issue
@luck3949
@luck3949 2 жыл бұрын
If you add recursive backtracking to this algorithm, you'll end up with a classic algorithm for SAT solving, called DPLL. Also, DPLL is very old and outdated, so if your constraints are too complex to find a solution with it, consider taking inspiration from CDCL algorithm, or just use the off the shelf SAT/SMT solver, like Z3.
@sweetcornwhiskey
@sweetcornwhiskey 2 жыл бұрын
I'm working on creating a complex sudoku solver for variant sudoku rules, and my current algorithm that I came up with seems to reduce to DPLL. Do you know of some elementary resources where I could learn some more about CDCL to make my algorithm faster? I got a minor in comp sci, but most of the resources that I've seen are borderline graduate CS level.
@luck3949
@luck3949 2 жыл бұрын
@@sweetcornwhiskey I learned about that algorithms from presentations of Emina Torlak from her Washington University course, you can google that course. Once you get through the notation, that should be understandable.
@luck3949
@luck3949 2 жыл бұрын
@@sweetcornwhiskey CSE 507
@sweetcornwhiskey
@sweetcornwhiskey 2 жыл бұрын
@@luck3949 Thanks!
@notjnsz
@notjnsz 2 жыл бұрын
@@sweetcornwhiskey there's been a SAT competition for the past 20 years: see SAT RACE / SAT COMP. You will find an assortment of different solvers source codes to look at/reference. A lot of the content is dense/state of the art, but the assorted info over the years is probably the best resource for speeding up SAT solving. You might find a PhD dissertation/Survey or two where the "preliminaries" or "background” section explain completely the ideas, reasoning behind it, etc. before jumping into what is likely more difficult.
@vast634
@vast634 Жыл бұрын
The idea to just analyze an example level to determine valid sockets is great. I did not even think about that. Makes it much easier to create complex rules and have the computer imitate the style of a human Level Designer.
@cohan000
@cohan000 Жыл бұрын
Normally my brain hurts when I try to grasp new concepts, but that just didn't happen now. You have a way of explaining things making the concepts very easy to understand
@3nertia
@3nertia 2 жыл бұрын
That was mind-bending! Really some food for thought! And you've convinced me to take up Sudoku! I really love that you relate Sudoku to wave function collapse in this way! Really helped something *click* in my brain; thank you!
@Gogglesofkrome
@Gogglesofkrome 2 жыл бұрын
The way you break down the software is perfect for learning key concepts on a functional level. In my eyes, you are the gold standard. You can bet that I will be watching everything you'd ever made over the upcoming days
@abraxas2658
@abraxas2658 2 жыл бұрын
This is honestly not only extremely well explained, but also beautiful too
@oncedidactic
@oncedidactic 2 жыл бұрын
Nicely presented! I thought you were going to talk about physics but I watched the whole video because this algo idea is so fun, and all the info was a good mix of visual demo and technical details, perfect for morning coffee :D
@cintron3d
@cintron3d 3 жыл бұрын
Wow, this was amazing. So well organized, articulated, and indeed respectful of my time. You sir have earned a sub + bell. Thank you for this I'm sure I'll end up referring back to this one day.
@slackstation
@slackstation 3 жыл бұрын
This may be one of the best videos on this topic I've ever seen. Its explanatory power is breathtaking. This just shows the principle so well with so little wasted effort.
@bilalakil
@bilalakil 3 жыл бұрын
Thank you for the fantastically clear, intuitive, and well-articulated explanation 🙂 Much appreciated ❤️
@willlacey7621
@willlacey7621 2 жыл бұрын
AWESOME video! Thank you so much for the extremely detailed overview of this algorithm! I definitely feel like I have a grasp on how to implement and modify it. Thanks again!
@jashanbhullar3384
@jashanbhullar3384 2 жыл бұрын
I really appreciate the effort you put in to explain what I once thought was a really difficult algorithm to understand. Great Job!
@minleyfox5231
@minleyfox5231 Жыл бұрын
This is the best explanation video on WFC I have found! Alone with the example at the beginning I could conceptualize the algorithm. great work!
@albingrahn5576
@albingrahn5576 2 жыл бұрын
this is awesome, you explained the concept so well that it just intuitively clicked for me. i feel like the number of tools in my mental toolbox as a programmer has increased after watching this video
@itToxic
@itToxic 2 жыл бұрын
Absolutely loved this video, especially love how in the beginning you compared it to something that everyone can understand before going more in-depth.
@PhilipBlyth
@PhilipBlyth 6 ай бұрын
By far the best introduction to and explanation of WFC I've come across...! Thank you for taking the time to make this.
@DariusKazemi
@DariusKazemi 3 жыл бұрын
WOW, this is an incredibly well-made video. You've done such a good job teaching and choosing your metaphors.
@Darfk
@Darfk 2 жыл бұрын
dude, this video is so good, I've looked at explanations on WFC for ages and this one really made me understand it
@technopoptart
@technopoptart 11 ай бұрын
heck, you explained wave function collapse so beautifully in just two minutes. i am sticking around for the rest of the video of course but even so i had to compliment you on being so succinct
@qwertyuuytrewq825
@qwertyuuytrewq825 3 жыл бұрын
Wow! Thank you for a great explanation and for mentioning all these references! I realized that when developing something like a tile engine I can avoid making an editor to create test levels (at least at the beginning) and use WFC to generate levels automatically.
@howardjones543
@howardjones543 2 жыл бұрын
This is the best explanation I've seen for WFC - it's got me thinking about where I can apply it, and I don't write games. I also accidentally watched all your back-catalogue. Pity there aren't more - they're all really well explained!
@PinikRahman
@PinikRahman 3 жыл бұрын
wow.. this is the most amazing explanation ever.. Please Please keep making high quality videos like this.
@custom_name854
@custom_name854 2 жыл бұрын
Very nice and compact video, makes me want to program my own implementation from scratch. Also, the comparison of the wave function collapse to sudoku was what made it click for me, very well done :)
@rosva4331
@rosva4331 2 жыл бұрын
Of all the videos that I watched on wave function collapse, yours is by far the best at explaining it.
@liam2317
@liam2317 2 жыл бұрын
You did a fantastic job of explaining this concept. Thank you so much!
@gharren
@gharren Жыл бұрын
Hands down the best explanation for WFC I've ever seen. Kudos!
@evilplantosavetheworld
@evilplantosavetheworld 3 жыл бұрын
I've been reading about wave function collapse for a few days, and four minutes into your video I already understand it better than everything else I've seen combined. Fantastic job
@jessef3462
@jessef3462 2 жыл бұрын
Thank You! This video helped it all make sense! I love your "wax on, wax off" trick about teaching us Wave Function Collapse through sudoku! Right when I'm like wait, I want to learn about Wave Function Collapse, you have already tricked me into learning it! I knew karate the whole time.
@DavidSmerkous
@DavidSmerkous 2 жыл бұрын
Without a doubt one of the best explanations I've heard/seen. Thank you so much for that.
@NathanielWyatt
@NathanielWyatt Жыл бұрын
Thanks for this high density video! Beautiful masterpiece, you earned my subscription!
@CodingCircle
@CodingCircle Жыл бұрын
Best WFC Explanation never thought of comparing it to Sudoku. Nice Vid!!
@drummerman883
@drummerman883 3 ай бұрын
That was just enough information to be able to write it and not be lost. Thank you for not over or under explaining it like most videos do.
@MujjMujj
@MujjMujj 3 жыл бұрын
Man you're so good! cant believe this channel is so small :O really helped me out with my next project :)
@clockworkkirlia7475
@clockworkkirlia7475 Жыл бұрын
Brilliant, concise, informative and fun! A truly exquisite piece of education.
@anothercastle17
@anothercastle17 Жыл бұрын
Very informative, thank you. I’ve been considering implementing wfc in music composition, and this explanation helps me grasp it. Have a pleasant day.
@AntEr3Bu5
@AntEr3Bu5 Жыл бұрын
good video! haven't found many good channels like this explaining algorithms or CS concepts, have subbed!
@VladgavligGapchich
@VladgavligGapchich 3 жыл бұрын
Thank you so much for your video! Great material and superb delivery, I enjoyed it a lot!
@shanmathew152
@shanmathew152 Жыл бұрын
Sudoku example was brilliant, Thank you so much .🙏.
@debemdeboas
@debemdeboas 2 жыл бұрын
Incredible content. Amazingly explained. I'm excited to see more
@dotvhs
@dotvhs Жыл бұрын
Holy crap, I just stumbled upon this channel randomly and I'm stunned. Amazing content, thank you for this.
@yonatanchapal7800
@yonatanchapal7800 Жыл бұрын
What a great way to explain this! Wonderful video
@vyzirT09
@vyzirT09 2 жыл бұрын
just got my own implementation working in unity, this video was a massive help!
@abdullahx8118
@abdullahx8118 Жыл бұрын
holy shit this makes it make so much sense, i wouldnt have known this comparison would work so well! Good discovery!
@eftorq
@eftorq 2 жыл бұрын
This is so well made and perfectly explained. You need way more subs!
@chloesun1873
@chloesun1873 2 жыл бұрын
Well explained! Thanks for your effort!
@NedTheUndead
@NedTheUndead 2 жыл бұрын
This was an excellent video! A really great explanation of this kind of generative art.
@SaiponathGames
@SaiponathGames 2 жыл бұрын
Looking forward to your content, Wave Function Collapse algorithm is awesome, can't wait to try out in game.
@realMenta
@realMenta 2 жыл бұрын
Amazing tutorial and explanation. Thank you!
@devtx649
@devtx649 2 жыл бұрын
Omg you are a genius! I never learned AND understood so much information at once. Great work!!
@noxabellus
@noxabellus Жыл бұрын
This is the best wave function collapse video out there. By far. 10/10
@jasperkennis8499
@jasperkennis8499 2 жыл бұрын
First explanation of WFC that I actually understood, thanks!
@Gdquest
@Gdquest 3 жыл бұрын
Excellent! I'll be eagerly watching your future videos. Are you also using Doom Emacs with the gdscript layer? If you have any suggestions for improvements they're welcome on the repository.
@MartinDonald
@MartinDonald 3 жыл бұрын
I'm actually using pycharm but I can see why you'd think that, the colour schemes are almost identical. I'll definitely look into it though.
@kingsleylangston1959
@kingsleylangston1959 2 жыл бұрын
I guess im asking the wrong place but does anyone know a tool to get back into an Instagram account..? I was stupid lost the password. I would love any tips you can offer me
@kingsleylangston1959
@kingsleylangston1959 2 жыл бұрын
@Sylas Casey i really appreciate your reply. I got to the site on google and I'm trying it out atm. Looks like it's gonna take a while so I will get back to you later when my account password hopefully is recovered.
@kingsleylangston1959
@kingsleylangston1959 2 жыл бұрын
@Sylas Casey it did the trick and I actually got access to my account again. I am so happy! Thank you so much you saved my account !
@sylascasey3828
@sylascasey3828 2 жыл бұрын
@Kingsley Langston no problem :)
@drtristanbehrens
@drtristanbehrens 3 жыл бұрын
This is so great! The presentation is excellent! Will share on LinkedIn soon.
@alexandrupostolache6704
@alexandrupostolache6704 3 жыл бұрын
Excellent video! Thanks for sharing! Also, you are the reason I created a Patreon and you're the first person I'm sponsoring! :) Great job!
@MartinDonald
@MartinDonald 3 жыл бұрын
Thank you so much!
@asadplatypus3940
@asadplatypus3940 Жыл бұрын
As someone looking to do a wave function collapse implementation the really helped me understand
@HighlandHellboy
@HighlandHellboy Жыл бұрын
I’m from the complete other side of the spectrum, I’m a physics student in their penultimate year of their undergraduate and I know and understand superposition and collapsing a wavefunction in quantum mechanics, but have never seen it used for mapping. That’s awesome!
@jeanahollings
@jeanahollings 2 жыл бұрын
this was brilliant! come back, make more, please!!
@Nightstick24
@Nightstick24 Жыл бұрын
Wow, comparing it to sudoku was smart. That made it so much easier to wrap my head around!
@JasonCummer
@JasonCummer 2 жыл бұрын
This is pretty cool. Now I have to thinknif this is going to work for our game. Thanks
@lupin2232
@lupin2232 Жыл бұрын
v0_0 is how my face looks when looking at the astonishing amount of informative data in this video. Kudos on how well presented this is too!
@Forummaker
@Forummaker 3 жыл бұрын
Thank you for creating quality content that appreciates our time.
@PuraTvOyun
@PuraTvOyun 2 жыл бұрын
Thank you so much. This is the cleanest explanation I came across so far. ❤
@Jacob_graber
@Jacob_graber 2 жыл бұрын
This video is fantastic, thank you Martin.
@thinhhb8117
@thinhhb8117 2 жыл бұрын
you're the master of making difficult-to-understand things become much easier ones.
@JanezKrnc-San
@JanezKrnc-San Жыл бұрын
Looked at some of your other videos as well. Brilliant content! Subbed.
@MiguelAngelJD
@MiguelAngelJD 2 жыл бұрын
DUDE SUCH A NICE EXPLANATION! THANK YOU SO MUCH
@azeews1368
@azeews1368 3 жыл бұрын
I'm so glad I found your channel. You really remind me of Sebastian Lague! Your content is phenomenal, I really hope your channel picks up more traction soon. Cheers!
@EdNieThePianoGuy
@EdNieThePianoGuy Жыл бұрын
Explaining wave function theory is usually quite the challenge, but you managed to do it really nicely by using Sudoku! I'm definitely gonna use this analogy next time I find myself talking about quantum mechanics (whenever that happens, haha).
@cwhy
@cwhy 3 жыл бұрын
Well explained. Thank You!
@rmt3589
@rmt3589 Жыл бұрын
This is amazing! This'll help me so much! Thank you!
@VictorGordan
@VictorGordan 2 жыл бұрын
Really nice explanation and visuals!
@DrBossKey
@DrBossKey 3 ай бұрын
This is fantastic! Thank you!
@emicandea9819
@emicandea9819 Жыл бұрын
This video is illuminating!
@jefflhama
@jefflhama 3 жыл бұрын
Woah, I'll have to do a tier in your patreon, this is so well explained
@dameck9570
@dameck9570 Жыл бұрын
When i saw this title i realized, i have implemented WFC for Sudoku without realizing it. Amazing :)
@jeandeux2711
@jeandeux2711 2 жыл бұрын
Just found this channel and it is absurdly good -- wow!
@ConsumerOfReality
@ConsumerOfReality 2 жыл бұрын
Thank you for creating this excellent video!
@xomvoid_akaluchiru_987
@xomvoid_akaluchiru_987 11 күн бұрын
I saw the Bad North inspired island generation in the thumbnail :) Love the game! I can understand why Oskar is so stuck on the idea (He keeps going back to it on Twitter)
@isweartofuckinggod
@isweartofuckinggod Жыл бұрын
What a brilliant video!
@tuazulyrojoeljean
@tuazulyrojoeljean Жыл бұрын
Awesome video, thank you very much!
@remotestar
@remotestar 3 жыл бұрын
Wow, very well explained! So, the constraints of reality lead to the collapse of wave function.
@michaelfrost943
@michaelfrost943 2 жыл бұрын
This is an absolutely excellent video!
@ninekay9
@ninekay9 Жыл бұрын
Amazing loved this!
@andressolar517
@andressolar517 Жыл бұрын
EXCELLENT PRESENTATION!!
@user-iq3ys6rl3e
@user-iq3ys6rl3e 3 жыл бұрын
Very clear explanation!!! Thank you!!!
@TeamUnpro
@TeamUnpro 2 жыл бұрын
the amount of math and editing required for this video is insanely impressive
@drevoksi
@drevoksi Жыл бұрын
Such a great video, thank you!!
@ZioBlu
@ZioBlu 2 жыл бұрын
Lovely video. Thank you so much for this!
@0_-
@0_- 3 жыл бұрын
I have learned so much from this video, and I thank you so much!
@sirpaleet9144
@sirpaleet9144 Жыл бұрын
Our teacher added this as our study material on a course lol. Very informative!
@MartinDonald
@MartinDonald Жыл бұрын
This makes me unreasonably proud, thank you for sharing! 🙏
@sirpaleet9144
@sirpaleet9144 Жыл бұрын
@@MartinDonald You should!
@vornamenachname8001
@vornamenachname8001 3 жыл бұрын
so simple but so powerful I love it
@devwolph3019
@devwolph3019 3 жыл бұрын
Thank you! I'm trying to make my own game featured infinite level generation, This will help me a lot !! Your explanation is so well, even a none English speaker like me can understand :D
A new way to generate worlds (stitched WFC)
10:51
Watt Designs
Рет қаралды 490 М.
Kitten has a slime in her diaper?! 🙀 #cat #kitten #cute
00:28
Useful Gadget for Smart Parents 🌟
00:29
Meow-some! Reacts
Рет қаралды 8 МЛН
Coding Marching Squares
26:28
The Coding Train
Рет қаралды 173 М.
The Beauty of Bézier Curves
24:26
Freya Holmér
Рет қаралды 1,9 МЛН
Procedurally Generated 3D Dungeons
9:42
Vazgriz
Рет қаралды 254 М.
Coding Challenge 180: Falling Sand
23:00
The Coding Train
Рет қаралды 691 М.
Coding Adventure: Ant and Slime Simulations
17:54
Sebastian Lague
Рет қаралды 1,8 МЛН
Quantum Wave Functions: What's Actually Waving?
11:04
The Science Asylum
Рет қаралды 451 М.
10 weird algorithms
9:06
Fireship
Рет қаралды 1 МЛН
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 4,8 МЛН