<?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[Windflash AI Lab]]></title><description><![CDATA[Windflash AI Lab]]></description><link>https://windflashlab.hashnode.dev</link><generator>RSS for Node</generator><lastBuildDate>Fri, 18 Sep 2026 08:45:59 GMT</lastBuildDate><atom:link href="https://windflashlab.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[I Built a Complete Tower Defense Game With AI Art and Zero Dependencies — Here's How]]></title><description><![CDATA[What does it actually take to ship a browser game entirely from scratch — no frameworks, no asset packs, no audio files — just vanilla JavaScript, the HTML5 Canvas API, and a lot of deliberate enginee]]></description><link>https://windflashlab.hashnode.dev/i-built-a-complete-tower-defense-game-with-ai-art-and-zero-dependencies-here-s-how</link><guid isPermaLink="true">https://windflashlab.hashnode.dev/i-built-a-complete-tower-defense-game-with-ai-art-and-zero-dependencies-here-s-how</guid><category><![CDATA[Game Development]]></category><category><![CDATA[#Game Design]]></category><category><![CDATA[game]]></category><dc:creator><![CDATA[windflash]]></dc:creator><pubDate>Fri, 20 Mar 2026 08:43:56 GMT</pubDate><content:encoded><![CDATA[<p>What does it actually take to ship a browser game entirely from scratch — no frameworks, no asset packs, no audio files — just vanilla JavaScript, the HTML5 Canvas API, and a lot of deliberate engineering decisions? I found out building <strong>Arcane Bastion</strong>, a crystal tower defense game that's now live on <a href="http://Instantgames.top">InstantGames.top</a>.</p>
<p>This post is a high-level tour of what went into it. The <a href="https://instantgames.top/blog/posts/arcane-bastion-dev-log-building-tower-defense-with-ai.html">full dev log</a> goes deep on every system — with annotated code, architecture diagrams, and the hard-won lessons from each step.</p>
<hr />
<img src="https://cdn.hashnode.com/uploads/covers/69a6ec9456428acc6fe91956/bcb36202-68a3-4070-b718-364426df5c83.png" alt="" style="display:block;margin:0 auto" />

