Playable Version


I've finally gotten around to getting a playable version onto Itch. Go check it out!

Why did it take so long? Boring technical details incoming! No, really. It's just going to be me talking about JavaScript tools for the rest of this post!

I prefer to build games without any code compilation tools when possible, which has become way more friendly over the past few years with most browsers adopting modules and lots of improvements to TypeScript's JSDoc syntax. It keeps the development cycles quick and it removes tooling related headaches entirely.

However, the simplicity of that setup comes with some tradeoffs. I can't use non-standard syntax (e.g. React's JSX) and I can't depend on packages from npm (unless the package is distributed as ES modules and you are happy to ship your node_modules folder with your game). That means that I usually load my third party modules from a CDN like UNPKG or Pika.

Enter Snowpack. Snowpack offers the best of both worlds by running a development server which runs your code as ES modules, but also compiles your third party dependencies to be importable as single file ES modules too. Snowpack was been working great in development but I wasn't able to deploy the game to Itch because of Itch's requirement of no absolute paths. Snowpack rewrites all third party module imports to absolute paths of the form `/web_modules/xyz.js` which violates that rule.

I contributed a patch that would allow Snowpack to rewrite that path in imports, but then discovered that Itch uses a new embed url for every version of the game you upload. As far as I can see there's no way to tell what the base path will be ahead of time.

So, a long story short I tried out Vite, another project with similar goals, but with a build time bundling step and managed to get the Itch deployment working very quickly. I may revisit Snowpack in the future but for now it's back to development!

Files

itch.zip Play in browser
Jun 12, 2020

Leave a comment

Log in with itch.io to leave a comment.