Skip to content

Commit 2a3b947

Browse files
committed
adapting description, links, examples
1 parent ee5151f commit 2a3b947

File tree

5 files changed

+97
-81
lines changed

5 files changed

+97
-81
lines changed
26.8 KB
Loading
28.9 KB
Loading
15.8 KB
Loading
43.6 KB
Loading

content/videos/challenges/186-wfc-overlapping-model/index.json

Lines changed: 97 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -1,116 +1,97 @@
11
{
2-
"title": "Wave Function Collapse - Overlapping Model",
2+
"title": "Wave Function Collapse: Overlapping Model",
33
"videoNumber": "186",
4-
"description": "",
5-
"videoId": "",
6-
"nebulaSlug": "codingtrain-coding-challenge-186-wfc-overlapping-model",
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",
77
"date": "2025-01-28",
88
"languages": ["p5.js", "JavaScript"],
99
"topics": ["wave function collapse", "overlapping model", "procedural generation"],
1010
"canContribute": true,
1111
"relatedChallenges": ["171-wave-function-collapse"],
1212
"timestamps": [
1313
{ "time": "0:00:00", "title": "Introduction" },
14-
{ "time": "0:01:12", "title": "The Nature of Code" },
15-
{ "time": "0:02:20", "title": "References" },
16-
{ "time": "0:08:19", "title": "Write a function to extract tiles from a source image" },
17-
{ "time": "0:14:32", "title": "Write a function to copy tiles" },
18-
{ "time": "0:21:30", "title": "Add a list of allowed adjacencies to the Tile object" },
19-
{ "time": "0:24:34", "title": "Write an overlapping() function" },
20-
{ "time": "0:32:20", "title": "Look at the first tile's neighbors" },
21-
{ "time": "0:43:30", "title": "Add a Cell class" },
22-
{ "time": "0:44:15", "title": "Add a grid of Cells" },
23-
{ "time": "0:46:21", "title": "Retrieve previous WFC code" },
24-
{ "time": "0:50:50", "title": "Write a reduceEntropy() function" },
25-
{ "time": "0:55:56", "title": "Add a function to render the center pixel" },
26-
{ "time": "0:58:05", "title": "Filter by the valid options" },
27-
{ "time": "1:01:57", "title": "Use recursion to reduce entropy" },
28-
{ "time": "1:05:32", "title": "Add depth of recursion" },
29-
{ "time": "1:06:32", "title": "We have WFC!" },
30-
{ "time": "1:09:42", "title": "Fix mistake" },
31-
{ "time": "1:11:26", "title": "Start refactoring code" },
32-
{ "time": "1:18:41", "title": "Add a console.log if alogrithm gets stuck" },
33-
{ "time": "1:21:38", "title": "Optimizations" },
34-
{ "time": "1:26:28", "title": "Discuss redundant tiles" },
35-
{ "time": "1:28:30", "title": "Rotations and Reflections" },
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" },
3637
{ "time": "1:29:39", "title": "Additional performance optimizations" },
37-
{ "time": "1:31:40", "title": "Outro" }
38+
{ "time": "1:31:40", "title": "Thanks for watching!" }
3839
],
3940
"codeExamples": [
4041
{
41-
"title": "WFC Overlapping",
42-
"description": "The sketch implements the overlapping model.",
43-
"image": "1.png",
42+
"title": "Wave Function Collapse: Overlapping Model",
43+
"description": "Unoptimized code exactly matching the video.",
44+
"image": "wfc.png",
4445
"urls": {
45-
"p5": "https://editor.p5js.org/codingtrain/sketches/PX0Hn6TF8"
46+
"p5": "https://editor.p5js.org/codingtrain/sketches/SI0c2D_tQ"
4647
}
4748
},
4849
{
49-
"title": "WFC Overlapping - Shannon entropy",
50-
"description": "This sketch adds Shannon entropy.",
51-
"image": "1.png",
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",
5261
"urls": {
5362
"p5": "https://editor.p5js.org/codingtrain/sketches/PX0Hn6TF8"
5463
}
5564
},
5665
{
57-
"title": "WFC Overlapping - Rotations and Reflections",
66+
"title": "WFC Overlapping Model: More tiles!",
5867
"description": "This sketch adds tile rotations and reflections",
59-
"image": "1.png",
68+
"image": "wfc_rot_reflect.png",
6069
"urls": {
6170
"p5": "https://editor.p5js.org/codingtrain/sketches/z_N2TVjRH"
6271
}
63-
},
64-
{
65-
"title": "WFC Overlapping - Restart",
66-
"description": "This sketch restarts WFC if there are no more valid choices.",
67-
"image": "1.png",
68-
"urls": {
69-
"p5": "https://editor.p5js.org/codingtrain/sketches/2sV4KtcoD"
70-
}
71-
},
72-
{
73-
"title": "WFC Overlapping - Refactored",
74-
"description": "This sketch refactors the code and adds performance enhancements.",
75-
"image": "1.png",
76-
"urls": {
77-
"p5": "https://editor.p5js.org/codingtrain/sketches/paJcuQLI0"
78-
}
79-
}
72+
}
8073
],
8174
"groupLinks": [
8275
{
8376
"title": "References",
8477
"links": [
85-
{
86-
"icon": "📕",
87-
"title": "The Nature of Code",
88-
"url": "https://natureofcode.com/",
89-
"description": "The Nature of Code book (2024 p5.js edition)"
90-
},
91-
{
92-
"icon": "🛒",
93-
"title": "Nature of Code shop",
94-
"url": "https://store.natureofcode.com/products/the-nature-of-code",
95-
"description": "The Nature of Code book (2024 p5.js edition) is now available for purchase!"
96-
},
9778
{
9879
"icon": "🗄",
99-
"title": "Wave Function Collapse Algorithm",
80+
"title": "Wave Function Collapse GitHub Repo",
10081
"url": "https://github.com/mxgmn/WaveFunctionCollapse",
101-
"description": "The original GitHub repository from mxgmn for the Wave Function Collapse algorithm."
82+
"description": "Maxim Gumin's source code and documentation for Wave Function Collapse."
10283
},
10384
{
10485
"icon": "🗄",
10586
"title": "Model Synthesis",
10687
"url": "https://paulmerrell.org/model-synthesis/",
107-
"description": "Paul Merrell's 2009 PhD Thesis that is a predecessor to WFC."
88+
"description": "Documentation of Paul Merrell's work on Model Synthesis."
10889
},
10990
{
11091
"icon": "🗄",
11192
"title": "Procedural Generation with Wave Function Collapse",
11293
"url": "https://www.gridbugs.org/wave-function-collapse/",
113-
"description": "Article on using WFC for procedural generation."
94+
"description": "Wave Function Collapse overlapping model algorithm walk through."
11495
},
11596
{
11697
"icon": "🗄",
@@ -120,27 +101,27 @@
120101
},
121102
{
122103
"icon": "🔗",
123-
"title": "p5 copy()",
104+
"title": "p5.js copy()",
124105
"url": "https://p5js.org/reference/p5/copy/",
125-
"description": "Reference for the copy function"
106+
"description": "p5.js reference page for copy() function"
126107
},
127108
{
128109
"icon": "🔗",
129-
"title": "Github issue RE console.log problem",
110+
"title": "p5.js web editor console log GitHub issue",
130111
"url": "https://github.com/processing/p5.js-web-editor/issues/3178",
131-
"description": "Cannot console.log objects having circular references."
112+
"description": "Issue discussing console.log and objects with circular references."
132113
},
133114
{
134115
"icon": "🔗",
135-
"title": "concat() function",
116+
"title": "JavaScript concat() method",
136117
"url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/concat",
137-
"description": "Reference for the concat function."
118+
"description": "JavaScript documentation for array concat() method."
138119
},
139120
{
140121
"icon": "🔗",
141-
"title": "randomSeed()",
122+
"title": "p5.js randomSeed()",
142123
"url": "https://p5js.org/reference/p5/randomSeed/",
143-
"description": "Reference for the randomSeed function"
124+
"description": "p5.js reference page for randomSeed() function"
144125
}
145126
]
146127
},
@@ -151,25 +132,60 @@
151132
"icon": "🎥",
152133
"title": "Pixel Array",
153134
"url": "/tracks/p5-tips-and-tricks/more-p5/pixel-array",
154-
"description": "Coding Train video with explanation of tracking 2D grid in 1D array (for pixels)."
135+
"description": "Video tutorial on how to work with pixel array in p5.js."
155136
},
156137
{
157138
"icon": "🎥",
158139
"title": "Modulo Operator",
159140
"url": "https://www.youtube.com/watch?v=r5Iy3v1co0A",
160-
"description": "Golan Levin explains what modulus means and its applications in creative coding with p5.js and Processing."
141+
"description": "Video tutorial with Golan Levin explaining modulo operator."
161142
},
162143
{
163144
"icon": "🎥",
164145
"title": "Array Functions: filter() - Topics of JavaScript/ES6",
165146
"url": "/tracks/topics-in-native-javascript/js/array-filter",
166-
"description": "This video covers the JavaScript Array higher order function filter()."
147+
"description": "Video tutorial on higher order array function filter()."
167148
},
168149
{
169150
"icon": "🎥",
170151
"title": "Arrow Function",
171152
"url": "/tracks/topics-in-native-javascript/js/arrow-functions",
172-
"description": "Coding Train video covering JavaScript arrow (=>) function."
153+
"description": "Video tutorial on JavaScript arrow notation."
154+
}
155+
]
156+
},
157+
{
158+
"title": "Creative Works Featured",
159+
"links": [
160+
{
161+
"icon": "🎨",
162+
"title": "Townscaper",
163+
"url": "https://www.townscapergame.com/",
164+
"description": "Created by Oskar Stålberg, 3D WFC system that creates cute little houses, arches, stairways, bridges and lush backyards."
165+
},
166+
{
167+
"icon": "🎨",
168+
"title": "unity-wave-function-collapse",
169+
"url": "https://selfsame.itch.io/unitywfc",
170+
"description": "A fork of Wave Function Collapse with tools for the Unity Game engine by @ExUtumno."
171+
},
172+
{
173+
"icon": "🎨",
174+
"title": "Super Mario WFC",
175+
"url": "https://observablehq.com/@makio135/super-mario-wfc",
176+
"description": "Generating variations of Super Mario Bros worlds with Wave Function Collapse."
177+
},
178+
{
179+
"icon": "🎨",
180+
"title": "Zelda WFC",
181+
"url": "https://observablehq.com/@makio135/zelda-wfc",
182+
"description": "Generating variations of Zelda maps with Wave Function Collapse."
183+
},
184+
{
185+
"icon": "🎨",
186+
"title": "Infinite procedurally generated city",
187+
"url": "https://marian42.de/article/wfc/",
188+
"description": "a game where you walk through an infinite city that is procedurally generated as you walk."
173189
}
174190
]
175191
}

0 commit comments

Comments
 (0)