|
| 1 | +{ |
| 2 | + "title": "Wave Function Collapse: Overlapping Model", |
| 3 | + "videoNumber": "186", |
| 4 | + "description": "Wave Function Collapse is an algorithm for procedural image generation. In this long overdue follow-up to my tiled model video, I dive into the overlapping model, coding it step by step (complete with struggles and messy debugging interludes) in JavaScript with p5.js.", |
| 5 | + "videoId": "5iSAvzU2WYY", |
| 6 | + "nebulaSlug": "codingtrain-coding-challenge-186-wave-function-collapse", |
| 7 | + "date": "2025-01-26", |
| 8 | + "languages": ["p5.js", "JavaScript"], |
| 9 | + "topics": ["wave function collapse", "overlapping model", "procedural generation"], |
| 10 | + "canContribute": true, |
| 11 | + "relatedChallenges": ["10-dfs-maze-generator", "165-slide-puzzle", "171-wave-function-collapse"], |
| 12 | + "timestamps": [ |
| 13 | + { "time": "0:00:00", "title": "Introduction" }, |
| 14 | + { "time": "0:01:12", "title": "The Nature of Code book!" }, |
| 15 | + { "time": "0:02:20", "title": "WFC Resources and References" }, |
| 16 | + { "time": "0:08:19", "title": "Extracting tiles from a source image" }, |
| 17 | + { "time": "0:21:30", "title": "Calculating adjacency rules for tiles" }, |
| 18 | + { "time": "0:24:34", "title": "Checking for overlapping pixel colors" }, |
| 19 | + { "time": "0:32:20", "title": "Debugging tile adjacencies" }, |
| 20 | + { "time": "0:43:30", "title": "Creating a Cell class" }, |
| 21 | + { "time": "0:46:21", "title": "Incorporate code from WFC tile model" }, |
| 22 | + { "time": "0:50:50", "title": "Reduce entropy of neighboring tiles" }, |
| 23 | + { "time": "0:55:56", "title": "Rendering the center pixel for each tile" }, |
| 24 | + { "time": "0:58:05", "title": "Cross checking valid tile options" }, |
| 25 | + { "time": "1:01:57", "title": "Recursive entropy reduction" }, |
| 26 | + { "time": "1:05:32", "title": "Limit recursion depth" }, |
| 27 | + { "time": "1:06:32", "title": "Challenge complete?" }, |
| 28 | + { "time": "1:08:26", "title": "Bugs found between Day 1 and Day 2" }, |
| 29 | + { "time": "1:09:13", "title": "Starting Day 2" }, |
| 30 | + { "time": "1:10:02", "title": "Correcting pixel color if statement" }, |
| 31 | + { "time": "1:11:16", "title": "Refactoring redundant code" }, |
| 32 | + { "time": "1:17:26", "title": "Running out of tile options" }, |
| 33 | + { "time": "1:21:24", "title": "Optimizing the code" }, |
| 34 | + { "time": "1:23:47", "title": "Rendering average pixel color of remaining tile options" }, |
| 35 | + { "time": "1:26:23", "title": "How to handle redundant tiles?" }, |
| 36 | + { "time": "1:28:30", "title": "More tiles with rotations and reflections" }, |
| 37 | + { "time": "1:29:39", "title": "Additional performance optimizations" }, |
| 38 | + { "time": "1:31:40", "title": "Thanks for watching!" } |
| 39 | + ], |
| 40 | + "codeExamples": [ |
| 41 | + { |
| 42 | + "title": "Wave Function Collapse: Overlapping Model", |
| 43 | + "description": "Raw code exactly matching the video.", |
| 44 | + "image": "wfc.png", |
| 45 | + "urls": { |
| 46 | + "p5": "https://editor.p5js.org/codingtrain/sketches/SI0c2D_tQ" |
| 47 | + } |
| 48 | + }, |
| 49 | + { |
| 50 | + "title": "WFC Overlapping Model Refactored", |
| 51 | + "description": "Refactored code with optimizations.", |
| 52 | + "image": "wfc_refactored.png", |
| 53 | + "urls": { |
| 54 | + "p5": "https://editor.p5js.org/codingtrain/sketches/2sV4KtcoD" |
| 55 | + } |
| 56 | + }, |
| 57 | + { |
| 58 | + "title": "WFC Overlapping Model: Shannon entropy", |
| 59 | + "description": "This sketch counts tile frequency and incorporates entropy formula.", |
| 60 | + "image": "wfc_entropy.png", |
| 61 | + "urls": { |
| 62 | + "p5": "https://editor.p5js.org/codingtrain/sketches/PX0Hn6TF8" |
| 63 | + } |
| 64 | + }, |
| 65 | + { |
| 66 | + "title": "WFC Overlapping Model: More tiles!", |
| 67 | + "description": "This sketch adds tile rotations and reflections", |
| 68 | + "image": "wfc_rot_reflect.png", |
| 69 | + "urls": { |
| 70 | + "p5": "https://editor.p5js.org/codingtrain/sketches/z_N2TVjRH", |
| 71 | + "processing": "https://github.com/CodingTrain/Wave-Function-Collapse/tree/main/Processing/WFC_Overlapping_Model" |
| 72 | + } |
| 73 | + }, |
| 74 | + { |
| 75 | + "title": "Wave Function Collapse - More!", |
| 76 | + "description": "GitHub repo for expanded and optimized Wave Function Collapse Code.", |
| 77 | + "image": "wfc.png", |
| 78 | + "urls": { |
| 79 | + "other": "https://github.com/CodingTrain/Wave-Function-Collapse" |
| 80 | + } |
| 81 | + } |
| 82 | + ], |
| 83 | + "groupLinks": [ |
| 84 | + { |
| 85 | + "title": "References", |
| 86 | + "links": [ |
| 87 | + { |
| 88 | + "icon": "🗄", |
| 89 | + "title": "Wave Function Collapse GitHub Repo", |
| 90 | + "url": "https://github.com/mxgmn/WaveFunctionCollapse", |
| 91 | + "description": "Maxim Gumin's source code and documentation for Wave Function Collapse." |
| 92 | + }, |
| 93 | + { |
| 94 | + "icon": "🗄", |
| 95 | + "title": "Model Synthesis", |
| 96 | + "url": "https://paulmerrell.org/model-synthesis/", |
| 97 | + "description": "Documentation of Paul Merrell's work on Model Synthesis." |
| 98 | + }, |
| 99 | + { |
| 100 | + "icon": "🗄", |
| 101 | + "title": "Procedural Generation with Wave Function Collapse", |
| 102 | + "url": "https://www.gridbugs.org/wave-function-collapse/", |
| 103 | + "description": "Wave Function Collapse overlapping model algorithm walk through." |
| 104 | + }, |
| 105 | + { |
| 106 | + "icon": "🗄", |
| 107 | + "title": "Wave Function Collapse", |
| 108 | + "url": "https://github.com/CodingTrain/Wave-Function-Collapse", |
| 109 | + "description": "Coding Train Github WFC repository." |
| 110 | + }, |
| 111 | + { |
| 112 | + "icon": "🔗", |
| 113 | + "title": "p5.js copy()", |
| 114 | + "url": "https://p5js.org/reference/p5/copy/", |
| 115 | + "description": "p5.js reference page for copy() function" |
| 116 | + }, |
| 117 | + { |
| 118 | + "icon": "🔗", |
| 119 | + "title": "p5.js web editor console log GitHub issue", |
| 120 | + "url": "https://github.com/processing/p5.js-web-editor/issues/3178", |
| 121 | + "description": "Issue discussing console.log and objects with circular references." |
| 122 | + }, |
| 123 | + { |
| 124 | + "icon": "🔗", |
| 125 | + "title": "JavaScript concat() method", |
| 126 | + "url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat", |
| 127 | + "description": "JavaScript documentation for array concat() method." |
| 128 | + }, |
| 129 | + { |
| 130 | + "icon": "🔗", |
| 131 | + "title": "p5.js randomSeed()", |
| 132 | + "url": "https://p5js.org/reference/p5/randomSeed/", |
| 133 | + "description": "p5.js reference page for randomSeed() function" |
| 134 | + } |
| 135 | + ] |
| 136 | + }, |
| 137 | + { |
| 138 | + "title": "Videos", |
| 139 | + "links": [ |
| 140 | + { |
| 141 | + "icon": "🎥", |
| 142 | + "title": "Pixel Array", |
| 143 | + "url": "/tracks/p5-tips-and-tricks/more-p5/pixel-array", |
| 144 | + "description": "Video tutorial on how to work with pixel array in p5.js." |
| 145 | + }, |
| 146 | + { |
| 147 | + "icon": "🎥", |
| 148 | + "title": "Modulo Operator", |
| 149 | + "url": "https://www.youtube.com/watch?v=r5Iy3v1co0A", |
| 150 | + "description": "Video tutorial with Golan Levin explaining modulo operator." |
| 151 | + }, |
| 152 | + { |
| 153 | + "icon": "🎥", |
| 154 | + "title": "Array Functions: filter() - Topics of JavaScript/ES6", |
| 155 | + "url": "/tracks/topics-in-native-javascript/js/array-filter", |
| 156 | + "description": "Video tutorial on higher order array function filter()." |
| 157 | + }, |
| 158 | + { |
| 159 | + "icon": "🎥", |
| 160 | + "title": "Arrow Function", |
| 161 | + "url": "/tracks/topics-in-native-javascript/js/arrow-functions", |
| 162 | + "description": "Video tutorial on JavaScript arrow notation." |
| 163 | + } |
| 164 | + ] |
| 165 | + }, |
| 166 | + { |
| 167 | + "title": "Creative Works Featured", |
| 168 | + "links": [ |
| 169 | + { |
| 170 | + "icon": "🎨", |
| 171 | + "title": "Townscaper", |
| 172 | + "url": "https://www.townscapergame.com/", |
| 173 | + "description": "Created by Oskar Stålberg, 3D WFC system that creates cute little houses, arches, stairways, bridges and lush backyards." |
| 174 | + }, |
| 175 | + { |
| 176 | + "icon": "🎨", |
| 177 | + "title": "unity-wave-function-collapse", |
| 178 | + "url": "https://selfsame.itch.io/unitywfc", |
| 179 | + "description": "A fork of Wave Function Collapse with tools for the Unity Game engine by @ExUtumno." |
| 180 | + }, |
| 181 | + { |
| 182 | + "icon": "🎨", |
| 183 | + "title": "Super Mario WFC", |
| 184 | + "url": "https://observablehq.com/@makio135/super-mario-wfc", |
| 185 | + "description": "Generating variations of Super Mario Bros worlds with Wave Function Collapse." |
| 186 | + }, |
| 187 | + { |
| 188 | + "icon": "🎨", |
| 189 | + "title": "Zelda WFC", |
| 190 | + "url": "https://observablehq.com/@makio135/zelda-wfc", |
| 191 | + "description": "Generating variations of Zelda maps with Wave Function Collapse." |
| 192 | + }, |
| 193 | + { |
| 194 | + "icon": "🎨", |
| 195 | + "title": "Infinite procedurally generated city", |
| 196 | + "url": "https://marian42.de/article/wfc/", |
| 197 | + "description": "a game where you walk through an infinite city that is procedurally generated as you walk." |
| 198 | + } |
| 199 | + ] |
| 200 | + } |
| 201 | + ], |
| 202 | + "credits": [ |
| 203 | + { |
| 204 | + "title": "Editing", |
| 205 | + "name": "Mathieu Blanchette" |
| 206 | + }, |
| 207 | + { |
| 208 | + "title": "Animations", |
| 209 | + "name": "Jason Heglund" |
| 210 | + } |
| 211 | + ] |
| 212 | +} |
0 commit comments