<h3><strong>The Zero-Dependency Bet</strong></h3>
<p>The entire project — ~3,200 lines of JavaScript across 9 modules — runs with <strong>zero external libraries</strong>. No React, no Phaser, no Howler.js. Every system was built from first principles: a 20×14 tile grid, a waypoint-based pathfinding system, a 60fps game loop with a wave state machine, and a full UI layer including a tower upgrade panel and enemy bestiary.</p>
<p>The reason wasn't stubbornness — it was education and performance. Building directly on the Canvas API forces you to understand what's actually happening at every layer of abstraction. And at 45KB unminified, the game loads instantly.</p>
<hr />
<h3><strong>Five Towers, Ten Enemies, Fifteen Waves</strong></h3>
<p>The gameplay is built around five elemental tower types — Ember, Frost, Storm, Vine, and Arcane — each with three upgrade tiers and distinct targeting behavior. Towers use a "closest to nexus" priority system, automatically focusing fire on the most dangerous threats.</p>
<p>On the enemy side, ten unique shadow creature types march across the map across 15 increasingly difficult waves, from fragile Shadow Wisps in Wave 1 all the way to the Shadow Dragon boss encounter. Status effects — Frost's 40% slow, Vine's poison-over-time — stack together to create real strategic depth. A Frost + Vine combination is particularly brutal.</p>
<hr />
<h3><strong>Every Visual Asset Was AI-Generated</strong></h3>
<p>This is where things get unusual. All 18 visual assets — five tower sprites, ten enemy sprites, and three dynamic map backgrounds — were generated using AI image tools. No hand-drawn pixel art. No asset store purchases.</p>
<p>The process wasn't just "prompt and paste." Maintaining visual consistency across 18 separate generations required a locked style anchor in every prompt: <em>"dark fantasy, pixel art aesthetic, top-down perspective, glowing magical effects."</em> Background removal and per-sprite brightness calibration still required manual passes. The full pipeline — prompt engineering, generation, post-processing, and integration testing — took roughly 40 total generation attempts to get right.</p>
<p>The map backgrounds themselves are a standout feature: the environment transitions through three distinct themes (Enchanted Forest → Crystal Caverns → Volcanic Wasteland) as players advance through wave ranges, giving a real sense of escalating stakes.</p>
<hr />
<h3><strong>Every Sound Is Synthesized in Real Time</strong></h3>
<p>There are zero audio files in this project. Every sound — tower attack effects, enemy death pops, UI clicks, the upgrade fanfare, the wave horn, background ambient music, and the victory and defeat jingles — is synthesized procedurally using the <strong>Web Audio API's oscillators and gain nodes</strong>.</p>
<p>This was the system I'm most proud of, and also the one with the most unexpected engineering rabbit holes. Chrome's autoplay policy means you cannot create or resume an <code>AudioContext</code> before user interaction, full stop. The fix required lazy-initializing the audio context on the first user gesture, with careful ordering to ensure <code>ensureContext()</code> was always called before any early-return checks. It's a subtle bug that's easy to introduce and frustrating to debug.</p>
<hr />
<h3><strong>Dynamic Tower Rotation and the Polish That Makes It Feel Real</strong></h3>
<p>Three late-stage additions transformed Arcane Bastion from a working prototype into something that actually <em>feels</em> like a game: AI-generated map backgrounds (replacing flat procedural tiles), glow auras on tower sprites, and <strong>smooth dynamic tower rotation</strong>.</p>
<p>Every tower continuously rotates its sprite to track its current target using angle interpolation with a lerp factor of 0.15 per frame. A <code>+π/2</code> offset corrects for the fact that sprites default to "facing up" while <code>Math.atan2</code> returns 0 for "facing right." A subtle recoil displacement on each shot ties the visual and audio feedback together. None of this affects gameplay mechanics — but it's the difference between a tech demo and a game.</p>
<hr />
<h3><strong>Want the Full Breakdown?​</strong></h3>
<p>The <a href="https://instantgames.top/blog/posts/arcane-bastion-dev-log-building-tower-defense-with-ai.html">complete dev log on InstantGames</a> covers all ten systems in full detail — including the in-browser video recording pipeline (MediaRecorder + Web Audio capture + Playwright + ffmpeg), the module architecture, the wave design philosophy, and the complete lessons-learned section. It's a ~15-minute read aimed at developers who want to understand not just <em>what</em> was built, but <em>why</em> each decision was made.</p>
<p>You can also <a href="https://instantgames.top">play Arcane Bastion directly</a> and browse the rest of the projects on <a href="http://Instantgames.top">InstantGames.top</a> — an indie game dev site where I build and ship browser games, write dev logs, and experiment at the intersection of game development and AI tooling.</p>
<hr />
<p>Here's a breakdown of what I did and why for the key writing choices:</p>
<p><strong>Hook and framing.​</strong> The opening leads with a concrete, curiosity-driving question rather than a feature list. "Zero dependencies" is a counterintuitive claim that earns a click.</p>
<p><strong>Section structure.​</strong> Each section distills one major system into its most interesting insight — the kind of thing a developer would want to share with a colleague. This respects the reader's time while making the full dev log feel like a worthwhile destination for the deep dive.</p>
<p><strong>Link placement.​</strong> The full dev log link appears in the intro, in the body, and in the closing CTA — three natural placements without feeling spammy. The site homepage link appears twice, anchored to specific actions (play the game, browse projects) rather than generic "visit my site" language.</p>
<p><strong>Tone.​</strong> Written in first-person developer voice to match the Hashnode audience — technically literate, curious, and allergic to marketing fluff.</p>
]]></content:encoded></item></channel></rss>