Building the game and the Android app
If you only want to play the game, you need nothing but a browser: open dist/sema-tawy.html and you are done.
What the build makes
| What | Where | What it needs |
|---|---|---|
| The game | dist/sema-tawy.html | Python 3 (and Node.js to check every stack can be cleared) |
| The Android app | dist/android/sema-tawy.apk | the game, a JDK and the Android SDK’s command-line tools |
| The website | dist/website/ | the game (and the app, to offer it for download) and Python 3 |
| The desktop programs | dist/desktop/ | the game, Node.js and zip (and mksquashfs for the Linux AppImage) |
| The manual as a website | dist/docs/ | Python 3 |
The game
python3 build.py # checks everything, then writes the game
python3 build.py --check # checks only
python3 build.py --watch # builds again on every save
On Windows, double-click build.bat.
The Android app
The app is one WebView showing the built game, made the way Amulets of Anubis makes its app, without Gradle. platforms/android/BUILD.md says what each file there is.
What to install (on a Mac, with Homebrew)
brew install openjdk
brew install --cask android-commandlinetools
sdkmanager "build-tools;35.0.0" "platforms;android-35" "platform-tools"
On Linux, install a JDK (17 or newer) from your distribution and the Android command-line tools from developer.android.com, then the same sdkmanager line. The build looks for the SDK at $ANDROID_SDK or in the usual places and for Java at $JAVA_HOME or Homebrew’s openjdk.
Building it
python3 build.py
python3 engine/tools/build-android.py # dist/android/sema-tawy.apk
python3 build.py --debug
python3 engine/tools/build-android.py --debug # dist/android/sema-tawy-debug.apk
python3 engine/tools/build-android.py --unsigned # for a store that signs it itself
The debug app keeps a play log, which its menu saves as a file wherever you choose on the phone. Chrome on a computer can look inside its page. It is the same app to the phone, so it replaces the ordinary one.
Signing. An app must be signed and every update with the same key, or Android refuses it. The build uses, in this order: $ANDROID_KEYSTORE (its password in the file named by $ANDROID_KEYSTORE_PASS_FILE), platforms/android/release.jks with release.pass, or the key our other apps are signed with. Without any, it makes a debug key in platforms/android/debug.keystore. Keys never go into git. Keep the release key safe: without it, the app can never be updated.
The version. edition.jsonc‘s "version" (0.1.0) becomes the app’s version and its version code is major × 10000 + minor × 100 + patch. Raise it for every release. "android" is the app’s package name, which can’t change once the app is published.
Putting it on a phone
Turn on USB debugging on the phone (Settings, About phone, tap Build number seven times, then Developer options), plug it in and:
adb install -r dist/android/sema-tawy.apk
The icon
tools/draw-icon.py draws it (a pair of tiles with the scarab, on papyrus) into platforms/android/res/. Change it there and run it again.
The desktop programs
python3 build.py
python3 engine/tools/build-desktop.py # every platform
python3 engine/tools/build-desktop.py darwin-arm64 # or only some
It puts the game in a window with a frozen copy of the Chromium engine (Electron), as Amulets of Anubis does, and writes a zip for each platform into dist/desktop/: Windows, macOS (Apple silicon and Intel) and Linux. It needs Node.js and zip and fetches nothing it doesn’t have: the packager from the game’s own npm cache and Electron from its cache, where Amulets’ builds left them (--fetch fetches the packager once). The programs are not signed, so Windows shows a warning and macOS needs the download flag cleared; platforms/desktop/BUILD.md says how.
For Linux it also writes an AppImage (sema-tawy-x86_64.AppImage, and -aarch64 for ARM): the game as one file that runs without installing. It needs mksquashfs (brew install squashfs on a Mac; on Linux the package squashfs-tools) and, once, --fetch to fetch the AppImage starter (about 1 MB). engine/platforms/desktop/BUILD.md explains it.
The website
python3 tools/build-website.py
It writes dist/website/: a front page with the stacks and how the game plays, How to play (the same chapters as in the game), the game itself to play in a browser, the downloads (the game file and the app, if it was built) and the manual. Open dist/website/index.html; nothing in it reaches the internet. Everything it shows comes from the built game, so build the game first and the site follows. Before it is put online it needs the legal pages a German website must have (an Impressum and a Datenschutzerklärung).
The manual alone, as its own website and as a PDF:
python3 engine/tools/docs/build.py # dist/docs/
python3 engine/tools/docs/build.py --pdf # and a PDF, on A4 and A5
Which pages it has, and in what order, is docs/site.json.