Published On Premiered Jul 3, 2022
Straight out of quantum mechanics, Wave Function Collapse is an algorithm for procedural generation of images. In this video (recorded over 3 live streams) I attempt the tiled model and explore a variety of solutions to the algorithm in JavaScript with p5.js. Also, check out WFC's predecessor: Model Synthesis (more info below). Code: https://thecodingtrain.com/challenges...
š Watch this video ad-free on Nebula https://nebula.tv/videos/codingtrain-...
š» Github Repo: https://github.com/CodingTrain/Wave-F...
š¹ļø p5.js Web Editor Sketch: https://editor.p5js.org/codingtrain/s...
š„ Previous: Ā Ā Ā ā¢Ā CodingĀ ChallengeĀ 170:Ā TheĀ MontyĀ HallĀ ...Ā Ā
š„ Next: Ā Ā Ā ā¢Ā CodingĀ ChallengeĀ 172:Ā HorizontalĀ Dire...Ā Ā
š„ All: Ā Ā Ā ā¢Ā CodingĀ ChallengesĀ Ā
References:
š” WFC Challenge Suggestion: https://github.com/CodingTrain/Sugges...
š Wave Function Collapse Algorithm: https://github.com/mxgmn/WaveFunction...
š Model Synthesis: https://paulmerrell.org/model-synthesis/
š£ āWave Collapse Function algorithm in Processing: https://discourse.processing.org/t/wa...
š Array.prototype.filter(): https://developer.mozilla.org/en-US/d...
š Encoding tiles symmetry and rotation #14: https://github.com/CodingTrain/Wave-F...
š The issue with asymmetric tiles and an easy solution #16: https://github.com/CodingTrain/Wave-F...
š Array.prototype.reverse(): https://developer.mozilla.org/en-US/d...
Creative Works Featured:
šØ OisĆn: Wave Function Collapse for poetry: https://github.com/mewo2/oisin
šØ Townscaper: https://www.townscapergame.com/
šØ unity-wave-function-collapse: https://selfsame.itch.io/unitywfc
šØ Zelda WFC: https://observablehq.com/@makio135/ze...
šØ Wave Function Collapse Demonstration: https://oskarstalberg.com/game/wave/w...
šØ Infinite procedurally generated city: https://marian42.de/article/wfc/
šØ Generating stairy scenes: https://twitter.com/exutumno/status/8...
Live Stream Archives:
š“ Day 1: Ā Ā Ā ā¢Ā WaveĀ FunctionĀ CollapseĀ TakeĀ 2Ā Ā
š“ Day 2: Ā Ā Ā ā¢Ā WaveĀ FunctionĀ CollapseĀ TakeĀ 3Ā Ā
š“ Day 3: Ā Ā Ā ā¢Ā WaveĀ FunctionĀ CollapseĀ theĀ FinalĀ Coun...Ā Ā
Videos:
š„ Solving Wordle with Information Theory: Ā Ā Ā ā¢Ā SolvingĀ WordleĀ usingĀ informationĀ theoryĀ Ā
š„ Pixel Array: Ā Ā Ā ā¢Ā 11.3:Ā TheĀ PixelĀ ArrayĀ -Ā p5.jsĀ TutorialĀ Ā
š„ Arrow Function: Ā Ā Ā ā¢Ā 16.3:Ā ES6Ā ArrowĀ FunctionĀ -Ā TopicsĀ ofĀ ...Ā Ā
š„ Higher Order Array Functions: Ā Ā Ā ā¢Ā 16.5:Ā HigherĀ OrderĀ FunctionsĀ inĀ JavaS...Ā Ā
š Matrix Transformations: https://thecodingtrain.com/tracks/tra...
š„ Oskar Stalberg - Wave Function Collapse in Bad North: Ā Ā Ā ā¢Ā EPC2018Ā -Ā OskarĀ StalbergĀ -Ā WaveĀ Funct...Ā Ā
Related Coding Challenges:
š 10 Maze Generator: Ā Ā Ā ā¢Ā CodingĀ ChallengeĀ #10.1:Ā MazeĀ Generato...Ā Ā
š 162 Self Avoiding Walk: Ā Ā Ā ā¢Ā CodingĀ ChallengeĀ 162:Ā Self-AvoidingĀ WalkĀ Ā
š 165 Slide Puzzle: Ā Ā Ā ā¢Ā CodingĀ ChallengeĀ 165:Ā SlideĀ PuzzleĀ Ā
Timestamps:
0:00 Day 1! Wave Function Collapse!
2:00 Entropy in Sudoku.
5:41 Comparing Sudoku to WFC
9:24 Starting to code.
11:05 Collapsing cells.
13:30 Evaluating entropy.
18:47 Updating entropy after collapse.
22:45 Data structure for rules.
24:50 Implementing rules for next collapse.
36:28 Explaining the rules.
38:45 Day 2! Refactoring the code.
39:26 Create a Tile class
44:57 Generate the rules from Tile objects.
55:40 Using new circuit board tileset.
1:00:40 Day 3! Dealing with asymmetrical tiles
1:01:56 Assigning index values to edges.
1:06:53 Incorporating edges into code.
1:10:05 Change adjacency for assymetry
1:12:06 First assymetric WFC image!
1:12:40 Restart if no valid cell found.
1:15:48 Next steps!
1:18:05 Thanks for watching!
Editing by Mathieu Blanchette
Animations by Jason Heglund
Music from Epidemic Sound
š Website: https://thecodingtrain.com/
š¾ Share Your Creation! https://thecodingtrain.com/guides/pas...
š© Suggest Topics: https://github.com/CodingTrain/Sugges...
š” GitHub: https://github.com/CodingTrain
š¬ Discord: https://thecodingtrain.com/discord
š Membership: http://youtube.com/thecodingtrain/join
š Store: https://standard.tv/codingtrain
šļø Twitter: Ā Ā /Ā thecodingtrainĀ Ā
šø Instagram: Ā Ā /Ā the.coding.trainĀ Ā
š„ Coding Challenges: Ā Ā Ā ā¢Ā CodingĀ ChallengesĀ Ā
š„ Intro to Programming: Ā Ā Ā ā¢Ā StartĀ learningĀ here!Ā Ā
š p5.js: https://p5js.org
š p5.js Web Editor: https://editor.p5js.org/
š Processing: https://processing.org
š Code of Conduct: https://github.com/CodingTrain/Code-o...
This description was auto-generated. If you see a problem, please open an issue: https://github.com/CodingTrain/thecod...
#wavefunctioncollapse #generativeart #p5js #javascript