Solitude, Part 2: 2.5D Canvas
In Part 1, we covered generating daily hex islands and Charter hints in Go for Solitude. This second post is about the TypeScript frontend.
Like my Crossword, Anarchy Chess, and Codeword apps, Solitude skips frontend frameworks and draws straight onto an HTML5 <canvas>. Unlike a flat 8x8 chessboard or 13x13 word grid, though, a 28-day island game lives or dies by how good the gameplay looks.
Anyone who has built a 2.5D game before already knows the tricks below; I hadn’t, so I walked straight into every standard trap one by one, so I’ll keep this post short.
Learning why flat hex tiles don’t tilt
My first art pass treated every hex like a self-contained board-game tile, with pine trees or cabins painted directly onto a flat grass polygon. That broke in three ways at once: rotating a river bend or coast tile in 60-degree steps tipped baked-in trees and shadows sideways, tilting the board slightly (0.88 vertical squash) flattened cabins like pancakes, and anti-aliased PNG borders left hairline cracks and a wallpaper grid across open meadows.
Splitting each hex into a flat rotatable ground tile plus upright 1:1 transparent sprites made the island click together like a picture book:
Rivers, beaches, fog clouds, and stone paths sit on the tilted ground plane, while the cabin, pine groves, berry bushes, footbridge, dock, and player stand upright on top of it so tree crowns and chimney smoke overhang the hex behind them.
Fixing the trees promptly exposed the next round of bugs. Sorting upright sprites back-to-front by screen y let the player walk behind southern trees and in front of northern ones, until I selected a cabin and watched the top edge of the 6-sided highlight ring slice straight across its roof (tall tiles now stroke only the bottom five edges so the ring hugs the grass). Tinting winter frost one hex at a time left faint green honeycomb outlines across snowfields until I switched to wide, low-opacity washes that drift across tile borders. And splitting ground from props quietly bloated cold load to 139 separate PNGs (8.24 MB) - 36 of which turned out to be leftover pre-split files the game wasn’t even using anymore - before packing the 103 active sprites into three cached WebP sheets cut the download by 91% (779 KB):
Zero-file Web Audio and getting UI out of the way
Playing a quiet nature game in complete silence felt oddly lifeless, especially when hopping along a stone road or finishing a Charter goal, yet shipping megabytes of MP3 loops felt silly for a tiny static bundle. Instead, ~230 lines of Web Audio synthesize ten soft sound effects - footsteps, gathering notes, water splashes, wood chopping, goal chimes, and dusk chords - with zero audio files. Simple sine and triangle waves handle musical cues, while running random white noise through a one-line low-pass filter caches a warm noise buffer for water and grass without harsh hiss. Because walk animations track each tile border you cross, footsteps switch from grassy rustles to crisp stone clicks the moment you step onto a road.
On the UI side, a 15-minute run punishes small mobile annoyances much harder than a quick chess puzzle. Early builds split controls across a four-tab bottom toolbar, popped up a banner on every action, and let resource counters jump around as your satchel filled - cramping phone screens and putting End Day uncomfortably close to tile buttons. Replacing the bottom bar with a small menu beside whichever tile you tap, keeping a fixed 3-dot satchel indicator in the header, sending daytime actions quietly to the log, and only asking to confirm End Day when you still have AP left or aren’t back at camp made the whole game cleaner. Separate local storage slots also save Easy, Medium, Hard, and sandbox runs independently so you can switch difficulties mid-year without losing your place, with a local island fallback if the daily API is slow on first load.
Next up in Part 3 are the two bots waiting at the end of Day 28 - Master Strategist and Island Oracle - and why planning 28 days inside a two-second server budget turned out to be the hardest search problem in the project.
