<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Procedural on Nathaniel Inman</title><link>https://nathanielinman.com/tags/procedural/</link><description>Recent content in Procedural on Nathaniel Inman</description><generator>Hugo -- 0.147.7</generator><language>en-us</language><copyright>Nathaniel Inman</copyright><lastBuildDate>Sun, 21 Dec 2025 00:00:00 +0000</lastBuildDate><atom:link href="https://nathanielinman.com/tags/procedural/index.xml" rel="self" type="application/rss+xml"/><item><title>Procedural Levels with Compass</title><link>https://nathanielinman.com/procedural-levels-with-compass/</link><pubDate>Sun, 21 Dec 2025 00:00:00 +0000</pubDate><guid>https://nathanielinman.com/procedural-levels-with-compass/</guid><description>&lt;p>I spent a good chunk of last year writing about &lt;a href="https://nathanielinman.com/composition-over-configuration-compass/">compass&lt;/a>, the map-generation library with all the &lt;a href="https://nathanielinman.com/carving-terrain-like-water/">fluvial generators&lt;/a> and &lt;a href="https://nathanielinman.com/caverns-automata-and-meander/">cellular caverns&lt;/a>. The whole time I was building it as a standalone library, the real motive was to eventually drop it into a game. This month I finally did, and DET-33 now generates every one of its floors through compass.&lt;/p>
&lt;h3 id="pulling-the-library-in">Pulling the library in&lt;/h3>
&lt;p>Wiring it up was almost anticlimactic, which is the point of having spent the time on the composition layer. DET-33 pulls compass in as a git dependency and the level code just imports the scanning digger and the template data:&lt;/p></description></item><item><title>Composition Over Configuration in Compass</title><link>https://nathanielinman.com/composition-over-configuration-compass/</link><pubDate>Sun, 13 Oct 2024 00:00:00 +0000</pubDate><guid>https://nathanielinman.com/composition-over-configuration-compass/</guid><description>&lt;p>The individual generators in &lt;code>compass&lt;/code> (the &lt;a href="https://nathanielinman.com/carving-terrain-like-water/">arroyos and rivers&lt;/a>, the &lt;a href="https://nathanielinman.com/caverns-automata-and-meander/">caverns and meanders&lt;/a>) are the fun part to show off, but they aren&amp;rsquo;t what makes the library usable. The part I&amp;rsquo;m actually proud of is the composition layer that sits on top, and it owes a lot to the &lt;a href="https://nathanielinman.com/runtime-pipeline-patterns/">runtime pipeline patterns&lt;/a> I wrote about a while ago.&lt;/p>
&lt;h3 id="shapes-times-features">Shapes times features&lt;/h3>
&lt;p>Every room is described as a shape combined with a feature.&lt;/p>
&lt;ul>
&lt;li>There are 24 &lt;strong>shapes&lt;/strong>: squares and circles, but also blobs, crystalline caverns, crescents, capsules, and a handful of hallway types.&lt;/li>
&lt;li>There are 18 &lt;strong>features&lt;/strong>: pillars, islands, stepping stones, pools, moats, chasms, rubble, and four kinds of river.&lt;/li>
&lt;/ul>
&lt;p>Any shape can pair with any feature, which is 432 distinct room configurations before you&amp;rsquo;ve placed a single one. A feature is just two functions: an initialize step that works out the geometry (the meandering river feature, for example, generates a sine-wave centerline and expands around it), and a content step that decides the terrain type for each tile inside the shape. Keeping those two responsibilities separate is what lets the same river feature drop into a square room or an L-shaped hallway without caring which it landed in.&lt;/p></description></item><item><title>Caverns, Automata and the Meander Revisited</title><link>https://nathanielinman.com/caverns-automata-and-meander/</link><pubDate>Sun, 09 Jun 2024 00:00:00 +0000</pubDate><guid>https://nathanielinman.com/caverns-automata-and-meander/</guid><description>&lt;p>Back in 2015 I tackled &lt;a href="https://nathanielinman.com/automata-generated-caverns/">automata generated caverns&lt;/a> for a 7DRL, and in 2018 I wrote up the &lt;a href="https://nathanielinman.com/meander-algorithm/">meander algorithm&lt;/a> for rivers. Both made it into &lt;code>compass&lt;/code> and both got a little sharper along the way, so I wanted to revisit them with the actual implementations in hand.&lt;/p>
&lt;h3 id="caverns">Caverns&lt;/h3>
&lt;p>The cavern generator is Conway&amp;rsquo;s Game of Life pointed at a terrain problem. It&amp;rsquo;s almost embarrassing how little code it takes.&lt;/p>
&lt;ol>
&lt;li>Clone the map and randomly seed roughly 55% of it as floor.&lt;/li>
&lt;li>Run a single Game of Life pass over the Moore neighborhood (the 8 surrounding cells). An empty cell is born as floor with 5 or more floor neighbors, and an existing floor cell survives with 4 or more.&lt;/li>
&lt;li>&lt;code>clipOrphaned&lt;/code> keeps only the largest connected blob so you don&amp;rsquo;t get a dozen disconnected pockets.&lt;/li>
&lt;li>Build walls around everything walkable and force the map border to wall so the cave is sealed.&lt;/li>
&lt;/ol>
&lt;p>One pass is enough. The birth and survival thresholds are doing the smoothing that I used to iterate several times to get, and the result is the lumpy organic cave you&amp;rsquo;d expect.&lt;/p></description></item><item><title>Carving Terrain Like Water</title><link>https://nathanielinman.com/carving-terrain-like-water/</link><pubDate>Sun, 18 Feb 2024 00:00:00 +0000</pubDate><guid>https://nathanielinman.com/carving-terrain-like-water/</guid><description>&lt;p>A few years back I wrote a handful of posts about faking water on top-down maps: &lt;a href="https://nathanielinman.com/generating-2d-rivers/">generating 2d rivers&lt;/a>, &lt;a href="https://nathanielinman.com/generating-cliffs-for-2d-game/">cliffs&lt;/a>, and an &lt;a href="https://nathanielinman.com/generating-exhumed-river-channel/">exhumed river channel&lt;/a>. Those one-off experiments eventually grew into a proper map library I&amp;rsquo;ve been maintaining called &lt;code>compass&lt;/code>. Revisiting them now is fun because real-world geology already solved the &amp;ldquo;make it look natural&amp;rdquo; problem ages ago. I just borrow the names and loosely approximate the process. Here are three of the fluvial generators and how they actually work.&lt;/p></description></item></channel></rss>