PlatformTutorial: Gem Garden
13. Other platforms
Gem Garden never names a platform: Program.cs hands the game to a launcher, and the launcher (or the package’s host)
picks the platform. The same compiled game therefore runs on another backend, in a browser and on a phone without a
code change. This step tries each.
Another backend on the desktop
Desktop games carry two platforms: SDL 3 (the default) and raylib. Ask for raylib:
microengine run --platform raylibmicroengine run -- --list-platforms--list-platforms prints the platforms of the desktop launcher and why one cannot run on this machine:
sdl: SDL 3: window, 2D renderer (Direct3D, Metal, OpenGL, Vulkan or software), input, touch and audioraylib: raylib 6.0: GLFW window, OpenGL renderer, input and miniaudio soundsdl-software: SDL 3 with its software rendererheadless: no window, devices or sound; one step per frame, for tests and CIPlayers can choose too: GemGarden.exe --platform sdl-software runs on a machine whose graphics driver fails with the
default renderer. The MICROENGINE_PLATFORM environment variable does the same without a command-line option. Why two
backends, and how to add your own: Backends and platforms.
In a browser
dotnet workload install wasm-toolsmicroengine package webThe first command installs .NET’s WebAssembly build tools once per machine (on Windows, from an administrator
terminal if .NET was installed for all users). With a .NET 11 SDK, install wasm-tools-net10 instead: the tools for
the game’s .NET 10 (microengine doctor web says which one your SDK needs). The package is a folder and a ZIP of the same files:
dist/GemGarden-1.0.0-web/, a static site with an index.html titled “Gem Garden”, the icon as favicon, the .NET
runtime compiled to WebAssembly, SDL 3, the game and its Content.
- Upload the folder to any static host: GitHub Pages, Netlify, itch.io (as an HTML game), an S3 bucket, your own
server. The server must send
.wasmfiles asapplication/wasm. - Opening
index.htmlstraight from disk does not work: browsers block the runtime’s requests fromfile://. Test it through a local web server. - The page waits for a click or key before starting the game, so the music can play; keys that would scroll the page stay with the game.
- The best score is saved in the browser’s
localStorage: no code change,SaveStorepicks the browser’s storage by itself. Private windows forget it when they close. - On phones and tablets the touch controls of step 4 appear: the floating joystick and the A and II buttons.
Embedding the game in your own page with an iframe, and following its state from the page: Publishing on the web.
On Android
Building an APK needs the android workload, an Android SDK (ANDROID_HOME) and Java 17 or newer;
microengine doctor android checks all three and says how to install what is missing.
microengine doctor androidmicroengine package android --debug-key--debug-key signs the APK with this machine’s debug key, which is enough to install it on your own devices:
adb install dist/GemGarden-1.0.0-android.apkadb comes with the Android SDK’s platform tools; you can also copy the APK to the phone and open it there. The game
runs on SDL 3 in landscape (MicroEngineOrientation), with the touch controls; a Bluetooth gamepad or keyboard works
too. When the player switches apps, the game pauses itself (see step 10).
To publish an APK, sign it with your own key instead of the debug key: create a keystore once, keep it safe and out of
the repository, and point ANDROID_KEYSTORE and its password variables at it (Signing and secrets).
The tool builds APKs, which install directly and through stores that accept them; Google Play requires App Bundles
(.aab), which it does not build yet.
macOS and iOS
Both are built on a Mac:
microengine package macosbuilds a.appfor Apple silicon in a ZIP, signed ad hoc or with your Developer ID.microengine package ios-simulatorbuilds a.appto try in Xcode’s Simulator;microengine package iosbuilds an.ipafor devices, signed with your Apple certificate and provisioning profile.
Requirements, signing and notarization: Packaging a game and Signing and secrets.
What you built
Gem Garden uses scenes as game states, sprites from files and from code, an animator, input actions with gamepad and touch support, a tile map with collisions, a camera, particles, sound effects and music, a HUD, menus, a pause overlay, a save file, and packages for several platforms. That is most of MicroEngine.
Where to go from here:
- Make the game yours: more levels (a
Levelper map, chosen on the title), a gem that grows the clock, slimes that chase the gardener. - Focused examples: one screen per topic, including what the tutorial did not use (dialogue boxes, tweens and coroutines, lighting, custom input sources).
- Testing your game: play it automatically with input scripts and screenshots.
- Achievements: unlockable achievements with banners and a list screen, in a few lines.
- The engine manual explains each subsystem in depth, and the API reference lists every public type.