<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged webaudio</title>
<link>https://coderlegion.com/tag/webaudio</link>
<description>Powered by Question2Answer</description>
<item>
<title>Prismwar: a six-color card game with a built-in AI opponent that runs entirely in the browser</title>
<link>https://coderlegion.com/26780/prismwar-a-six-color-card-game-with-a-built-in-ai-opponent-that-runs-entirely-in-the-browser</link>
<description>&lt;p&gt;Hey CoderLegion!&lt;/p&gt;
&lt;p&gt;I've been building &lt;strong&gt;Prismwar&lt;/strong&gt;, an original trading card game you play against a computer opponent right in the browser. If you've played Magic, the shape will feel familiar: five colors of mana, creatures, spells, deckbuilding. Then there's a sixth color, &lt;strong&gt;Purple (&quot;Undertow&quot;)&lt;/strong&gt;, built around disruption.&lt;/p&gt;
&lt;p&gt;It's heading for my browser arcade at play.dhseadev.online and for a Chrome extension. Both run the same game, and neither needs an account.&lt;/p&gt;
&lt;h4 id=&quot;features-&quot;&gt;Features:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;A 250-card set, &quot;Refraction&quot;:&lt;/strong&gt; 240 collectible cards plus 10 &lt;strong&gt;Ascendants&lt;/strong&gt;, a new permanent type with loyalty and two abilities. Ascendants can't be pulled from packs. They unlock only through redeem codes.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Signed redeem codes:&lt;/strong&gt; codes are signed with ECDSA P-256. The game can verify a code, but it can't create one, because the signing key never ships with it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;8 starter decks:&lt;/strong&gt; one for each of the six colors, plus two dual-color decks (White/Red and Green/Blue). They're all commons-only, and so are the AI's decks, so the opponent can't out-rare you.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tutorial mode&lt;/strong&gt; for learning the rules.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fair packs, with the odds shown in-game:&lt;/strong&gt; slot 4 is guaranteed uncommon or better, slot 5 is rare or better, there's a pity counter for Signature cards, and duplicates are protected. You earn cards a few ways: dust for every finished match, a pack for your first win of the day, and a bonus for win streaks.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Collection and crafting:&lt;/strong&gt; your collection is grouped by rarity, and you can craft missing cards with dust.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Procedural pixel art for all 250 cards, with no drawn assets:&lt;/strong&gt; each color has a 5-tone palette, light always comes from the top left, and a card's keywords choose its form (beast, humanoid, flyer, serpent, colossus, wisp). My favorite bug: two unrelated cards had &lt;em&gt;identical&lt;/em&gt; art because the effect sigils had no randomness. Now a build gate hashes the geometry of every card and fails if any two match.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Card interactions:&lt;/strong&gt; click to flip for rules and flavor text, shift-click to enlarge, hover for a quick preview.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Generated music:&lt;/strong&gt; three styles (ambient, chiptune, synthwave) built live with Web Audio, with intensity that follows the match. There are no audio files at all.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Game feel:&lt;/strong&gt; particles when cards are cast and screen shake on hits. Sound, music, screen shake and motion each have their own setting, and turning motion off disables the effects.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Backup and restore&lt;/strong&gt; for your collection.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The Ledger:&lt;/strong&gt; export your collection progress as a generated PNG card to share, or post it to a shared wall.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;tech-stack-&quot;&gt;Tech Stack:&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Vanilla JavaScript, HTML and CSS&lt;/strong&gt;: no framework&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Canvas 2D&lt;/strong&gt; for card art and the shareable Ledger card&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Web Audio API&lt;/strong&gt; for all sound effects and music&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ECDSA P-256&lt;/strong&gt; signatures for redeem codes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Chrome Manifest V3&lt;/strong&gt; with a single &lt;code&gt;storage&lt;/code&gt; permission&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cloudflare Pages&lt;/strong&gt; for the arcade, and &lt;strong&gt;playhtml&lt;/strong&gt; for the shared Ledger wall&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Testing:&lt;/strong&gt; a Node unit suite, a sabotage suite that must catch deliberately broken builds (15 of them), and a headless Chromium suite that runs under the production Content Security Policy, both from source and from the packaged extension&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;status&quot;&gt;Status&lt;/h4&gt;
&lt;p&gt;In final prep, not live yet. Links will go here once it deploys:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;More from me: &lt;a rel=&quot;nofollow&quot; href=&quot;https://dhseadev.online/&quot;&gt;https://dhseadev.online/&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;i-d-love-your-input&quot;&gt;I'd love your input&lt;/h4&gt;
&lt;p&gt;AI-vs-AI testing says the aggressive starters (the White go-wide deck and the Red burn deck) are the strongest right now, and the Green ramp deck and the White/Red deck are the weakest. If you've balanced a card game before, how would you tune &lt;strong&gt;commons-only&lt;/strong&gt; starter decks without flattening what makes each color different?&lt;/p&gt;
&lt;p&gt;And if you could design a sixth color from scratch, what would it do?&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/26780/prismwar-a-six-color-card-game-with-a-built-in-ai-opponent-that-runs-entirely-in-the-browser</guid>
<pubDate>Fri, 11 Sep 2026 03:51:32 +0000</pubDate>
</item>
<item>
<title>Shipping Real Audio In A Browser Game Without A Studio Budget</title>
<link>https://coderlegion.com/25291/shipping-real-audio-in-a-browser-game-without-a-studio-budget</link>
<description>&lt;p&gt;Most of us have shipped something where the audio was the last thing we thought about and the first thing that gave the project away as a side project. This is a walkthrough of what actually changed over the last two years and what it means if you are building a game that runs in the browser.&lt;/p&gt;
&lt;h3 id=&quot;where-the-constraint-actually-was&quot;&gt;Where The Constraint Actually Was&lt;/h3&gt;
&lt;p&gt;Browser games have always had thin audio for two separate reasons, and people usually only talk about one of them.&lt;/p&gt;
&lt;p&gt;The first is budget. A single orchestral score runs into five figures. Voice acting a dialogue heavy RPG can double or triple what a small team spends on everything else. So the realistic option was a sound effect library, which produces generic results that every other game using that library also ships with.&lt;/p&gt;
&lt;p&gt;The second is file size. Browser games stream their assets over a connection you do not control, so audio got compressed until it was small enough to load and repetitive enough to loop forever. Three tracks and a jump sound was not a taste decision, it was an engineering one.&lt;/p&gt;
&lt;h3 id=&quot;what-the-generators-handle-well&quot;&gt;What The Generators Handle Well&lt;/h3&gt;
&lt;p&gt;Music generators produce original compositions from a prompt or from parameter controls. Sound effect models generate footsteps on a specific surface, UI clicks and impacts from a written description. Voice synthesis produces character dialogue with emotional inflection and accent control that is hard to distinguish from a recording.&lt;/p&gt;
&lt;p&gt;The useful way to split this is by how much attention the asset gets. Ambient and exploration loops, incidental effects and secondary NPC dialogue are the eighty percent nobody consciously notices, and that is where generation is genuinely good now. A main theme that players hum afterwards still comes from a person having an idea, and prompting does not reliably get you there.&lt;/p&gt;
&lt;p&gt;The file size problem also softens, because you are generating to your own spec. You choose the length, the quality and the compression rather than accepting whatever the library shipped.&lt;/p&gt;
&lt;h3 id=&quot;the-web-audio-api-side&quot;&gt;The Web Audio API Side&lt;/h3&gt;
&lt;p&gt;This is the part that makes it worth doing in a browser specifically. The Web Audio API gives you real time processing, spatial sound and dynamic mixing natively, so generated assets are not just dropped in as static files.&lt;/p&gt;
&lt;p&gt;That opens up adaptive music, where layers fade in and out based on game state rather than a track restarting at a hard cut. Combine that with generation and you can produce the stems you need for each layer instead of trying to carve them out of one finished mix. The gap between browser audio and what Unity or Unreal produce on the desktop has narrowed a lot, and this is most of the reason why. The full walkthrough of the tooling and the integration side lives in &lt;a rel=&quot;nofollow&quot; href=&quot;https://www.abratabia.com/ai-game-audio/&quot;&gt;AI game audio and music&lt;/a&gt; if you want the detail.&lt;/p&gt;
&lt;h3 id=&quot;licensing-is-the-part-that-bites&quot;&gt;Licensing Is The Part That Bites&lt;/h3&gt;
&lt;p&gt;Terms vary wildly between tools, they change, and some free tiers grant far less than people assume, particularly around commercial release and storefront distribution.&lt;/p&gt;
&lt;p&gt;Check what your generator actually grants before you build the game around the assets. Unwinding this after release means replacing audio in a shipped product, which is exactly as miserable as it sounds.&lt;/p&gt;
&lt;h3 id=&quot;the-takeaway&quot;&gt;The Takeaway&lt;/h3&gt;
&lt;p&gt;The constraint that kept browser games sounding cheap was real, and it is mostly gone. What replaced it is a licensing question and a taste question: generate the parts nobody notices, keep a human on the parts that carry the identity of the game, and read the terms before you commit.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/25291/shipping-real-audio-in-a-browser-game-without-a-studio-budget</guid>
<pubDate>Mon, 24 Aug 2026 12:49:59 +0000</pubDate>
</item>
</channel>
</rss>