<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Projects on Nibbleblog</title><link>https://nibble.blog/projects/</link><description>Recent content in Projects on Nibbleblog</description><generator>Hugo -- gohugo.io</generator><language>en-us</language><copyright>Ясен Динков 2022</copyright><atom:link href="https://nibble.blog/projects/index.xml" rel="self" type="application/rss+xml"/><item><title>Glass Bead</title><link>https://nibble.blog/projects/glass-bead/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://nibble.blog/projects/glass-bead/</guid><description>&lt;p&gt;A daily word-association game. You get eight words in a circle and have to connect them in the right order. Wrong guesses and hints add time to your score.&lt;/p&gt;
&lt;p&gt;The frontend is plain JavaScript. The backend handles games and leaderboards in ASP.NET Core, with Azure Table Storage. You can also sign in with Bluesky to compare scores.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Built with:&lt;/strong&gt; .NET 8, JavaScript, Azure Table Storage.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://glassbead.games/"target="_blank" rel="noopener noreferrer"&gt;Play Glass Bead&lt;/a&gt;
&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Does it Spread</title><link>https://nibble.blog/projects/does-it-spread/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://nibble.blog/projects/does-it-spread/</guid><description>&lt;p&gt;A short point-and-click puzzle game made for Pirate Software Game Jam 14. I put it together in about eleven hours.&lt;/p&gt;
&lt;p&gt;Made with Godot 4.2, Krita, Paint.NET, LMMS and Audacity.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://nibblebit.itch.io/does-it-spread"target="_blank" rel="noopener noreferrer"&gt;Download on itch.io&lt;/a&gt;
&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Seasons</title><link>https://nibble.blog/projects/seasons/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://nibble.blog/projects/seasons/</guid><description>&lt;p&gt;A short adventure about travelling between parallel timelines to solve puzzles. Made for the Summer Fediverse Jam in 2023.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s a Godot game, with a Windows download on itch.io.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://nibblebit.itch.io/seasons"target="_blank" rel="noopener noreferrer"&gt;Download on itch.io&lt;/a&gt;
&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/ydinkov/Seasons"target="_blank" rel="noopener noreferrer"&gt;Source on GitHub&lt;/a&gt;
&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Creddy</title><link>https://nibble.blog/projects/creddy/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://nibble.blog/projects/creddy/</guid><description>&lt;p&gt;A browser app for keeping track of store credit, shared spending, cards and cashback rules.&lt;/p&gt;
&lt;p&gt;The PWA is built in Blazor WebAssembly. Programs can be kept in browser storage or use a Google Sheets source. The cloud-connected side is still a work in progress.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Built with:&lt;/strong&gt; C#, .NET 10, Blazor WebAssembly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://creddy.asdf.tools/"target="_blank" rel="noopener noreferrer"&gt;Open Creddy&lt;/a&gt;
&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>ASDF Tools</title><link>https://nibble.blog/projects/asdf-tools/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://nibble.blog/projects/asdf-tools/</guid><description>&lt;p&gt;A bunch of small web tools that don&amp;rsquo;t really need a home of their own.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s a countdown timer, QR-code generator, graph visualizer, connection-string converter and a few others. Most are standalone HTML, CSS and JavaScript pages.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://asdf.tools/"target="_blank" rel="noopener noreferrer"&gt;Browse ASDF Tools&lt;/a&gt;
&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Dialogative</title><link>https://nibble.blog/projects/dialogative/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://nibble.blog/projects/dialogative/</guid><description>&lt;p&gt;A .NET library for writing dialogue trees in YAML. It handles branching options, conditions and updates to game state. Expressions use Power Fx.&lt;/p&gt;
&lt;p&gt;It&amp;rsquo;s on NuGet, and the repository has examples.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Built with:&lt;/strong&gt; C#, .NET 10, YAML, Power Fx.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/ydinkov/Dialogative"target="_blank" rel="noopener noreferrer"&gt;Source and examples&lt;/a&gt;
&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://www.nuget.org/packages/Dialogative/"target="_blank" rel="noopener noreferrer"&gt;NuGet package&lt;/a&gt;
&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>SpriteCombiner</title><link>https://nibble.blog/projects/spritecombiner/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://nibble.blog/projects/spritecombiner/</guid><description>&lt;p&gt;A small command-line tool for combining individual images into a sprite sheet. The source images are named with their X and Y positions, and the tool assembles them into one image.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s a Windows download on itch.io, along with the source on GitHub.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Built with:&lt;/strong&gt; C#, .NET.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://nibblebit.itch.io/spritecombiner"target="_blank" rel="noopener noreferrer"&gt;Download on itch.io&lt;/a&gt;
&lt;/strong&gt; · &lt;strong&gt;&lt;a href="https://github.com/ydinkov/SpriteCombiner"target="_blank" rel="noopener noreferrer"&gt;Source on GitHub&lt;/a&gt;
&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Spirit Games</title><link>https://nibble.blog/projects/spirit-games/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://nibble.blog/projects/spirit-games/</guid><description>&lt;p&gt;A website where I keep my game-development projects. It links to games and tools, the Nibblebit Challenge and Spawn Point, a beginner Godot webinar.&lt;/p&gt;
&lt;p&gt;The site is plain HTML, CSS and JavaScript.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://spirit.games/"target="_blank" rel="noopener noreferrer"&gt;Visit Spirit Games&lt;/a&gt;
&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Godot Games: Defending Against Reupload Scams</title><link>https://nibble.blog/posts/godotcon-2026-clone-wars-reupload-scams/</link><pubDate>Thu, 04 Jun 2026 12:00:00 +0200</pubDate><guid>https://nibble.blog/posts/godotcon-2026-clone-wars-reupload-scams/</guid><description>&lt;p&gt;At &lt;strong&gt;GodotCon Amsterdam 2026&lt;/strong&gt;, I gave a talk called &lt;strong&gt;The Clone Wars: Defending Godot Games From Reupload Scams&lt;/strong&gt;. It was about something nobody wants to put on their game-dev roadmap: people stealing your game and pretending it&amp;rsquo;s theirs.&lt;/p&gt;
&lt;p&gt;Godot is open, accessible, and makes it wonderfully easy to get games into people&amp;rsquo;s hands. Unfortunately, exporting a game also puts a lot of its guts into other people&amp;rsquo;s hands. Some of those people are curious modders or researchers. Others are interested in repackaging somebody else&amp;rsquo;s work, publishing it under a new name, or tricking players into buying the wrong game.&lt;/p&gt;
&lt;p&gt;The talk was partly about thinking like a security engineer. But the point I really wanted developers to take away was less technical:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Protecting your game&amp;rsquo;s identity often matters more than protecting its binaries.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Since the talk, developments in AI-assisted reverse engineering have only made that distinction more important.&lt;/p&gt;
&lt;h2 id="you-cant-protect-what-you-distribute"&gt;You can&amp;rsquo;t protect what you distribute&lt;/h2&gt;
&lt;p&gt;When we think about securing a game, our instinct is to reach for technical barriers: encrypted assets, obfuscated scripts, license checks, anti-tampering systems. If we can make the build sufficiently difficult to take apart, surely that&amp;rsquo;s a win?&lt;/p&gt;
&lt;p&gt;Sometimes it is. Those techniques introduce friction, and friction can discourage opportunistic abuse. But the player controls the computer running the game. Somewhere, the game has to load its assets, execute its logic, and render its output. A sufficiently motivated person can observe and inspect those things.&lt;/p&gt;
&lt;p&gt;Consider an encrypted asset pack. It&amp;rsquo;s useful for discouraging casual extraction, but your game still needs to decrypt the assets to use them. If the threat is somebody willing to investigate the running process, encryption isn&amp;rsquo;t an absolute barrier. It&amp;rsquo;s one more cost imposed on the attacker.&lt;/p&gt;
&lt;p&gt;That is a perfectly respectable thing to do, provided we remember the difference between &lt;strong&gt;making copying harder&lt;/strong&gt; and &lt;strong&gt;making copying impossible&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;And there&amp;rsquo;s an uncomfortable twist: the cost of understanding an unfamiliar piece of software is changing.&lt;/p&gt;
&lt;h2 id="ai-has-changed-the-economics-of-reverse-engineering"&gt;AI has changed the economics of reverse engineering&lt;/h2&gt;
&lt;p&gt;When I prepared the original talk, using AI to reverse engineer an entire game was possible in principle, but often impractical or prohibitively expensive. That is no longer a safe assumption.&lt;/p&gt;
&lt;p&gt;By October 2026, agentic tools can connect coding models to established reverse-engineering systems such as Ghidra or IDA, helping inspect binaries, follow function calls, and test hypotheses about program behaviour. &lt;a href="https://www.infoq.com/news/2026/10/reverse-engineer-anything/"target="_blank" rel="noopener noreferrer"&gt;InfoQ&amp;rsquo;s coverage of Reverse Engineer Anything&lt;/a&gt;
is one example of this shift.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s not oversell it. An AI model cannot reliably swallow any random executable and spit out a flawless, legally unencumbered recreation. Reconstructing a large game still takes effort, verification, and specialist knowledge.&lt;/p&gt;
&lt;p&gt;But the direction is clear: tasks that once required hours of tedious manual investigation are becoming easier to automate or accelerate. That lowers the cost of making an imitation, even when the imitation is imperfect.&lt;/p&gt;
&lt;p&gt;If your protection strategy depends on somebody finding your implementation too difficult or expensive to understand, it may have a shorter shelf life than you think.&lt;/p&gt;
&lt;h2 id="the-case-for-an-authoritative-server"&gt;The case for an authoritative server&lt;/h2&gt;
&lt;p&gt;One strong response is to stop shipping everything that makes your game valuable.&lt;/p&gt;
&lt;p&gt;If important game logic, persistent state, or decisions live on a server you operate, an attacker can&amp;rsquo;t simply extract those implementations from the downloadable client. For a multiplayer game, a server-authoritative design also helps prevent clients from inventing their own version of the truth.&lt;/p&gt;
&lt;p&gt;Godot provides &lt;a href="https://docs.godotengine.org/en/stable/tutorials/networking/high_level_multiplayer.html"target="_blank" rel="noopener noreferrer"&gt;high-level multiplayer building blocks&lt;/a&gt;
that can support this kind of architecture. The security comes from the decisions your server actually controls and validates, not merely from having a network connection.&lt;/p&gt;
&lt;p&gt;There are trade-offs. Servers cost money and require maintenance. Connectivity introduces latency, operational work, and a dependency on the developer keeping the service alive. For a single-player indie game, always-online DRM can end up being a worse experience for legitimate players than for the people you&amp;rsquo;re trying to stop.&lt;/p&gt;
&lt;p&gt;And even an authoritative server doesn&amp;rsquo;t stop somebody from looking at your game, learning its visible rules, and building a similar experience independently.&lt;/p&gt;
&lt;p&gt;So yes: keeping genuinely sensitive mechanics on an authoritative server is a powerful tool &lt;strong&gt;where that architecture fits the game&lt;/strong&gt;. It isn&amp;rsquo;t a magic anti-clone button.&lt;/p&gt;
&lt;h2 id="make-something-recognisable-not-merely-difficult-to-copy"&gt;Make something recognisable, not merely difficult to copy&lt;/h2&gt;
&lt;p&gt;Here&amp;rsquo;s the more interesting question: &lt;strong&gt;what makes your game unmistakably yours?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;A distinctive visual language. A particular rhythm to its mechanics. Characters, humor, writing, sound, and a world that people remember. None of these elements is individually immune to imitation. Game mechanics aren&amp;rsquo;t automatically protected just because they&amp;rsquo;re clever, and an artistic style alone doesn&amp;rsquo;t guarantee legal exclusivity.&lt;/p&gt;
&lt;p&gt;But a coherent creative identity has an advantage that obfuscated code doesn&amp;rsquo;t: players can recognise it.&lt;/p&gt;
&lt;p&gt;Imagine two games with superficially similar mechanics. One is a pile of features; the other has a recognisable world, art direction, voice, and relationship with its players. A copycat may be able to reproduce a feature, but reproducing the &lt;em&gt;whole identity&lt;/em&gt; convincingly is a different challenge.&lt;/p&gt;
&lt;p&gt;In other words: don&amp;rsquo;t just make something hard to steal. Make something you&amp;rsquo;re uniquely well placed to keep making.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s a production advantage too. Ideally you develop a visual language and design vocabulary that&amp;rsquo;s hard for outsiders to imitate convincingly, yet easy for &lt;strong&gt;your own team&lt;/strong&gt; to keep extending. Good tools, reusable assets, and clear creative direction let the original evolve faster and more consistently.&lt;/p&gt;
&lt;h2 id="the-boring-stuff-is-surprisingly-effective"&gt;The boring stuff is surprisingly effective&lt;/h2&gt;
&lt;p&gt;Developers love technical puzzles. Marketing, community building, store listings, publication records, and trademark research? A considerably tougher sell.&lt;/p&gt;
&lt;p&gt;Unfortunately, that less glamorous work is often better aligned with the actual problem of a &lt;strong&gt;reupload scam&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;Suppose somebody republishes your build under a different name. Encryption might not help once the build has escaped. But an established official site, recognisable branding, public release history, and direct channels to your players all make it easier to identify the original and report an impersonator.&lt;/p&gt;
&lt;p&gt;There are practical things worth doing before you spend months designing exotic anti-tampering measures:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Keep a clear official website and link to your legitimate store pages.&lt;/li&gt;
&lt;li&gt;Build relationships with players through communities, newsletters, or other channels you control.&lt;/li&gt;
&lt;li&gt;Preserve release dates, source files, artwork, and records of who created what.&lt;/li&gt;
&lt;li&gt;Check names and marks before launch, and understand which copyright or trademark protections may apply.&lt;/li&gt;
&lt;li&gt;Learn how the platforms you distribute on handle copyright complaints and impersonation reports.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The &lt;a href="https://www.wipo.int/cooperation/en/docs/ip-video-games.pdf"target="_blank" rel="noopener noreferrer"&gt;World Intellectual Property Organization&amp;rsquo;s guide to IP in video games&lt;/a&gt;
is a useful introduction to the distinctions between copyright, trademarks, and other rights. Actual protection and enforcement depend on the jurisdiction and facts; none of this replaces legal advice.&lt;/p&gt;
&lt;p&gt;None of these activities makes the executable impossible to copy. What they do is make it harder for somebody else to &lt;strong&gt;pass their copy off as the original&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;That&amp;rsquo;s a different problem, and it&amp;rsquo;s the one many reupload scams actually exploit.&lt;/p&gt;
&lt;h2 id="protect-against-the-threat-you-actually-face"&gt;Protect against the threat you actually face&lt;/h2&gt;
&lt;p&gt;Before adding a technical safeguard, ask which attack you&amp;rsquo;re defending against.&lt;/p&gt;
&lt;p&gt;Someone redistributing your original build? Extracting assets? Impersonating your studio? Recreating visible mechanics? Cheating in an online game? Those aren&amp;rsquo;t interchangeable threats, and their mitigations shouldn&amp;rsquo;t be interchangeable either.&lt;/p&gt;
&lt;p&gt;For a multiplayer economy, server authority and validation may be essential. For an asset-theft problem, keeping evidence and making platform reports may matter more. For a counterfeit store listing, a recognisable brand and clear official distribution channels are especially valuable.&lt;/p&gt;
&lt;p&gt;The right answer is usually a mix of proportionate technical friction, sensible architecture, and good old-fashioned creative and commercial work.&lt;/p&gt;
&lt;p&gt;There are lessons here from enterprise security, but I promise I didn&amp;rsquo;t come to a game-development conference to sell anyone an ISO audit.&lt;/p&gt;
&lt;h2 id="make-the-original-matter"&gt;Make the original matter&lt;/h2&gt;
&lt;p&gt;AI is making software easier to inspect, understand, and reproduce. I don&amp;rsquo;t think that means security engineering is pointless. It means we should stop expecting technical obstacles alone to carry the full weight of protecting our work.&lt;/p&gt;
&lt;p&gt;Use them where they address a real threat. Put valuable decisions on a server when that fits the game. But also invest in the parts that give players a reason to seek out &lt;strong&gt;your&lt;/strong&gt; version rather than an imitation.&lt;/p&gt;
&lt;p&gt;Make your game distinctive. Make its creator identifiable. Make the legitimate version easy to find. And make it possible to keep building on what makes it yours.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The strongest defence against somebody copying your game might be giving people a reason to care about the original.&lt;/strong&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;This article expands on my GodotCon Amsterdam talk with reflections added in October 2026, particularly on AI-assisted reverse engineering.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.youtube.com/watch?v=CNBdxjWf8Fo"target="_blank" rel="noopener noreferrer"&gt;Watch The Clone Wars: Defending Godot Games From Reupload Scams — GodotCon Amsterdam 2026&lt;/a&gt;
&lt;/strong&gt;. The recording was published on June 3, 2026.&lt;/p&gt;</description></item><item><title>Tilesets and Makefiles Part 4: Less is more</title><link>https://nibble.blog/posts/tilesets_4/</link><pubDate>Thu, 18 Dec 2025 22:25:12 +0100</pubDate><guid>https://nibble.blog/posts/tilesets_4/</guid><description>&lt;p&gt;Previously we added some shading to our height maps. But in order to give our sets more character, we want to able to adjust the feel of the template more easily. That means fewer tiles to edit for a revision.&lt;/p&gt;
&lt;figure&gt;
&lt;img src="../tilesets_4/7b4f3620baf980596f49dfdcde6b91399052785f.gif"
class="wikilink" alt="MiniTemplate.gif" /&gt;
&lt;/figure&gt;
&lt;p&gt;Our template was set up nice for variation. Nice and big with a ton of duplication for variations. However I&amp;rsquo;m making levels for different platforms, like &lt;a href="%5BUsing%20TileSets%20%e2%80%94%20Godot%20Engine%20%28stable%29%20documentation%20in%20English%5D%28https://docs.godotengine.org/en/stable/tutorials/2d/using_tilesets.html#creating-terrain-sets-autotiling%29"&gt;Godot&lt;/a&gt;
and &lt;a href="https://www.gbstudio.dev/docs/assets/backgrounds#size-requirements"target="_blank" rel="noopener noreferrer"&gt;GBStudio&lt;/a&gt;
)
These have all kinds of funky requriements. So from now on, we are distilling our terrain set to the bone so we can generate whatever type of template we want.&lt;/p&gt;
&lt;p&gt;Today we will radically reduce our template to only the essential information, that we will use to generate a minimal template.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s start out with reconfiguring the overlays to draw 32x32 sized tiles&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-makefile" data-lang="makefile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;%-overlays&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;convert&lt;/span&gt; &lt;span class="err"&gt;input/textures/&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;call&lt;/span&gt; &lt;span class="nv"&gt;TEXTURE&lt;/span&gt;,&lt;span class="k"&gt;$&lt;/span&gt;*,&lt;span class="nv"&gt;floor&lt;/span&gt;,&lt;span class="nv"&gt;value&lt;/span&gt;.&lt;span class="nv"&gt;file&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        &lt;span class="err"&gt;-filter&lt;/span&gt; &lt;span class="err"&gt;point&lt;/span&gt; &lt;span class="err"&gt;-resize&lt;/span&gt; &lt;span class="err"&gt;32x32&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        &lt;span class="nf"&gt;-write mpr&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;tile&lt;/span&gt; +&lt;span class="n"&gt;delete&lt;/span&gt; \
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        -&lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;width&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;height&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="n"&gt;tile&lt;/span&gt;:&lt;span class="n"&gt;mpr&lt;/span&gt;:&lt;span class="n"&gt;tile&lt;/span&gt; \
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;call&lt;/span&gt; &lt;span class="nv"&gt;TEXTURE&lt;/span&gt;,&lt;span class="k"&gt;$&lt;/span&gt;*,&lt;span class="nv"&gt;floor&lt;/span&gt;,&lt;span class="nv"&gt;key&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;-&lt;span class="n"&gt;overlay&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;       
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;convert&lt;/span&gt; &lt;span class="err"&gt;input/textures/&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;call&lt;/span&gt; &lt;span class="nv"&gt;TEXTURE&lt;/span&gt;,&lt;span class="k"&gt;$&lt;/span&gt;*,&lt;span class="nv"&gt;border&lt;/span&gt;,&lt;span class="nv"&gt;value&lt;/span&gt;.&lt;span class="nv"&gt;file&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        &lt;span class="err"&gt;-filter&lt;/span&gt; &lt;span class="err"&gt;point&lt;/span&gt; &lt;span class="err"&gt;-resize&lt;/span&gt; &lt;span class="err"&gt;32x32&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        &lt;span class="nf"&gt;-write mpr&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;tile&lt;/span&gt; +&lt;span class="n"&gt;delete&lt;/span&gt; \
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        -&lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;width&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;height&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="n"&gt;tile&lt;/span&gt;:&lt;span class="n"&gt;mpr&lt;/span&gt;:&lt;span class="n"&gt;tile&lt;/span&gt; \
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;call&lt;/span&gt; &lt;span class="nv"&gt;TEXTURE&lt;/span&gt;,&lt;span class="k"&gt;$&lt;/span&gt;*,&lt;span class="nv"&gt;border&lt;/span&gt;,&lt;span class="nv"&gt;key&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;-&lt;span class="n"&gt;overlay&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;convert&lt;/span&gt; &lt;span class="err"&gt;input/textures/&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;call&lt;/span&gt; &lt;span class="nv"&gt;TEXTURE&lt;/span&gt;,&lt;span class="k"&gt;$&lt;/span&gt;*,&lt;span class="nv"&gt;transition&lt;/span&gt;,&lt;span class="nv"&gt;value&lt;/span&gt;.&lt;span class="nv"&gt;file&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        &lt;span class="err"&gt;-filter&lt;/span&gt; &lt;span class="err"&gt;point&lt;/span&gt; &lt;span class="err"&gt;-resize&lt;/span&gt; &lt;span class="err"&gt;32x32&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        &lt;span class="nf"&gt;-write mpr&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;tile&lt;/span&gt; +&lt;span class="n"&gt;delete&lt;/span&gt; \
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        -&lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;width&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;height&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="n"&gt;tile&lt;/span&gt;:&lt;span class="n"&gt;mpr&lt;/span&gt;:&lt;span class="n"&gt;tile&lt;/span&gt; \
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;        &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;call&lt;/span&gt; &lt;span class="nv"&gt;TEXTURE&lt;/span&gt;,&lt;span class="k"&gt;$&lt;/span&gt;*,&lt;span class="nv"&gt;transition&lt;/span&gt;,&lt;span class="nv"&gt;key&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;-&lt;span class="n"&gt;overlay&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h2 id="reduction"&gt;Reduction&lt;/h2&gt;
&lt;p&gt;The original meta-template was based on a 15 tile set with different rotations. Those tiles act as a MIXED tileset in Tiled. Earlier I reduced the tilesize from 64x64 pixels to 32x32 on the same scale, so that i could use them as a Corner terrain set instead.&lt;/p&gt;
&lt;p&gt;If we cut up our template to those 32x32 tiles we can reduce the tile to 14 unique tiles without rotations.&lt;/p&gt;
&lt;figure&gt;
&lt;img src="../tilesets_4/d08ff62afcf9b8e840e1b41f2e913ababeccce75.png"
class="wikilink" alt="Pastedimage20251208114159.png" /&gt;
&lt;/figure&gt;
&lt;p&gt;Let&amp;rsquo;s index the first occurances of each tile&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;[0,0]&lt;/li&gt;
&lt;li&gt;[1,0]&lt;/li&gt;
&lt;li&gt;[7,0]&lt;/li&gt;
&lt;li&gt;[1,1]&lt;/li&gt;
&lt;li&gt;[2,1]&lt;/li&gt;
&lt;li&gt;[4,1]&lt;/li&gt;
&lt;li&gt;[5,1]&lt;/li&gt;
&lt;li&gt;[7,1]&lt;/li&gt;
&lt;li&gt;[8,1]&lt;/li&gt;
&lt;li&gt;[1,2]&lt;/li&gt;
&lt;li&gt;[2,4]&lt;/li&gt;
&lt;li&gt;[14,5]&lt;/li&gt;
&lt;li&gt;[15,5]&lt;/li&gt;
&lt;li&gt;[0,10]&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Now let&amp;rsquo;s cut them up once with a bash script&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;INPUT=&amp;quot;tilesheet.png&amp;quot;
TILE=32
coords=(
&amp;quot;0,0&amp;quot;
&amp;quot;1,0&amp;quot;
&amp;quot;7,0&amp;quot;
# etc...
)
i=1
for coord in &amp;quot;${coords[@]}&amp;quot;; do
IFS=, read tx ty &amp;lt;&amp;lt;&amp;lt; &amp;quot;$coord&amp;quot;
x=$((tx*TILE))
y=$((ty*TILE))
# e.g. tile-01-0_0.png, tile-02-1_0.png, etc.
out=$(printf &amp;quot;tile-%02d-%d_%d.png&amp;quot; &amp;quot;$i&amp;quot; &amp;quot;$tx&amp;quot; &amp;quot;$ty&amp;quot;)
convert &amp;quot;$INPUT&amp;quot; -crop &amp;quot;${TILE}x${TILE}+${x}+${y}&amp;quot; +repage &amp;quot;$out&amp;quot;
i=$((i+1))
done
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now we can combine them in a 4x4 grid with a simple montage:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;montage tiles/tile-*.png -tile 4x4 -geometry 32x32+0+0 -background none tiles-grid-4x4.png
&lt;/code&gt;&lt;/pre&gt;
&lt;figure&gt;
&lt;img src="../tilesets_4/98bdb0ff83e22c0cb41aef8668e0bb8c5089be75.png"
class="wikilink" alt="Pastedimage20251208120948.png" /&gt;
&lt;/figure&gt;
&lt;p&gt;Nice! This will be our prime template and we can already see some jagged inconsitencies.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Later i discovered that tile 4 and 10 are the same, but i can&amp;rsquo;t be bothered to redraw the whole thing. Think of these errors as little paper town drm.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;After rearranging the template and cleaning it up re end up with this meta template&lt;/p&gt;
&lt;figure&gt;
&lt;img src="../tilesets_4/a6b00d5a458af93a28263326666700d0d21592dd.png"
class="wikilink" alt="Pastedimage20251208123246.png" /&gt;
&lt;/figure&gt;
&lt;p&gt;Here we removed tile 8 and 15 (the full floor and full border tiles), because they take space and can be generate programatically. Alternatively we allow ourselves some duplication to reveal a closed object containing all tiles.&lt;/p&gt;
&lt;p&gt;If we are really crazy we can reduce this template even further and mirror it along the y axis, reducing our entire proto template evern further to just 8 tiles.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s first mirror it with a magick flop&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;convert mini-template-left.png -flop mini-template-right.png
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And we replace the colors&lt;/p&gt;
&lt;p&gt;Green to Blue:
#002200 =&amp;gt; #000022
#004400 =&amp;gt; #000044
#006600 =&amp;gt; #000066&lt;/p&gt;
&lt;p&gt;Blue to Green
#000044 =&amp;gt; #004400
#000088 =&amp;gt; #008800&lt;/p&gt;
&lt;p&gt;Yellow to khaki
#444400 =&amp;gt; #888800&lt;/p&gt;
&lt;p&gt;We will have to use some intermediate colors in the #ff0 range so the greens don&amp;rsquo;t overwrite the blues&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;convert mini-template-right.png &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#ff0101&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#002200&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#ff0202&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#004400&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#ff0303&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#006600&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#ff0404&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#000044&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#ff0505&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#000088&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#ff0606&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#444400&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#ff0707&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#888800&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#000022&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#ff0101&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#000044&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#ff0202&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#000066&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#ff0303&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#004400&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#ff0404&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#008800&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#ff0505&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#888800&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#ff0606&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#444400&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#ff0707&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; mini-template-right.png
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;And we montage the two together&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-bash" data-lang="bash"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;montage mini-template-*.png -tile 2x1 -geometry 64x128+0+0 final-mini-template.png
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Why don&amp;rsquo;t we just make it a makefile target. I&amp;rsquo;m going to start using filename targets from now for these static artifacts. It makes it faster and easier down the line. This way we can start using more &lt;a href="%5BAutomatic%20Variables%20%28GNU%20make%29%5D%28https://www.gnu.org/software/make/manual/html_node/Automatic-Variables.html%29"&gt;automatic variables&lt;/a&gt;
&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-makefile" data-lang="makefile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;mini-template.png&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;/&lt;span class="n"&gt;mini&lt;/span&gt;-&lt;span class="n"&gt;template&lt;/span&gt;-&lt;span class="n"&gt;left&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Flop it&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; convert mini-template-left.png -flop mini-template-right.png
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;# Swap it&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; convert mini-template-right.png &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#ff0101&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#002200&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; -fill &lt;span class="s2"&gt;&amp;#34;#ff0202&amp;#34;&lt;/span&gt; -opaque &lt;span class="s2"&gt;&amp;#34;#004400&amp;#34;&lt;/span&gt; &lt;span class="se"&gt;\
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="se"&gt;&lt;/span&gt; &lt;span class="c1"&gt;# and the rest ..&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; mini-template-right.png
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;#montage!&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; montage mini-template-*.png -tile 2x1 -geometry 64x128+0+0 &lt;span class="nv"&gt;$@&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;figure&gt;
&lt;img src="../tilesets_4/f597ae368affcd61cba30e16cf95279c6164e883.png"
class="wikilink" alt="Pastedimage20251208132713.png" /&gt;
&lt;/figure&gt;
&lt;p&gt;Amazing, now we only have to work on the left part of the template and we can generate an entirely new tileset!&lt;/p&gt;
&lt;p&gt;We could mirror it again to only end up with just 4 tiles to work with, but the top/bottom of the templates aren&amp;rsquo;t entirely symetrical, this asymetry gives us the feeling of elevation so we can&amp;rsquo;t easily replicate that mechanically.&lt;/p&gt;
&lt;figure&gt;
&lt;img src="../tilesets_4/cd36c80bf1225248cc7127091f44f8bb5e307b26.png"
class="wikilink" alt="Pastedimage20251208133059.png" /&gt;
&lt;/figure&gt;
&lt;p&gt;This asymetry right here is what prevents us from generating the whole thing from just 4 tiles.&lt;/p&gt;
&lt;p&gt;If we fold this thing horizontally, mutliply the results and clean up, we get 12 distinct zones&lt;/p&gt;
&lt;figure&gt;
&lt;img src="../tilesets_4/95f8e8a9c6ae037ae0a0cea55cd8137b23366a12.png"
class="wikilink" alt="Pastedimage20251208215015.png" /&gt;
&lt;/figure&gt;
&lt;p&gt;Zones 3,4 and 5 are our gradient that causes all of our troubles.&lt;/p&gt;
&lt;p&gt;We could decide to encode all these subzones and generate a top/bottom tile that we can unfold, but it&amp;rsquo;s very difficult creating a controllable gradient from this.controllable gradient from this.&lt;/p&gt;
&lt;p&gt;We will do it anyway.&lt;/p&gt;
&lt;p&gt;Zone 3 needs to be added to zone 2 in the bottom section
and zone 4 in the top section&lt;/p&gt;
&lt;p&gt;Zone 5 needs to be added to zone 4 in the bottom section and zone 6 in the top section&lt;/p&gt;
&lt;p&gt;We need to get rid of the corner for the bottom variant so zone 11 will merge with zone 10 and zone 12 needs to get a different hue.&lt;/p&gt;
&lt;p&gt;Here&amp;rsquo;s the final make&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-makefile" data-lang="makefile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;micro-template.png&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;input&lt;/span&gt;/&lt;span class="n"&gt;pico&lt;/span&gt;-&lt;span class="n"&gt;template&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;cp&lt;/span&gt; &lt;span class="err"&gt;input/pico-template.png&lt;/span&gt; &lt;span class="err"&gt;micro-template-top.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;convert&lt;/span&gt; &lt;span class="err"&gt;micro-template-top.png&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;-fill&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#440044&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;-opaque&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#880088&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;-fill&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#002200&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;-opaque&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#006600&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;-fill&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#880088&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;-opaque&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#cc00cc&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;micro-template-top.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;cp&lt;/span&gt; &lt;span class="err"&gt;input/pico-template.png&lt;/span&gt; &lt;span class="err"&gt;micro-template-bottom.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;convert&lt;/span&gt; &lt;span class="err"&gt;micro-template-bottom.png&lt;/span&gt; &lt;span class="err"&gt;-flip&lt;/span&gt; &lt;span class="err"&gt;micro-template-bottom.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;convert&lt;/span&gt; &lt;span class="err"&gt;micro-template-bottom.png&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;-fill&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#ff0101&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;-opaque&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#006600&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;-fill&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#006600&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;-opaque&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#002200&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;-fill&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#006600&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;-opaque&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#440044&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;-fill&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#440044&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;-opaque&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#cc00cc&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;-fill&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#000044&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;-opaque&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#000088&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;-fill&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#004400&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;-opaque&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#ff0101&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;micro-template-bottom.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;montage&lt;/span&gt;  &lt;span class="err"&gt;micro-template-top.png&lt;/span&gt; &lt;span class="err"&gt;micro-template-bottom.png&lt;/span&gt; &lt;span class="err"&gt;-tile&lt;/span&gt; &lt;span class="err"&gt;1x2&lt;/span&gt; &lt;span class="err"&gt;-geometry&lt;/span&gt; &lt;span class="err"&gt;64x64+0+0&lt;/span&gt; &lt;span class="k"&gt;$@&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;rm&lt;/span&gt; &lt;span class="err"&gt;micro-template-*.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;If we plug this target as a depency to our mini-template&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-makefile" data-lang="makefile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;mini-template.png&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;micro&lt;/span&gt;-&lt;span class="n"&gt;template&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;   &lt;span class="c"&gt;# Flop it
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&lt;/span&gt;   &lt;span class="err"&gt;convert&lt;/span&gt; &lt;span class="err"&gt;micro-template.png&lt;/span&gt; &lt;span class="err"&gt;-flop&lt;/span&gt; &lt;span class="err"&gt;mini-template-right.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;   &lt;span class="c"&gt;# Swap it
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&lt;/span&gt;   &lt;span class="err"&gt;convert&lt;/span&gt; &lt;span class="err"&gt;input/mini-template-right.png&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;   &lt;span class="err"&gt;-fill&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#ff0101&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;-opaque&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#002200&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;   &lt;span class="err"&gt;-fill&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#ff0202&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;-opaque&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#004400&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;\&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;   &lt;span class="c"&gt;## the rest...
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&lt;/span&gt;   &lt;span class="err"&gt;mini-template-right.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;   &lt;span class="c"&gt;#montage!
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&lt;/span&gt;   &lt;span class="err"&gt;montage&lt;/span&gt; &lt;span class="err"&gt;micro-template.png&lt;/span&gt; &lt;span class="err"&gt;mini-template-right.png&lt;/span&gt; &lt;span class="err"&gt;-tile&lt;/span&gt; &lt;span class="err"&gt;2x1&lt;/span&gt; &lt;span class="err"&gt;-geometry&lt;/span&gt; &lt;span class="err"&gt;64x128+0+0&lt;/span&gt; &lt;span class="k"&gt;$@&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;one last thing we need to add to our mini-template: the two full floor and full border tiles!&lt;/p&gt;
&lt;p&gt;We get a super clean mini-template to work with&lt;/p&gt;
&lt;figure&gt;
&lt;img src="../tilesets_4/d9bfdb2ad033d09b5d396da53cc4d0bec2dfc643.png"
class="wikilink" alt="Pastedimage20251208224736.png" /&gt;
&lt;/figure&gt;
&lt;p&gt;Here we get a super clean and symetrical template to work with, but we lose some of the control if we would work in a micro or a mini template or even a meta template. The good part about using make as a pipeline tool is that at any moment we can choose to interfere and edit one of the target in our pipeline without editing it! Neat!&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s add those full tiles&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-makefile" data-lang="makefile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;mini-template&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;micro&lt;/span&gt;-&lt;span class="n"&gt;template&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; &lt;span class="c1"&gt;#.. the rest is still up here&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="c"&gt;# full floor and border
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&lt;/span&gt;    &lt;span class="nf"&gt;convert -size $(sprite_width)x$(sprite_height) &amp;#34;xc&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;call&lt;/span&gt; &lt;span class="nv"&gt;conf&lt;/span&gt;,&lt;span class="nv"&gt;zones&lt;/span&gt;.&lt;span class="nv"&gt;floor&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&amp;#34; &lt;span class="n"&gt;full&lt;/span&gt;-&lt;span class="n"&gt;floor&lt;/span&gt;-&lt;span class="n"&gt;tile&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="nf"&gt;convert -size $(sprite_width)x$(sprite_height) &amp;#34;xc&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;call&lt;/span&gt; &lt;span class="nv"&gt;conf&lt;/span&gt;,&lt;span class="nv"&gt;zones&lt;/span&gt;.&lt;span class="nv"&gt;border&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&amp;#34; &lt;span class="n"&gt;full&lt;/span&gt;-&lt;span class="n"&gt;border&lt;/span&gt;-&lt;span class="n"&gt;tile&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;montage&lt;/span&gt; &lt;span class="err"&gt;full-border-tile.png&lt;/span&gt; &lt;span class="err"&gt;full-floor-tile.png&lt;/span&gt; &lt;span class="err"&gt;-background&lt;/span&gt; &lt;span class="err"&gt;none&lt;/span&gt; &lt;span class="err"&gt;-tile&lt;/span&gt; &lt;span class="err"&gt;1x2&lt;/span&gt; &lt;span class="err"&gt;-geometry&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;sprite_width&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="err"&gt;x&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;sprite_height&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="err"&gt;+0+0&lt;/span&gt; &lt;span class="err"&gt;full-tiles.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="c"&gt;#montage!
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&lt;/span&gt;    &lt;span class="err"&gt;montage&lt;/span&gt; &lt;span class="err"&gt;micro-template.png&lt;/span&gt; &lt;span class="err"&gt;mini-template-right.png&lt;/span&gt; &lt;span class="err"&gt;-tile&lt;/span&gt; &lt;span class="err"&gt;2x1&lt;/span&gt; &lt;span class="err"&gt;-geometry&lt;/span&gt; &lt;span class="err"&gt;64x128+0+0&lt;/span&gt; &lt;span class="err"&gt;mini-template.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="nf"&gt;convert -size 160x128 xc&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;none&lt;/span&gt; &lt;span class="n"&gt;mini&lt;/span&gt;-&lt;span class="n"&gt;template&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt;  -&lt;span class="n"&gt;geometry&lt;/span&gt; +0+0 -&lt;span class="n"&gt;composite&lt;/span&gt; \
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="n"&gt;full&lt;/span&gt;-&lt;span class="n"&gt;tiles&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt; -&lt;span class="n"&gt;geometry&lt;/span&gt; +128+0  -&lt;span class="n"&gt;composite&lt;/span&gt; \
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="n"&gt;mini&lt;/span&gt;-&lt;span class="n"&gt;template&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;figure&gt;
&lt;img src="../tilesets_4/c57a2b11409cc22cf7570e3de6d3d79a9a2698d7.png"
class="wikilink" alt="Pastedimage20251211130915.png" /&gt;
&lt;/figure&gt;
&lt;p&gt;We are left with two empty squares that we will make use of later!&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;in the meantime i cleaned up the pico-template to result into more symetrical tilesets. The OG was a bit mangled throughout the project. The result, i discovered later is that the vertical tiles are much narrower that id like, but we can fix that by pronouncing the horizontal borders more&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If we index each individual tile we get a nice mapping we get this:&lt;/p&gt;
&lt;p&gt;&lt;img src="../tilesets_4/78408b0e417ee5521e132d0660557c0c811ab830.png"
class="wikilink" alt="Pastedimage20251211144116.png" /&gt;
I&amp;rsquo;m mappng the two empty tiles seperately because i feel we will need them later.&lt;/p&gt;
&lt;p&gt;From here we can slice each individual tile and rearrange them to create any tile layout!&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-makefile" data-lang="makefile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;template_tiles&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;mini&lt;/span&gt;-&lt;span class="n"&gt;template&lt;/span&gt;.&lt;span class="n"&gt;png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;mkdir&lt;/span&gt; &lt;span class="err"&gt;-p&lt;/span&gt; &lt;span class="err"&gt;template-tiles&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;convert&lt;/span&gt; &lt;span class="err"&gt;mini-template.png&lt;/span&gt; &lt;span class="err"&gt;-crop&lt;/span&gt; &lt;span class="err"&gt;32x32&lt;/span&gt; &lt;span class="err"&gt;+repage&lt;/span&gt; &lt;span class="err"&gt;+adjoin&lt;/span&gt; &lt;span class="err"&gt;template-tiles/tile_%02d.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="err"&gt;fdupes&lt;/span&gt; &lt;span class="err"&gt;-d&lt;/span&gt; &lt;span class="err"&gt;--noprompt&lt;/span&gt; &lt;span class="err"&gt;template-tiles&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="nv"&gt;n&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;0&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; f in template-tiles/*&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="nv"&gt;ext&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$$&lt;/span&gt;&lt;span class="s2"&gt;{f##*.}&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; mv &lt;span class="s2"&gt;&amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$$&lt;/span&gt;&lt;span class="s2"&gt;f&amp;#34;&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;template-tiles/tile_&lt;/span&gt;&lt;span class="nv"&gt;$$&lt;/span&gt;&lt;span class="s2"&gt;(printf %02d &amp;#34;&lt;/span&gt;&lt;span class="nv"&gt;$$&lt;/span&gt;n&lt;span class="s2"&gt;&amp;#34;).&lt;/span&gt;&lt;span class="nv"&gt;$$&lt;/span&gt;&lt;span class="s2"&gt;ext&amp;#34;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nv"&gt;n&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$$&lt;/span&gt;&lt;span class="o"&gt;((&lt;/span&gt;n+1&lt;span class="o"&gt;))&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here we use a tool called &lt;a href="%5Badrianlopezroche/fdupes:%20FDUPES%20is%20a%20program%20for%20identifying%20or%20deleting%20duplicate%20files%20residing%20within%20specified%20directories.%5D%28https://github.com/adrianlopezroche/fdupes%29"&gt;fdupes&lt;/a&gt;
to remove the duplicate tiles then we use a saucy one-liner to rename the tiles&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s plug this in to our pipeline and generate some full tilesets!&lt;/p&gt;
&lt;h2 id="template-patterns"&gt;Template patterns&lt;/h2&gt;
&lt;p&gt;We are going to do something silly.&lt;/p&gt;
&lt;p&gt;We are going to map our template tiles to a template pattern. A bitmap where every pixel represents a tile translated from the tiles number to a grayscale value. #000 for tile_01, #aaa for tile_11 etc. Using these maps will allows us to create templates for all kinds of platforms!&lt;/p&gt;
&lt;figure&gt;
&lt;img src="../tilesets_4/db39b8c331d0225138f3037fb4af885a3c09093b.png"
class="wikilink" alt="Pastedimage20251211153158.png" /&gt;
&lt;/figure&gt;
&lt;p&gt;This will be our simplest template pattern&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s also make a pattern for the blob template we started with&lt;/p&gt;
&lt;figure&gt;
&lt;img src="../tilesets_4/0f8eda49d1f1447b16be0997ceeaa58ca6c08067.png"
class="wikilink" alt="Pastedimage20251211162701.png" /&gt;
&lt;/figure&gt;
&lt;p&gt;now lets take our tiles and a pattern and generate a template for our terrain:
&lt;img src="../tilesets_4/6eb15b05fc37d1fb1466abbf9a8bd7af9418415a.png"
class="wikilink" alt="Pastedimage20251211163329.png" /&gt;&lt;/p&gt;
&lt;p&gt;We basically do the same thing as when we overlay our textures on a finished pattern&lt;/p&gt;
&lt;p&gt;First we need to make our template sized dynamic: tilesize x pattern size. No more hard-coding the yaml!&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-makefile" data-lang="makefile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;call mul,&lt;span class="k"&gt;$(&lt;/span&gt;sprite_width&lt;span class="k"&gt;)&lt;/span&gt;,&lt;span class="k"&gt;$(&lt;/span&gt;shell identify -format &lt;span class="s2"&gt;&amp;#34;%w&amp;#34;&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;pattern_file&lt;span class="k"&gt;)))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;call mul,&lt;span class="k"&gt;$(&lt;/span&gt;sprite_height&lt;span class="k"&gt;)&lt;/span&gt;,&lt;span class="k"&gt;$(&lt;/span&gt;shell identify -format &lt;span class="s2"&gt;&amp;#34;%h&amp;#34;&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;pattern_file&lt;span class="k"&gt;)))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Here&amp;rsquo;s a target that creates a cutout for one of the tiles&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-makefile" data-lang="makefile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nf"&gt;template-cutout-%.png&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;template&lt;/span&gt;-&lt;span class="n"&gt;tiles&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="c"&gt;#overlay
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&lt;/span&gt;    &lt;span class="c"&gt;#scale the pattern to the full size of the template (sprite x pattern size)
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&lt;/span&gt;    &lt;span class="nf"&gt;convert template-tiles/tile_$*.png -filter point -resize $(sprite_width)x$(sprite_height) -write mpr&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt;&lt;span class="n"&gt;tile&lt;/span&gt; +&lt;span class="n"&gt;delete&lt;/span&gt; -&lt;span class="n"&gt;size&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;width&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="k"&gt;$(&lt;/span&gt;&lt;span class="nv"&gt;height&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt; &lt;span class="n"&gt;tile&lt;/span&gt;:&lt;span class="n"&gt;mpr&lt;/span&gt;:&lt;span class="n"&gt;tile&lt;/span&gt; &lt;span class="n"&gt;template&lt;/span&gt;-&lt;span class="n"&gt;overlay&lt;/span&gt;-&lt;span class="n"&gt;tile&lt;/span&gt;-$*.&lt;span class="n"&gt;png&lt;/span&gt;  
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="c"&gt;#section
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&lt;/span&gt;    &lt;span class="err"&gt;convert&lt;/span&gt; &lt;span class="err"&gt;pattern-resized.png&lt;/span&gt; &lt;span class="err"&gt;-alpha&lt;/span&gt; &lt;span class="err"&gt;set&lt;/span&gt; &lt;span class="err"&gt;+transparent&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;#$(call TEMPLATE_TILE_COLOR,$*)&amp;#34;&lt;/span&gt; &lt;span class="err"&gt;template-section-&lt;/span&gt;&lt;span class="k"&gt;$*&lt;/span&gt;&lt;span class="err"&gt;.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;    &lt;span class="c"&gt;#cutout
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&lt;/span&gt;    &lt;span class="c"&gt;# cut the section out from the overlay
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="c"&gt;&lt;/span&gt;    &lt;span class="err"&gt;convert&lt;/span&gt; &lt;span class="err"&gt;template-overlay-tile-&lt;/span&gt;&lt;span class="k"&gt;$*&lt;/span&gt;&lt;span class="err"&gt;.png&lt;/span&gt; &lt;span class="err"&gt;template-section-&lt;/span&gt;&lt;span class="k"&gt;$*&lt;/span&gt;&lt;span class="err"&gt;.png&lt;/span&gt; &lt;span class="err"&gt;-compose&lt;/span&gt; &lt;span class="err"&gt;copyopacity&lt;/span&gt; &lt;span class="err"&gt;-composite&lt;/span&gt; &lt;span class="err"&gt;template-cutout-&lt;/span&gt;&lt;span class="k"&gt;$*&lt;/span&gt;&lt;span class="err"&gt;.png&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;The target above takes the tile&amp;rsquo;s id (00-16) to select the correct section to cutout&lt;/p&gt;
&lt;p&gt;Now since we already created the tiles, we can group them together with a little &lt;a href="%5Bsed,%20a%20stream%20editor%5D%28https://www.gnu.org/software/sed/manual/sed.html%29"&gt;sed&lt;/a&gt;
. Here&amp;rsquo;s a makefile function to get all the available tile id&amp;rsquo;s&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-makefile" data-lang="makefile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;TILE_IDS&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;shell ls template-tiles/tile_*.png &lt;span class="p"&gt;|&lt;/span&gt; sed -E &lt;span class="s1"&gt;&amp;#39;s/.*tile_([0-9][0-9])\.png/\1/&amp;#39;&lt;/span&gt;&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Then we can generate our template cutouts dynamically:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-makefile" data-lang="makefile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;TEMPLATE_CUTOUTS&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;$(&lt;/span&gt;TILE_IDS:%&lt;span class="o"&gt;=&lt;/span&gt;template-cutout-%.png&lt;span class="k"&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;So now all we have to do is make all the cutouts and flatten them:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;template.png: $(TEMPLATE_CUTOUTS)
    convert $^ -background none -flatten $@
    # and clean up all the temporary files after were done
    rm template-section-*.png template-overlay-tile-*.png template-cutout-*.png
&lt;/code&gt;&lt;/pre&gt;
&lt;h2 id="give-it-a-run"&gt;Give it a run!&lt;/h2&gt;
&lt;p&gt;template.png produces our template: template.png. So all we have to do is change our template_file variable to point to our new dynamic template:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-makefile" data-lang="makefile"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nv"&gt;template_file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; template.png
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;and when we go&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;make tilesets
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;all the starts align&lt;/p&gt;
&lt;figure&gt;
&lt;img src="../tilesets_4/221765ce7f7e43cdb591e0b83d167e1ecf9669a1.png"
class="wikilink" alt="Pastedimage20251211133948.png" /&gt;
&lt;/figure&gt;
&lt;blockquote&gt;
&lt;p&gt;I see that the terrains have narrower vertical tiles than horizontal tile, we can now fix that by simply editing the pico-template, but we will do that later&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Lets make a tiled terrain template
&lt;img src="../tilesets_4/4e72f828c305b35fbe16cd78b38e263e1768ba15.png"
class="wikilink" alt="Pastedimage20251211133637.png" /&gt;&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s give it a shot:&lt;/p&gt;
&lt;figure&gt;
&lt;img src="../tilesets_4/7b4f3620baf980596f49dfdcde6b91399052785f.gif"
class="wikilink" alt="MiniTemplate.gif" /&gt;
&lt;/figure&gt;
&lt;blockquote&gt;
&lt;p&gt;I can tell that there&amp;rsquo;s also an issue of missing transitions. The red tile flashes are the system requiring tile combinations that don&amp;rsquo;t exist. In order to complete the terrain, there should be transitions for between any possible combination of texture. So aside from our hard-coded terrains, we should generate some intermediate terrains that fill in the gaps.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id="conclusion"&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Wow, that&amp;rsquo;s a lot of work for not a ton of different results compared to where we started. There is a ton of polish left on the table, but what we have now gives us a ton of possibility to create terrains in all kinds of configurations. We also discovered more interesting problems to tackle in future installments. Most importantly we learned some more bash, how to use fdupe and practiced our imagemagick skills.&lt;/p&gt;
&lt;h2 id="stuff-left-to-do"&gt;Stuff left to do&lt;/h2&gt;
&lt;p&gt;☐ Fix the narrow vertical tiles&lt;/p&gt;
&lt;p&gt;☐ Create Tiled compatible set files&lt;/p&gt;
&lt;p&gt;☐ Make dimensions calculated instead of hard-coded in the config&lt;/p&gt;
&lt;p&gt;☐ Genereate intermediate terrains&lt;/p&gt;</description></item></channel></rss>