Superpositions, Sudoku, the Wave Function Collapse algorithm.
Martin Donald3 HN recommenders · recommended in 3 months, 2021–2022
explainer · intro · evergreen · 2021–2022 on HN
Martin Donald explains the Wave Function Collapse algorithm using Sudoku-like constraint solving and shows how he implemented it with Blender and Godot. It links demos and reference articles.
Commenters recommend it as the clearest way to understand WFC, especially in threads about Townscaper and tiled content generation.
Up next
5 mo on HNHow Bankrupt American Cities Stay Alive - Debt [ST04]
Not Just Bikes
7 HN recommender · 2021–2024
4 mo on HNA NEW Trace! The FULL MH370 Story, so Far..
Mentour Pilot
5 HN recommender · 2024–2025
4 mo on HNThe medical test paradox, and redesigning Bayes' rule
3Blue1Brown
4 HN recommender · 2020–2025
4 mo on HNThe world depends on a collection of strange items. They're not cheap
Veritasium
6 HN recommender · 2023–2026
11 mo on HNWhy Electronic Voting Is Still A Bad Idea
Tom Scott
11 HN recommender · 2020–2026
10 mo on HNCppCon 2017: Matt Kulukundis “Designing a Fast, Efficient, Cache-friendly Hash Table, Step by Step”
CppCon
9 HN recommender · 2018–2026
8 mo on HNThe Fast Fourier Transform (FFT): Most Ingenious Algorithm Ever?
Reducible
7 HN recommender · 2021–2026
9 mo on HNModern Dictionaries by Raymond Hettinger
SF Python
9 HN recommender · 2016–2025
7 mo on HNCppCon 2014: Chandler Carruth "Efficiency with Algorithms, Performance with Data Structures"
CppCon
7 HN recommender · 2014–2024
7 mo on HNCppCon 2017: Juan Pedro Bolivar Puente “Postmodern immutable data structures”
CppCon
5 HN recommender · 2017–2025
6 mo on HNSorting Algorithms: Speed Is Found In The Minds of People - Andrei Alexandrescu - CppCon 2019
CppCon
7 HN recommender · 2019–2024
6 mo on HNThe Fastest Way to Board a Plane Feels Like the Slowest
CGP Grey
9 HN recommender · 2020–2023
4 comments from Hacker News
I didn't know about wave collapse functions before stumbling about Townscaper. Still, I found them hard to understand until I found this video by Martin Donald: ▶ this video Now, I'm just looking for a use-case to implement them myself sometime.
Not OP, but I happened to see a good video on this recently: ▶ this video In short, it’s an algorithm for procedural generation of tiled content, like 2d/3d game maps.
This uses the "wave function collapse" algorithm. Oskar Stalberg also made a great demo of how it works[0], but it might not make sense just from that. Martin Donald made a really nice youtube video on how it works[1]. The name "wave function collapse" can be off putting but it's pretty straightforward, and an algorithm that can come in handy for many uses both in game development and just general software development. I'm actually procrastinating on HN from working on a GPU parallelised version that can generate millions of positions every frame. In Townscaper you can actually see that the algorithm runs quite slow and lags behind the players input, there's just a bunch of animation to hide it. I'm hoping to eventually get a version that can run in log2(mapsize) time. [0] link [1] ▶ this video
I was inspired by Nicky Case[0], but independently recently reached the same conclusion as you have here. In March of 2020 when the pandemic was first hitting the US, before there was an official lock-down, and before any company wide announcement, and without any communication, my entire team had come in on a Friday, and my entire team had stayed home on the Monday. In essence, there was enough information that occurred over the weekend for the wave function to collapse[1]. That's what we're after - if you can illuminate the future in such a way that any other option is no longer an option. I've got no game-dev experience, so the journey will be long, but I think we're on the right track. [0]: link [1]: ▶ this video