Development Tools

I’m preparing to release my first game soon.

There’s a particular tool that I’m waiting to reach stable release before I use it in production. In the meantime, I’ve been improving my own release workflow.

Build process

I now have a fully automated build process, running on Github Actions. With one click, the build process will take care of the following tasks:

  • Minify JSON files
  • Concatenate and minify JS files with Terser (preserving comments with author/license information)
  • Delete development files not needed in release
  • Delete plugin files that are included but turned off
  • Separate pathways for preparing files for the web versus the local version, so it will delete web-only files if the build is intended for installation, and vice-verse
  • Add the path to every game asset to a precache in the service worker
  • Build the app for Windows and Linux installation with Tauri

Tauri

All my games run in the browser – but some people prefer a download they can run offline.

Enter Tauri. Tauri is a tool written in Rust that will bundle all the assets required to run your web app with a browser engine, allowing it to be installed and run locally.

Unlike NWJS or Electron, competing tools that ship static browser versions, Tauri runs on the most recent webview available to your OS. So you’re always shipping on the fastest, most secure platform possible. Granted, browser engines can frequently introduce new bugs with each release, so I wouldn’t necessarily recommend this approach for sensitive, commercial software. But for a hobbyist like me, it fits.

By default, RPG Maker MV ships with NWJS, so it expects access to Node and its file system module to save and load files. Accommodating Tauri required a few changes to my code.

Tauri Store is a simple to use plugin that allows Tauri apps to save local data. It can store similar data types to a browser’s local storage, the technology that RPG Maker uses in its web version. The major difference is that Tauri’s commands are always asynchronous. Luckily I had already written a new save manager that interfaces with web workers, which are asynchronous as well. So it took less than a hundred new lines of code to get it working with Tauri instead.

I also ended up including Tauri Window State in my build. It’s another easily integrated plugin that saves the app’s window position and fullscreen status, so the next time the app is launched, it starts in the same position as when it exited.

Overall my experience with Tauri has been positive. I’m new to Rust as a language, so I appreciate the official plugins having an extremely simple API that only takes a couple lines of code to run.

I experimented with including Rust crates used for compression, so I could compress data before writing it to Tauri Store. But it was a bit of a mess – Rust is very strict about data types, only serialize-able data can be transferred between the Tauri backend and the webview. I’m sure it’s do-able with a few more weeks of practice, but it’s daunting for a Rust newcomer.

Good luck to the Tauri team, who will hopefully be releasing their stable 1.0 version any day now. I’ll be publishing apps with it soon after.

Update

I’m adding this addendum some months later.

Tauri has reached stable. Congratulations to their team and all the hard work they put into the project.

Ultimately, I decided against using Tauri, and instead built a template around Electron.

There are two deciding factors that ultimately made me favour Electron.

  1. Electron’s WebGL performance is pretty good on all platforms, whereas Tauri uses a different engine for each platform, and my testing on Linux was pretty slow with WebGL content.
  2. Electron allows exporting to raw files without an installer, which is Itch.io’s preferred format.