Recursive AI

Export for the web, Android and iOS

All onegame recipes

What the web, Android and iOS exports need at onegame 1.1.2: an engine checkout for all three, plus the Android SDK or a Mac with Xcode, and what each export produces.

At 1.1.2, the web, Android and iOS exports need an engine checkout. A game made from the NuGet packages exports for Linux, Windows and macOS, and its dedicated server for Linux. The web export reads engine sources (its page and script files), so it needs a game created against a checkout; Play Billing in an Android build and plugin servers do too. The Android and iOS entry files ship in the SDK package, but those two exports have only been run from a checkout.

What a game from the packages gets

From the apple tree in Getting started, made with onegame new and the packages only:

Terminal
onegame export --target web
Text
error: The web export needs the engine sources (its page and script files), so it runs for a game that sets OneGameRoot to an engine checkout (onegame new --engine <checkout>). A game on the RecursiveAI.OneGame.Sdk package cannot export for the web yet.

That exits 3. Android and iOS stop earlier on this Linux machine, at their toolchains, each with exit 4:

Terminal
onegame export --target android
Text
error: The Android SDK was not found. Set ANDROID_HOME (or pass --sdk <folder>) to a folder with build-tools, platforms, platform-tools and an ndk folder; the command-line tools' sdkmanager installs them.
Terminal
onegame export --target ios-simulator
Text
error: Exporting for iOS links with Xcode's toolchain and the iOS SDK, so it needs a Mac with Xcode (xcode-select -p must point at it).

A game against an engine checkout

Clone the engine at the release tag, build it, and create the game against it:

Terminal
git clone --branch v1.1.2 https://github.com/recursive-ai-oss/onegame
cd onegame
dotnet build OneGame.slnx
dotnet run --project src/OneGame.Cli -- new mygame --dir ../mygame --engine .

Such a game references the engine’s projects instead of packages. Setting ONEGAME_ROOT to the checkout does the same for onegame new. These steps are from the engine’s README and weren’t run for this page.

What each export makes

TargetCommandNeedsResult
Webonegame export --target weba checkouta folder any static server can host: .NET on WebAssembly, WebGPU, the page and its scripts. Serve .wasm as application/wasm.
Androidonegame export --target android [--abi arm64-v8a,x86_64] [--dev]a checkout, the Android SDK and NDKa debug-signed APK holding a NativeAOT shared library, no Java
iOS Simulatoronegame export --target ios-simulator [--dev]a checkout, a Mac with Xcodean ad-hoc signed .app for the Simulator
iOS deviceonegame export --target iosa checkout, a Mac with Xcodean unsigned arm64 .app, which the owner of an Apple Developer account signs; the steps are printed as signingNeeds

Good to know

  • A page needs a browser with WebGPU: Chrome and Edge 113 and later. Safari and Firefox aren’t tested. Sound starts after the first click or key press.
  • onegame web test runs a game’s scenarios in headless Chrome (ONEGAME_CHROME names the browser), and onegame android test and onegame ios test run them on an emulator, a device or the Simulator. The engine’s own runs are in Checking on devices.
  • A game that connects to servers from Android sets <AndroidInternet>true</AndroidInternet> in its project file.
  • To branch on the platform, ask OneGame.Platform.RunningOn (Android, IOS, Browser, Phone, Mobile, Desktop), new in 1.1.2. OperatingSystem.IsAndroid() is false in a NativeAOT Android build.
  • A scenario capture compares against name-mobile.png beside name.png on a phone or in a page, when that file exists.

Every target is in Exporting.