Convert your MakeCode Arcade games to executables

Convert your MakeCode Arcade games into a standalone offline executable!

It’s basically the same thing as this, but the star of the show is being able to use Tauri instead of Electron instead, reducing app sizes from over 200 MB to ~10 MB! (~3% of the original size) It is also a standalone executable, making distribution even easier!

Set up and configuration is now easier, as you only need to write a YAML file like so:

name: Racers
description: "Enjoy the high-speed thrills of car racing in MakeCode Arcade! 
  For the MakeCode Arcade Mini Game Jam #3."
author: UnsignedArduino
version: 1.3.2
title: "{NAME} v{VERSION}"

source: https://arcade.makecode.com/84426-33815-03715-00484

icon: https://raw.githubusercontent.com/UnsignedArduino/MakeCode-Arcade-to-App/refs/heads/main/examples/Racers%20icon.png

output: tauri

Check out the example on GitHub to see examples with comments documenting available options, etc. You can easily switch between bundling to static HTML, CSS, and JS files, an Electron app, (like before), or a Tauri app! If you want even more configuration, you can edit gameConfiguration.ts to customize the web app running your game, being able to change toast notifications, available features like showing statistics, a focus detector, and more!

And, as usual, the generated Electron and Tauri apps are responsive windows that can be played offline, built for multiple platforms, and they save the data that the setting extension saves!

If you would like to convert your own games, follow the instructions in the repo’s README. It is a quite involved process, necessitating Python and Node.js at minimum. You will need Rust installed to generate a Tauri executable. You will need to build for each platform you want to support, ex. build on Windows to generate .exe, build on Linux to generate Linux executables, etc. (Code signing is still not supported explicitly by the program) Command line knowledge is highly recommended.

Please let me know if you want any more features or there are bugs for me to fix! Enjoy!

22 Likes

This is some great work, @UnsignedArduino!!!

-Especially with the substantially reduced executable sizes, since ~10MB is manageable for most modern small systems (even for a couple of hundreds kB of game logic… :wink: )!

A couple of questions off the top of my head:

  1. What are the run time dependencies needed for such small Tauri executables? Does the executing system need a minimal browser etc. pre-installed?
  2. Does this solution also support multiple games in one executable, as was suggested/discussed in the earlier topic for your first solution?

PS:

  1. Do you think there is enough generic high-level stuff in these executable bundles to being able to make them “run-everywhere”, with for instance: https://github.com/jart/cosmopolitan?
  2. Could we make the executables even substantially smaller with certain executable compressors similar to those used in the demoscene, like for instance: https://logicoma.io/squishy/ ?
4 Likes

(sorry for the mod having to read all of this :skull:)

Technically, the binary.js in an average game is several MB. :zany_face:


Instead of Electron packaging Chromium, making it heavy but guaranteed to work on the target platform, Tauri uses the system-installed web view (ex. WebView2 on Windows, WebKit on macOS, or GTK WebKit on Linux) as a “browser”. For example, when I showed the 10 MB executable in a Windows Sandbox, I actually had to install Microsoft Edge WebView2 by running an installer first. (A dialog pops up telling you where to find the installer). Although I think this is still a better tradeoff than a 200 MB Electron build. Supposedly, most systems shouldn’t have to deal with something like that.


Currently, no. With the executables being “so small”, I imagined people wouldn’t mind creating shortcuts to the game on the desktop, or adding them to an existing launcher like Steam:

(Which launches correctly, although there isn’t any description, art besides the executable icon)

Although the script is able to bundle to static HTML, CSS, and JS files, which means you could have a bunch of these games be hosted on a server by copying these static files to directories that are served. I think a MakeCode Arcade launcher would be a separate project altogether…Aghh I already have enough projects in queue this summer!!!


Apparently, it’s possible but I think it would be extremely difficult as it would need to call the correct web view for the platform. I’m definitely not smart enough for that!


squishy didn’t work for me, it resulted in something like this:

C:\Users\ckyiu\Downloads\squishy-0.2.0>squishy-x64.exe -i tauri-app.exe -o tauri-app-packed.exe
squishy 0.2.0 | made with <3 by Jake "ferris" Taylor / logicoma 2016-2021
 - WARNING: resources present, these can be kinda big
thread 'main' panicked at 'Unrecognized resource type: 0x00000010', src\main.rs:1247:26
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

C:\Users\ckyiu\Downloads\squishy-0.2.0>

But upx did work for me - it’s most aggressive compression scheme (-9) was able to reduce the size from 9.34 MB to 2.58 MB! (27% ratio) The packed executable seemed to have slightly worse performance and frame stuttered a bit, but otherwise it still worked! So I guess, if you want to save even more space, you can compress the executable smaller than the size of its binary.js lol. (the binary.js for Racers, I think, is ~3 MB) This is a good idea I haven’t thought of before!

4 Likes

Thanks for your further investigations and elaborate answer, @UnsignedArduino!
(Did not mean to plant any further summer projects in your mind. I hope you get some vitalising sun and leisure time away from the screen, too!) :wink:

Yours is probably the best solution for a standalone executable MCA game so far, with a good balance between usability, size and portability. And probably controller support etc.

But I still don’t understand how MCA games can be compiled natively to a couple of hundreds kB ARM Linux .elf executables and run fine without the whole web simulator included in binary.js, and why this should be so difficult to port/compile to other platforms (or even cross platform via Cosmopolitan)…

4 Likes

Reviving this topic but does this mean I can put a Makecode game on steam for people to get

I actually did get this to the point of working, (or my dad did most of it). I did this, only to realise that somewhere along the line of uploading to GitHub, my project had broken. Oh well…

do you think it would be possible to host a website where you could put in the link and get a downloadable executable? This would be great for sharing games, but people might struggle on the technical side of things.

You should be able to, although I am unsure of MakeCode’s policies/license terms for making money of makecode games. I’m also not familiar with how to create a Steam game page, but I’m pretty sure it requires a monetary investment. But if it can accept an executable, then it should work.

Do you have a working share link? That can be used instead of a GitHub repository.

Building executables is computationally expensive, so the hosting would make it really expensive and complicated, especially as there are many different OS and hardware architectures to compile for.

1 Like