<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Comficker]]></title><description><![CDATA[Comficker]]></description><link>https://comficker.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Wed, 04 Nov 2026 06:24:16 GMT</lastBuildDate><atom:link href="https://comficker.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Wang-16 vs blob-47: how auto-tile sets actually work (and which one to draw)]]></title><description><![CDATA[Why corner sets have 16 tiles and blob sets 47 (not 256), which to draw for ground, walls and paths, and how to set them up as Godot 4 and Tiled terrains.]]></description><link>https://comficker.hashnode.dev/wang-16-vs-blob-47-how-auto-tile-sets-actually-work-and-which-one-to-draw</link><guid isPermaLink="true">https://comficker.hashnode.dev/wang-16-vs-blob-47-how-auto-tile-sets-actually-work-and-which-one-to-draw</guid><category><![CDATA[Game Development]]></category><category><![CDATA[Pixel Art]]></category><category><![CDATA[Godot]]></category><category><![CDATA[Tutorial]]></category><dc:creator><![CDATA[Hoang Lam]]></dc:creator><pubDate>Sun, 01 Nov 2026 16:07:15 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/6ae76259bb50cda4e6f3d500/2209ed3b-f167-485a-b49e-79341c7e4410.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Auto-tiling is what lets you paint "grass" or "water" on a map and have the borders sort themselves out. Under the hood every auto-tile system does the same thing: look at the neighbours of a cell, turn them into a number, and use that number to pick a tile.</p>
<p>The two layouts you will meet most are <strong>Wang-16</strong> and <strong>blob-47</strong>. They are not interchangeable. Picking the wrong one means either drawing tiles you never use or getting seams you cannot fix.</p>
<h2>Wang-16: a tile per corner combination</h2>
<p>A Wang corner set asks one question per tile corner: <em>is this corner terrain A or terrain B?</em> Four corners, two options each, gives 2⁴ = <strong>16 tiles</strong>.</p>
<p><img src="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/fjasxxn9mf6w32j3mkdk.png" alt="Wang-16 corner set" /></p>
<p>Each tile is identified by its corners, read clockwise or as a 4-bit number (NW, NE, SW, SE). The full grass tile is <code>0000</code>, the full dirt tile is <code>1111</code>, and everything in between is a transition.</p>
<p>Wang-16 works well for <strong>top-down terrain</strong>: grass meeting dirt, sand meeting water, snow meeting rock. Transitions are soft and diagonal-friendly, and you only draw 16 tiles per pair of terrains.</p>
<p>Its limit: because it only knows about corners, it cannot tell a one-tile-wide path from a thicker one. Thin features come out blobby.</p>
<h2>Blob-47: edges <em>and</em> corners</h2>
<p>A blob set looks at all <strong>8 neighbours</strong> of a cell: the four edges (N, E, S, W) and the four corners (NE, SE, SW, NW). Eight bits would mean 256 combinations, so why only 47?</p>
<p>Because most corners don't matter. A corner neighbour only changes the tile if <strong>both edges next to it are also set</strong>. If the north or east neighbour is empty, the NE neighbour is hidden behind a border anyway. Fold away the corners that can't be seen and 256 masks collapse to <strong>47 distinct tiles</strong>:</p>
<p><img src="https://dev-to-uploads.s3.us-east-2.amazonaws.com/uploads/articles/65r2jofhqb0kcymyhmb6.png" alt="Blob-47 set" /></p>
<p>The folding rule in code is three lines:</p>
<pre><code class="language-js">// bits: N=1, NE=2, E=4, SE=8, S=16, SW=32, W=64, NW=128
function canonical(mask) {
  const N = mask &amp; 1, E = mask &amp; 4, S = mask &amp; 16, W = mask &amp; 64
  if (!(N &amp;&amp; E)) mask &amp;= ~2    // NE only counts with N and E
  if (!(S &amp;&amp; E)) mask &amp;= ~8    // SE only counts with S and E
  if (!(S &amp;&amp; W)) mask &amp;= ~32   // SW only counts with S and W
  if (!(N &amp;&amp; W)) mask &amp;= ~128  // NW only counts with N and W
  return mask
}
</code></pre>
<p>Run every value from 0 to 255 through it and you get exactly 47 unique results.</p>
<p>Blob-47 is the right choice for <strong>walls, platforms, cliffs, rivers and 1-tile-wide paths</strong>: anything where inner corners and thin strips have to look deliberate. The price is drawing 47 tiles instead of 16.</p>
<h2>Which one should you draw?</h2>
<table>
<thead>
<tr>
<th></th>
<th>Wang-16 (corners)</th>
<th>Blob-47 (edges + corners)</th>
</tr>
</thead>
<tbody><tr>
<td>Tiles per terrain pair</td>
<td>16</td>
<td>47</td>
</tr>
<tr>
<td>Looks at</td>
<td>4 corners</td>
<td>8 neighbours</td>
</tr>
<tr>
<td>1-tile-wide strips</td>
<td>Blobby</td>
<td>Clean</td>
</tr>
<tr>
<td>Inner corners</td>
<td>Soft</td>
<td>Sharp, explicit</td>
</tr>
<tr>
<td>Good for</td>
<td>Top-down ground, water, sand</td>
<td>Platformer terrain, walls, cliffs, roads</td>
</tr>
<tr>
<td>Godot 4 terrain mode</td>
<td>Match Corners</td>
<td>Match Corners and Sides</td>
</tr>
<tr>
<td>Tiled Wang set type</td>
<td>Corner</td>
<td>Mixed</td>
</tr>
</tbody></table>
<p>A common setup is both: Wang-16 for the ground layer, blob-47 for walls and anything the player collides with.</p>
<h2>You don't have to draw 47 tiles by hand</h2>
<p>Most blob tiles are combinations of the same few pieces: an outer corner, an inner corner, a straight edge and the fill. Split each tile into four quarters and every quarter is one of those pieces. This is the RPG Maker "A2 autotile" trick, and it means a handful of hand-drawn pieces can generate the full 47.</p>
<p>That's the approach the tileset editor in <a href="https://simplepixelart.com/tilesets/editor">SimplePixelArt</a> uses: draw a base tile, pick Wang-16 or blob-47, and it composes every border variant for you.</p>
<h2>Getting the set into an engine</h2>
<p><strong>Godot 4:</strong> create a <code>TileSet</code>, add a terrain set with the mode from the table above, add your terrain, then paint the peering bits on each tile so they match its mask. With the bits set, the Terrains tab in the TileMap editor auto-tiles as you paint.</p>
<p><strong>Tiled:</strong> open the tileset, add a Wang set of type <em>Corner</em> (Wang-16) or <em>Mixed</em> (blob-47), add your colours, and mark each tile's corners or edges. The Terrain brush then picks tiles automatically.</p>
<p>Marking 47 tiles by hand is the tedious part, so it's worth using a tool that writes the file for you. The tileset editor above exports a Godot <code>.tres</code> with the terrain peering bits already set and a Tiled <code>.tsx</code> with the Wang set filled in.</p>
<h2>Summary</h2>
<ul>
<li><strong>Wang-16:</strong> 4 corners → 16 tiles. Soft ground transitions, cheap to draw.</li>
<li><strong>Blob-47:</strong> 8 neighbours, with hidden corners folded away → 47 tiles. Clean walls, paths and inner corners.</li>
<li>Choose by what the terrain has to do, not by tile count.</li>
</ul>
<p>If you want to try both without drawing anything first, open a free online <a href="https://simplepixelart.com/editor">pixel art editor</a>, sketch one base tile and let the tileset editor build the set. There's more <a href="https://simplepixelart.com/">pixel art</a> made with it on the site.</p>
]]></content:encoded></item></channel></rss>