Godot + Sugarizer = profit?

So I hear you want to make a game for Sugarizer. For HFOSS we want to port some older Sugar games to Sugarizer. Many of the games were created using pygames, which is not available on the web. So we're going to need to use a different “game engine” for these games. Now a reasonable person might say “using a full on game engine for games this simple is overkill” and “using a few simple web libraries is perfectly sufficient”. But where's the fun in that?

The Godot game engine is pretty cool, and just so happens to be able to export games to html+js+wasm. Which means we can, theoretically, make a Godot game run in Sugarizer. So how do we do this? First, I downloaded the Godot sample game, Dodge the Creeps, to try to embed. I configured the Godot project to be able to export to HTML5 and uploaded it to Github[1]. Then I created a new Sugarizer activity based on the activity template. I cloned the Godot game as submodule into the activity folder and took to embedding it. I wrote a build script to export the game and HTML5 and save to a folder called out. In this form the game works by just opening in the browser. So I modified the activity html file the load the web page as an iframe in the remainder of the activity page under the top bar. It took a bit a finagling to get the frame to be the right size, but after that it worked! See the finished product here [2].

This turned out surprisingly easy to do. However there are a few drawbacks and things to improve. Sugarizer as is doesn't seem to have any sort of build step, being that it's all scripts, but having to run a build script for just my activity is less than optimal. I could save the output web game in git but it's more of a build artifact than source code so that doesn't feel right. Also the wasm file is ~20M (~14 after running wasm-opt). Also the activity has some load time. It's not terrible but it's more than the other activities.

[1] https://github.com/zethra/dodge-the-creeps [2] https://github.com/zethra/sugarizer-lite/tree/godot/activities/DodgeTheCreeps.activity