Compare commits

...
16 Commits
Author SHA1 Message Date
waozi 8332bb879e Release Apfelwurm 0.2.7: desktop play starts at once and the site loads faster 2026-10-27 17:43:55 -03:00
waozi b4508b84a7 Start every desktop build with swipe steering
The default desktop build has no PLATFORM_DESKTOP define, so the
choice now applies to every build that is not Android, the browser or
a hosted copy.
2026-10-27 17:42:53 -03:00
waozi cbdcbdd40e Load wurm.waozi.xyz with a small title picture
The page's loading background was the 2.7 MB title PNG. The web build
now makes a 280 KB WebP for it and a 300 KB JPEG for link previews from
the same art, with no visible difference; the game keeps the original.
2026-10-27 17:41:00 -03:00
waozi 6cc71cf7c4 Start desktop play with swipe steering instead of asking
A desktop always has a keyboard and a mouse drag steers like a swipe,
so Play goes straight into the run there. Pause and Settings still
switch to the direction pad; phones and the browser keep asking.
2026-10-27 17:33:03 -03:00
waozi 7c19cb8a6b Release Apfelwurm 0.2.6 with Dew through Google Play in the Google Play version 2026-10-27 17:19:43 -03:00
waozi 2adc4a37a7 Use Kryon's Play Billing without activity code 2026-10-27 17:17:33 -03:00
waozi 497f6d4487 Buy Dew through Google Play in the Google Play edition
The Play bundle is Kryon's Google Play edition (app.edition=gplay), so
Entity lists Dew packs at Play's price and adds them after the node
confirms each purchase; the direct and F-Droid downloads keep Monero.
The bundle is named wurm-vX-gplay.aab and must contain Play Billing.
The privacy page now covers Google Play purchases and how to delete an
account.
2026-10-27 17:11:04 -03:00
waozi 616cef608a Bring portals in slowly from level 61 2026-10-27 16:58:37 -03:00
waozi 1dafcae9d6 Add portals to the boards after the meadow 2026-10-27 16:41:10 -03:00
waozi 4aae7a0e52 Release Apfelwurm 0.2.6: leaderboard runs and one sign-in for every waozi.xyz site 2026-10-27 16:33:31 -03:00
waozi 7b6a74f429 Rank Apfelwurm's best run by level and score on the Profile leaderboard 2026-10-27 16:23:14 -03:00
waozi 080ab50d84 Build a signed Google Play bundle without Dew funding
The Play edition keeps earning and spending Dew but cannot buy it,
as in Shovey's Play build. A manual workflow builds both ARM
architectures, signs the bundle with the Apfelwurm upload key from
the repository secrets and verifies identity, version, signer and
alignment before keeping it as an artifact.
2026-10-27 16:18:06 -03:00
waozi e505aee537 Release Apfelwurm 0.2.5: difficulty-based scoring and a Profile that always opens 2026-10-27 16:15:12 -03:00
waozi b9ca6de322 Release Apfelwurm 0.2.4: the browser game fills the page 2026-10-27 16:05:44 -03:00
waozi 1562681f0a Release Apfelwurm 0.2.3: Top up opens dew.waozi.xyz 2026-10-27 14:29:53 -03:00
waozi 5fdb457f8e Start Arcade's game update as soon as Apfelwurm publishes a release
GitHub runs scheduled workflows hours late, so the release now starts
Arcade's Game updates directly with RELEASE_FOLLOW_TOKEN, a token that may
only start workflows. Without it Arcade's timer still follows.
2026-10-27 13:20:33 -03:00
20 changed files with 594 additions and 53 deletions

No files matched your search

+13
View File
@@ -152,3 +152,16 @@ jobs:
fi
gh release upload "$tag" "build/downloads/wurm-v$VERSION.apk" "build/downloads/wurm-$VERSION-fdroid.apk" "build/downloads/wurm-web-v$VERSION.zip" --clobber
gh release edit "$tag" --draft=false --latest
# Arcade follows this release now, not at its next timer, and Breeze
# then publishes it to the node. RELEASE_FOLLOW_TOKEN may only start
# workflows in Arcade and Breeze; Game updates takes no input and finds
# the newest game releases itself. Without it Arcade's timer follows.
- name: Start Arcade's game update
env:
GH_TOKEN: ${{ secrets.RELEASE_FOLLOW_TOKEN }}
run: |
if [ -z "$GH_TOKEN" ]; then
echo "No RELEASE_FOLLOW_TOKEN: Arcade's Game updates picks this release up on its timer."
exit 0
fi
gh workflow run game-updates.yml -R waozixyz/arcade --ref master
+93
View File
@@ -0,0 +1,93 @@
name: Google Play bundle
on:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: wurm-play-bundle
cancel-in-progress: false
jobs:
bundle:
name: Signed Google Play App Bundle
runs-on: ubuntu-24.04
timeout-minutes: 75
env:
ZIRAN_PAR_THREADS: '1'
MAKEFLAGS: -j1
OMP_NUM_THREADS: '1'
YUE_DESKTOP_RECOVERY: '0'
defaults:
run:
working-directory: waozixyz/wurm
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4.3.0
with:
path: waozixyz/wurm
persist-credentials: false
- name: Read the locked compiler and release version
id: version
run: |
python3 - <<'PY' >> "$GITHUB_OUTPUT"
import json
from pathlib import Path
print('compiler=' + json.loads(Path('ziran.lock').read_text())['toolchain']['commit'])
print('version=' + json.loads(Path('version.json').read_text())['version'])
PY
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
with:
repository: ziranlang/ziran
ref: ${{ steps.version.outputs.compiler }}
path: ziranlang/ziran
persist-credentials: false
- name: Install native build tools
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends build-essential cmake pkg-config python3-pil python3-numpy libssl-dev
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '21'
- name: Install the pinned Android SDK tools
run: |
"$ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager" 'ndk;28.2.13676358' 'build-tools;36.0.0' 'platforms;android-36' 'cmake;3.22.1'
- name: Build the locked compiler
working-directory: ziranlang/ziran
run: |
env -u DISPLAY -u WAYLAND_DISPLAY make -j1
echo "$PWD/build/bin" >> "$GITHUB_PATH"
- name: Fetch only locked packages
run: ziran fetch --locked
- name: Verify release metadata
run: |
sh update_version.sh
git diff --exit-code -- version.json
- name: Build both ARM architectures in one Google Play edition bundle
run: python3 tools/build_android.py --bundle --abi universal
- name: Sign with the Apfelwurm upload key and verify
env:
KEYSTORE: ${{ secrets.WURM_ANDROID_KEYSTORE }}
PASSWORD: ${{ secrets.WURM_ANDROID_KEYSTORE_PASSWORD }}
run: |
set -euo pipefail
test -n "$KEYSTORE" && test -n "$PASSWORD"
curl --fail --show-error --location --retry 3 \
https://github.com/google/bundletool/releases/download/1.18.3/bundletool-all-1.18.3.jar \
--output "$RUNNER_TEMP/bundletool.jar"
umask 077
trap 'rm -f "$RUNNER_TEMP/wurm-release.p12" "$RUNNER_TEMP/wurm-password"' EXIT
printf '%s' "$KEYSTORE" | base64 -d > "$RUNNER_TEMP/wurm-release.p12"
printf '%s\n' "$PASSWORD" > "$RUNNER_TEMP/wurm-password"
python3 tools/android_release.py sign build/android/Apfelwurm-release-unsigned.aab \
--keystore "$RUNNER_TEMP/wurm-release.p12" --password-file "$RUNNER_TEMP/wurm-password" \
--bundletool "$RUNNER_TEMP/bundletool.jar"
cat backup/android-release/play-verification.json
- uses: actions/upload-artifact@v4
with:
name: wurm-play-${{ steps.version.outputs.version }}
path: waozixyz/wurm/build/downloads/wurm-v${{ steps.version.outputs.version }}-gplay.aab
if-no-files-found: error
retention-days: 14
+26
View File
@@ -1,5 +1,31 @@
# Changelog
## [0.2.7] - 2026-10-27
- On the desktop, Play starts right away with mouse steering; the keyboard always works, and Pause still switches to the direction pad.
- wurm.waozi.xyz opens faster with a much lighter loading picture.
## [0.2.6] - 2026-10-27
- Glowing portals arrive from level 61: first on a few boards, then more often, with two pairs late in the mountains. Steer into one ring to come out of its partner, keeping your direction. Each ring stands in open ground, so you can always go around it.
- See your best run on the Profile leaderboard: the furthest level you reached and your highest score, as separate Level and Score columns ranked against your friends.
- Sign in once for every waozi.xyz site: a profile signed in on Arcade, Dew or here is used by the others in the same browser.
- Buy Dew inside the Google Play version through Google Play, priced in your own currency. The direct download and F-Droid versions keep buying Dew with Monero.
- The privacy page explains Google Play purchases and how to delete your account.
## [0.2.5] - 2026-10-27
- Score more on harder boards: each level's apples are worth one to nine points by how many creatures roam it, how many apples it asks for and how tight its walls are. Extra lives still come about every 33 apples.
- The Profile always opens. If it cannot start on this device, it says why instead of doing nothing, and a saved account key that cannot be read is kept aside.
## [0.2.4] - 2026-10-27
- Play on the whole page at wurm.waozi.xyz, without a title bar above the game.
## [0.2.3] - 2026-10-27
- Top up in the Profile opens dew.waozi.xyz, where you can buy Dew with Monero in any amount or with almost any other coin.
## [0.2.2] - 2026-10-27
- Set an account alias with capitals, an @ or spaces; a taken alias now says so.
+31 -2
View File
@@ -31,6 +31,7 @@
Records :: #import "entity/entity_records";
Dew :: #import "entity/entity_dew";
Shop :: #import "entity/game_shop_native";
Leaderboard :: #import "entity/leaderboard_native";
Files :: #import "entity/native_files";
File :: #import "std/file";
#import "std/text_buffer"
@@ -38,6 +39,9 @@
#import "kryon/tree_input"
#import "kryon/key_input"
#import "kryon/text_input_props"
#import "kryon/text_props"
#import "kryon/text_align"
#import "kryon/text_widget"
#import "kryon/open_uri"
#if #defined(ANDROID_BUILD) {
#import "kryon/android_jni"
@@ -82,17 +86,42 @@
if name == "entity.records" { return Records.EntityRecordsAnswer(request) }
if name == "entity.dew" { return Dew.EntityDewAnswer(request) }
if name == "entity.game-shop" { return Shop.EntityGameShopAnswer(request) }
// The best run, on the board Arcade names after the game's catalog id.
if name == "leaderboard" {
saved := Leaderboard.EntityLeaderboardReport("wurm", "Apfelwurm", "xyz.waozi.wurm", "Apfelwurm", request)
return ifx saved then "saved" else "rejected"
}
if name == "entity.profile" && request == "open" { OpenProfile(); return "available" }
return ""
}
OpenProfile :: () { if ready { Entity.EntityHostReload(); visible = true } }
// The Profile always opens. One that could not start tries again and,
// if it still cannot, says why instead of doing nothing.
OpenProfile :: () {
if !ready && started && profile_bytes != "" {
root: [4096]u8
ready = Entity.EntityHostOpen(profile_bytes, Root(root[:]), "arcade", true)
}
if ready { Entity.EntityHostReload() }
visible = true
}
ProfileVisible :: () -> bool { return visible }
DrawProfile :: (session: Session, bounds: Rectangle, key: s32, dark: bool) {
if !ready {
problem := Entity.EntityHostProblem()
if problem == "" { problem = "The profile could not start. Reload the page to try again." }
unused Text(session, TextProps.{.key = 29010, .text = problem, .font = 18, .wrap = TextWrap.TextWrapAuto,
.align = TextAlign.TextAlignCenter,
.bounds = Rectangle.{bounds.x + 24.0, bounds.y + 48.0, bounds.width - 48.0, 120.0}})
return
}
typed: [1024]u8
input := TextFieldInputFor(key, KeyboardModifiers(session), TypedTextTake(session, typed[:]))
unused Entity.EntityHostFrame(session, bounds, key, KeyboardModifiers(session), input, dark)
}
Back :: () { if !Entity.EntityHostBack() && Entity.EntityHostSave() { visible = false } }
Back :: () {
if !ready { visible = false; return }
if !Entity.EntityHostBack() && Entity.EntityHostSave() { visible = false }
}
VisitWebsite :: () -> bool { return OpenUri("https://waozi.xyz/") }
} else {
#import "kryon/open_uri"
+33 -1
View File
@@ -693,6 +693,32 @@ AppleFlash :: (session: Session, stage: Rectangle) {
.shape = StarIcon.Shape, .color = Color.{255, 227, 116, 220}})
}
// Each portal pair glows in its own colour and breathes slowly, so the two
// rings that belong together are easy to tell apart.
portal_frame: s32;
DrawPortals :: (session: Session, stage: Rectangle) {
if game.portal_count == 0 { return }
portal_frame = (portal_frame + 1) % 120
scale := stage.width / (cast(float32)board_columns * 16.0)
breath := cast(float32)(ifx portal_frame < 60 then portal_frame else 120 - portal_frame) / 60.0
for pair: 0..game.portal_count - 1 {
glow := ifx pair == 0 then Color.{150, 112, 255, 255} else Color.{255, 160, 70, 255}
core := ifx pair == 0 then Color.{58, 30, 120, 235} else Color.{120, 58, 12, 235}
for end: 0..1 {
centre := ifx end == 0 then game.portals[pair].a else game.portals[pair].b
key := 12000 + cast(u64)pair * 8 + cast(u64)end * 4
outer := (13.0 + 2.0 * breath) * scale
inner := 8.0 * scale
x := stage.x + cast(float32)centre.x * scale
y := stage.y + cast(float32)centre.y * scale
unused Box(session, BoxProps.{.key = key, .bounds = Rectangle.{x - outer, y - outer, outer * 2.0, outer * 2.0},
.fill = Color.{glow.r, glow.g, glow.b, cast(u8)(70.0 + 50.0 * breath)}, .radius = outer})
unused Box(session, BoxProps.{.key = key + 1, .bounds = Rectangle.{x - inner, y - inner, inner * 2.0, inner * 2.0},
.fill = core, .border = glow, .radius = inner})
}
}
}
// Stone posts mark each open gate throughout the journey. Their tiles and the
// centre opening keep their existing collision data and width.
DrawGatePosts :: (session: Session, stage: Rectangle) {
@@ -722,6 +748,7 @@ DrawBoard :: (session: Session, stage: Rectangle) {
}
}
DrawGatePosts(session, stage)
DrawPortals(session, stage)
if game.apples > 0 && game.apple.x >= 0 {
Sprite(session, 1400, stage, game.apple, Rectangle.{0.0, 112.0, 16.0, 16.0}, sprites)
AppleFlash(session, stage)
@@ -1625,15 +1652,20 @@ Frame :: (session: Session, viewport: Rectangle) -> s32 {
if game.mode == MODE_FINISHED && !editor.playtest && recorded_level != game.level {
Progress.Complete(game.level)
if Progress.Begin(game.level + 1, game.lives, game.score) { recorded_level = game.level }
Progress.RecordRun(game.level + 2, game.score)
}
// The run keeps each lost life; a game over or the finished journey
// starts the next run at level one.
if !editor.playtest && game.lives < lives_before {
if game.mode == MODE_DIED { unused Progress.Restart() }
if game.mode == MODE_DIED {
Progress.RecordRun(game.level + 1, game.score)
unused Progress.Restart()
}
else { unused Progress.LoseLife() }
}
if game.mode == MODE_VICTORY && !editor.playtest && recorded_level != game.level {
Progress.Complete(game.level)
Progress.RecordRun(LEVEL_COUNT, game.score)
if Progress.Restart() { recorded_level = game.level }
}
Audio.UpdateAudio(game.mode == MODE_PLAYING || game.mode == MODE_PAUSED,
+7
View File
@@ -59,6 +59,13 @@ Load :: () {
bytes: [2]u8
count := ReadRecord("controls.dat", bytes[:])
if count == 1 && bytes[0] <= 1 { mode = cast(s32)bytes[0] }
// A desktop always has a keyboard, and a mouse drag steers like a swipe,
// so it starts with swipe steering instead of asking. Phones, browsers
// and hosted copies still ask.
#if #defined(ANDROID_BUILD) || #defined(PLATFORM_WEB) || #defined(WURM_PORTABLE) {
} else {
if mode < 0 { mode = 0 }
}
}
Chosen :: () -> bool { Load(); return mode >= 0 }
Pad :: () -> bool { Load(); return mode == 1 }
+143 -6
View File
@@ -45,6 +45,11 @@ TickInterval :: (level: s32) -> s64 {
}
Point :: struct { x: s32; y: s32; }
// Two rings joined: stepping into one comes out of the other.
Portal :: struct { a: Point; b: Point; }
PORTAL_PAIRS :: 2;
// The campaign certificate drives routes that never use a portal.
portals_enabled: bool = true;
Monster :: struct { position: Point; kind: s32; direction: s32; }
Particle :: struct { position: Point; life: s32; }
Game :: struct {
@@ -64,6 +69,12 @@ Game :: struct {
apple: Point
apple_flash: s32
monster_count: s32
// Points per apple on this board; see LevelMultiplier.
multiplier: s32
// Portal pairs on this board and the ticks before the next jump.
portal_count: s32
portals: [PORTAL_PAIRS]Portal
portal_wait: s32
monsters: [MONSTER_LIMIT]Monster
particles: [100]Particle
death_ticks: s32
@@ -120,7 +131,7 @@ SpawnApple :: (game: *Game) {
// the permanent interior floor, never inside those gate cells.
candidate := Point.{16 + Random(game, (board_columns - 2) * 16),
16 + Random(game, (board_rows - 2) * 16)}
if TileAt(game, candidate) < 20 && !WormNear(game, candidate, 0, 10) {
if TileAt(game, candidate) < 20 && !WormNear(game, candidate, 0, 10) && !OnPortal(game, candidate) {
game.apple = candidate
game.apple_flash = 128
return
@@ -129,7 +140,7 @@ SpawnApple :: (game: *Game) {
for at: 0..CELLS - 1 {
candidate := Point.{cast(s32)(at % board_columns) * 16 + 8, cast(s32)(at / board_columns) * 16 + 8}
if candidate.x < 16 || candidate.y < 16 || candidate.x >= (board_columns - 1) * 16 || candidate.y >= (board_rows - 1) * 16 { continue }
if TileAt(game, candidate) < 20 && !WormNear(game, candidate, 0, 10) {
if TileAt(game, candidate) < 20 && !WormNear(game, candidate, 0, 10) && !OnPortal(game, candidate) {
game.apple = candidate
game.apple_flash = 128
return
@@ -188,7 +199,95 @@ LoadLevelData :: (game: *Game, level: s32, now: s64, board: []u8, apples: s32, c
// Carve the entrance before the apple chooses its spot, so it can never
// land on a cell the carving turns into wall.
Respawn(game)
PlacePortals(game)
SpawnApple(game)
game.multiplier = LevelMultiplier(game)
}
// New ideas arrive slowly, one every twenty levels or so. Portals first
// appear at level 61 on every third board, grow to every other board from 81
// and every board from 161, with a second pair from 181.
PORTAL_FIRST :: 60
PortalPairsFor :: (level: s32) -> s32 {
if level < PORTAL_FIRST { return 0 }
if level < 80 { return ifx (level - PORTAL_FIRST) % 3 == 0 then 1 else 0 }
if level < 160 { return ifx level % 2 == 0 then 1 else 0 }
return ifx level >= 180 then PORTAL_PAIRS else 1
}
// Each ring stands in the middle of open floor, so the worm comes out safely
// in any direction and a player can always go around one. The spots follow
// from the board alone, so every player meets the same portals.
OpenAround :: (game: *Game, x: s32, y: s32) -> bool {
for dy: -1..1 {
for dx: -1..1 {
if !Inside(x + dx, y + dy) || game.board[Index(x + dx, y + dy)] >= 20 { return false }
}
}
return true
}
PortalCentre :: (cell: s32) -> Point {
return Point.{(cell % board_columns) * 16 + 8, (cell / board_columns) * 16 + 8}
}
CellsApart :: (first: s32, second: s32) -> s32 {
return Abs(first % board_columns - second % board_columns) + Abs(first / board_columns - second / board_columns)
}
PlacePortals :: (game: *Game) {
game.portal_count = 0
game.portal_wait = 0
pairs := PortalPairsFor(game.level)
if !portals_enabled || pairs == 0 { return }
candidates: [CELLS]s32
count: s32 = 0
half := board_columns / 2
for y: 3..board_rows - 4 {
for x: 2..board_columns - 3 {
// Clear of the entrance and the exit lanes.
if Abs(cast(s32)x - half) <= 2 && (y <= 5 || y >= board_rows - 6) { continue }
if !OpenAround(game, cast(s32)x, cast(s32)y) { continue }
centre := Point.{cast(s32)x * 16 + 8, cast(s32)y * 16 + 8}
crowded := false
for index: 0..game.monster_count - 1 {
if Near(centre, game.monsters[index].position, 48) { crowded = true }
}
if !crowded { candidates[count] = Index(x, y); count += 1 }
}
}
if count < 2 { return }
taken: [4]s32
taken_count: s32 = 0
for pair: 0..pairs - 1 {
first: s32 = -1
for attempt: 0..count - 1 {
cell := candidates[(cast(s64)game.level * 7919 + cast(s64)attempt * 104729 + cast(s64)pair * 31) % cast(s64)count]
free := true
for index: 0..taken_count - 1 { if CellsApart(cell, taken[index]) < 6 { free = false } }
if free { first = cell; break }
}
if first < 0 { break }
second: s32 = -1
farthest: s32 = 13
for index: 0..count - 1 {
cell := candidates[index]
apart := CellsApart(cell, first)
if apart <= farthest { continue }
free := true
for other: 0..taken_count - 1 { if CellsApart(cell, taken[other]) < 6 { free = false } }
if free { second = cell; farthest = apart }
}
if second < 0 { break }
game.portals[pair] = Portal.{PortalCentre(first), PortalCentre(second)}
taken[taken_count] = first
taken[taken_count + 1] = second
taken_count += 2
game.portal_count += 1
}
}
OnPortal :: (game: *Game, position: Point) -> bool {
for pair: 0..game.portal_count - 1 {
if Near(position, game.portals[pair].a, 12) || Near(position, game.portals[pair].b, 12) { return true }
}
return false
}
// The complete playable campaign is designed and certified. The recovered
// 99-level archive stays an independent, untouched historical reference.
@@ -464,10 +563,32 @@ MoveMonster :: (game: *Game, index: s32) {
monster.kind = monster.direction + 2
} else { monster.position = candidate }
}
AddScore :: (game: *Game, amount: s32) {
previous := game.score / 33
game.score += amount
if game.score / 33 > previous { game.lives += 1 }
// Points follow how hard a board is: its enemies (wandering ones count
// twice), the apples it asks for, how tightly its walls close in and its
// speed. The first meadows are worth one point an apple, the hardest boards
// nine. Every player gets the same multiplier for the same board.
LevelMultiplier :: (game: *Game) -> s32 {
roamers: s32 = 0
for index: 0..game.monster_count - 1 { if game.monsters[index].kind == 1 { roamers += 1 } }
walls: s32 = 0
for at: 0..board_columns * board_rows - 1 {
if game.board[at] >= 20 && (game.board[at] & 128) == 0 { walls += 1 }
}
tightness := ifx walls > 300 then (walls - 300) * 10 / 150 else 0
difficulty := 10 * game.monster_count + 10 * roamers + 5 * (game.apples - 5) + tightness +
5 * (32 - cast(s32)TickInterval(game.level))
if difficulty < 0 { difficulty = 0 }
return 1 + difficulty / 20
}
AddScore :: (game: *Game, points: s32) {
multiplier := ifx game.multiplier > 0 then game.multiplier else 1
// The extra-life step grows with the points, so a life still comes
// about every 33 apples at any level.
step := 33 * multiplier
previous := game.score / step
game.score += points * multiplier
if game.score / step > previous { game.lives += 1 }
}
AddParticle :: (game: *Game, position: Point) {
@@ -517,6 +638,22 @@ Tick :: (game: *Game) {
else if game.direction == DIR_UP { next.y -= 4 }
else if game.direction == DIR_RIGHT { next.x += 4 }
else { next.y += 4 }
// A head reaching a ring's centre comes out of its partner, keeping its
// course; the body follows through the same rings.
if game.portal_wait > 0 { game.portal_wait -= 1 }
else {
for pair: 0..game.portal_count - 1 {
portal := game.portals[pair]
from := portal.a
to := portal.b
if Abs(next.x - portal.b.x) <= 4 && Abs(next.y - portal.b.y) <= 4 { from = portal.b; to = portal.a }
else if Abs(next.x - portal.a.x) > 4 || Abs(next.y - portal.a.y) > 4 { continue }
for spark: 0..3 { AddParticle(game, from); AddParticle(game, to) }
next = Point.{to.x + next.x - from.x, to.y + next.y - from.y}
game.portal_wait = 5
break
}
}
if game.apples == 0 && next.y < 0 {
count := game.length
if count > 100 { count = 100 }
+48
View File
@@ -19,6 +19,12 @@ completed: [200]u8;
dirty: bool;
poll_at: s64;
record_name: [112]u8;
// The best run for the leaderboard: the furthest level reached and the
// highest score of any run. Each account keeps its own.
best_level: s32;
best_score: s32;
reported_level: s32 = -1;
reported_score: s32 = -1;
RecordName :: (name: string) -> string {
if owner[0] == 0 { return name }
at: s64 = 0
@@ -74,6 +80,44 @@ Load :: () {
if Records.ReadRecord(RecordName("completed.dat"), earned[:]) == 200 {
for index: 0..199 { completed[index] = ifx earned[index] == 1 then 1 else 0 }
}
best: [9]u8
if Records.ReadRecord(RecordName("best.dat"), best[:]) == 8 {
best_level = cast(s32)best[0] | (cast(s32)best[1] << 8)
best_score = cast(s32)best[4] | (cast(s32)best[5] << 8) | (cast(s32)best[6] << 16) | (cast(s32)(best[7] & 127) << 24)
if best_level > LEVELS { best_level = LEVELS }
}
}
// A finished level, a game over or the end of the journey: keep the best run
// and tell the leaderboard when it improves.
RecordRun :: (reached: s32, run_score: s32) {
Load()
level_reached := ifx reached > LEVELS then LEVELS else reached
if level_reached <= best_level && run_score <= best_score { return }
if level_reached > best_level { best_level = level_reached }
if run_score > best_score { best_score = run_score }
bytes: [8]u8 = .[cast(u8)(best_level & 255), cast(u8)((best_level >> 8) & 255), 0, 0,
cast(u8)(best_score & 255), cast(u8)((best_score >> 8) & 255), cast(u8)((best_score >> 16) & 255), cast(u8)((best_score >> 24) & 127)]
unused Records.WriteRecord(RecordName("best.dat"), bytes[:])
Report()
}
// "run LEVEL SCORE" to the host's leaderboard, once per change.
Report :: () {
if best_level == 0 || (best_level == reported_level && best_score == reported_score) { return }
shown := ifx best_score > 100000 then 100000 else best_score
out: Vec(u8)
BuilderPrint(*out, "run % %", best_level, shown)
answer := Account.Service("leaderboard", TextView(VecSlice(out, 0, out.count)))
VecFree(out)
saved := false
for index: 0..answer.count - 5 {
if answer[index:index + 5] == "saved" { saved = true }
}
if saved {
reported_level = best_level
reported_score = best_score
}
}
SaveUnlocked :: () -> bool {
@@ -134,6 +178,9 @@ Complete :: (at: s32) {
Pump :: (now: s64) -> bool {
if now < poll_at { return false }
poll_at = now + 5000
// A best run recorded before the leaderboard could take it goes now.
Load()
Report()
status := Account.Service("entity.records", "{\"operation\":\"status\"}")
current: [65]u8
if ReadStringText(status, FieldAt(status, 0, "account"), current[:]) < 0 { return false }
@@ -142,6 +189,7 @@ Pump :: (now: s64) -> bool {
owner = current
loaded = false
level = 0; lives = START_LIVES; score = 0; unlocked = 0
best_level = 0; best_score = 0; reported_level = -1; reported_score = -1
completed = .{}
dirty = false
Load()
+21 -7
View File
@@ -9,22 +9,36 @@
<link rel="canonical" href="https://wurm.waozi.xyz/">
<meta property="og:title" content="Apfelwurm — 200 levels, one little worm">
<meta property="og:description" content="Meadow, woodland, lake and mountains. A little orange worm. A long apple adventure. Play free online.">
<meta property="og:image" content="https://wurm.waozi.xyz/assets/art/title.png">
<meta property="og:image" content="https://wurm.waozi.xyz/social.jpg">
<meta property="og:url" content="https://wurm.waozi.xyz/">
<style>
*{box-sizing:border-box}html,body{margin:0;width:100%;height:100%;background:#202b26;color:#e0e7d9;font:16px system-ui,sans-serif;overscroll-behavior:none}
body{display:flex;flex-direction:column}header{height:48px;flex:none;display:flex;align-items:center;justify-content:space-between;gap:12px;padding:0 max(16px,env(safe-area-inset-right));background:#303c33;border-bottom:1px solid #52634f}
a{color:inherit;text-decoration:none}a:hover{text-decoration:underline}nav{display:flex;gap:20px;font-size:14px}#canvas-frame{flex:1;min-height:0;position:relative}canvas{display:block;width:100%;height:100%;touch-action:none;outline:none}
#loading{position:absolute;inset:0;display:grid;place-content:center;gap:16px;text-align:center;background:linear-gradient(#303c33e8,#202b26e8),url('assets/art/title.png') center/cover;font-size:18px}#loading strong{font-size:32px}#loading[hidden]{display:none}
@media(max-width:500px){header{height:42px}nav{gap:12px;font-size:12px}}
body{overflow:hidden}#canvas-frame{position:fixed;inset:0}canvas{display:block;width:100%;height:100%;touch-action:none;outline:none}
#loading{position:absolute;inset:0;display:grid;place-content:center;gap:16px;text-align:center;background:linear-gradient(#303c33e8,#202b26e8),url('loading.webp') center/cover;font-size:18px}#loading strong{font-size:32px}#loading[hidden]{display:none}
</style>
</head>
<body>
<header><a href="https://waozi.xyz/studio/#apfelwurm"><strong>Apfelwurm</strong> · Waozi</a><nav><a href="https://github.com/waozixyz/wurm/releases/latest">Android</a><a href="https://github.com/waozixyz/wurm">Source</a><a href="privacy.html">Privacy</a></nav></header>
<main id="canvas-frame"><canvas id="canvas" tabindex="0" aria-label="Apfelwurm game: choose swipe or direction pad, collect apples, then leave through the top gate."></canvas><div id="loading" role="status"><strong>A little worm.<br>A long journey.</strong><span>Opening Apfelwurm…</span></div></main>
<script>
var Module={canvas:document.getElementById('canvas'),onRuntimeInitialized(){document.getElementById('loading').hidden=true;Module.canvas.focus()},onAbort(){document.getElementById('loading').hidden=false;document.getElementById('loading').textContent='The game could not open. Please reload to try again.'},printErr(text){console.error(text)}};
// One sign-in for every waozi.xyz site: account.waozi.xyz hands over the
// shared profile before the game starts, or the game starts without it.
(function () {
var started = false;
function start() {
if (started) return;
started = true;
var game = document.createElement('script');
game.src = 'game.js';
document.body.appendChild(game);
}
var shared = document.createElement('script');
shared.src = 'https://account.waozi.xyz/share.js';
shared.onload = function () { WaoziAccount.attach(Module, 2500).then(start, start); };
shared.onerror = start;
setTimeout(start, 4000);
document.head.appendChild(shared);
})();
</script>
<script src="game.js" defer></script>
</body>
</html>
+1 -1
View File
@@ -1 +1 @@
<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Apfelwurm · Privacy</title><style>body{max-width:650px;margin:8vh auto;padding:24px;color:#e0e7d9;background:#202b26;font:18px/1.7 system-ui}a{color:inherit}</style><h1>Your journey stays with you.</h1><p>Updated 26 October 2026.</p><p>Apfelwurm stores your run, preferences and edited levels on this device. Every level can be unlocked by playing, without an account or payment. There are no ads or analytics.</p><h2>Optional accounts</h2><p>Profile uses the same Entity account provider as Shovey. You can create an account, import your account key or link another device. Private keys stay in the host's private storage. Keep exported keys and recovery codes private.</p><p>When signed in, completion marks, active playtime, website-visit unlocks, the selected skin and preferences are synced through your selected node. Account records are encrypted by the host. An unfinished run and editor drafts remain on this device. Each account's game records stay separate.</p><h2>Dew and skins</h2><p>Three optional skins cost 10, 20 or 30 Dew. Purchases require sign-in and confirmation. The Waozi node processes the account, product, price and an idempotent receipt key so retrying cannot charge twice. Purchased ownership is restored from that account's Dew ledger. You can also earn skins by playing for five hours, reaching level 40 or opening <a href="https://waozi.xyz/">waozi.xyz</a>. The website unlock records that you opened the link; it does not track your browsing.</p><p>The default node is <a href="https://api.waozi.xyz">api.waozi.xyz</a>. It receives the connection and account information needed for authentication, synchronization and Dew. Another node has its own operator and policies. Offline play does not require a network connection.</p><h2>Your data</h2><p>Profile offers key backup, device linking, logout and remote-data management on supported hosts. Logging out does not delete remote records. Clearing this site's browser data removes local saves and keys. Back up your account key before clearing browser data. For account deletion or privacy questions, contact <a href="mailto:[email protected]?subject=Apfelwurm%20account%20deletion">[email protected]</a> with your public account ID and node address. Never send your private key or recovery code.</p><p>Cloudflare hosts this site and receives ordinary connection information when you load it.</p><p><a href="/">Back to Apfelwurm</a> · <a href="https://waozi.xyz/privacy.html">Waozi privacy policy</a></p></html>
<!doctype html><html lang="en"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Apfelwurm · Privacy</title><style>body{max-width:650px;margin:8vh auto;padding:24px;color:#e0e7d9;background:#202b26;font:18px/1.7 system-ui}a{color:inherit}</style><h1>Your journey stays with you.</h1><p>Updated 27 October 2026.</p><p>Apfelwurm stores your run, preferences and edited levels on this device. Every level can be unlocked by playing, without an account or payment. There are no ads or analytics.</p><h2>Optional accounts</h2><p>Profile uses the same Entity account provider as Shovey. You can create an account, import your account key or link another device. Private keys stay in the host's private storage. Keep exported keys and recovery codes private.</p><p>When signed in, completion marks, active playtime, website-visit unlocks, the selected skin and preferences are synced through your selected node. Account records are encrypted by the host. An unfinished run and editor drafts remain on this device. Each account's game records stay separate.</p><h2>Dew and skins</h2><p>Three optional skins cost 10, 20 or 30 Dew. Purchases require sign-in and confirmation. The Waozi node processes the account, product, price and an idempotent receipt key so retrying cannot charge twice. Purchased ownership is restored from that account's Dew ledger. You can also earn skins by playing for five hours, reaching level 40 or opening <a href="https://waozi.xyz/">waozi.xyz</a>. The website unlock records that you opened the link; it does not track your browsing.</p><p>In the Google Play version, Dew is bought through Google Play. Google processes the payment; the Waozi node receives the order number, the Dew pack and Google's purchase token to confirm the purchase and add the Dew to your account. Waozi never receives your payment details. The direct download and F-Droid versions buy Dew with Monero at <a href="https://dew.waozi.xyz/">dew.waozi.xyz</a>.</p><p>The default node is <a href="https://api.waozi.xyz">api.waozi.xyz</a>. It receives the connection and account information needed for authentication, synchronization and Dew. Another node has its own operator and policies. Offline play does not require a network connection.</p><h2>Your data</h2><p>Profile offers key backup, device linking, logout and remote-data management on supported hosts. Logging out does not delete remote records. Clearing this site's browser data, or uninstalling the Android app, removes local saves and keys. Back up your account key first.</p><h2 id="delete-account">Delete your account</h2><p>You can request deletion of your account and the data Waozi's node holds for it without reinstalling Apfelwurm. Email <a href="mailto:[email protected]?subject=Apfelwurm%20account%20deletion">[email protected]</a> with the subject Apfelwurm account deletion, your public account ID and the node address. We verify that you control the account before acting. Never send your private key or recovery code. For another node, contact its operator. Deletion does not erase local saves or exported files on your devices.</p><p>Cloudflare hosts this site and receives ordinary connection information when you load it.</p><p><a href="/">Back to Apfelwurm</a> · <a href="https://waozi.xyz/privacy.html">Waozi privacy policy</a></p></html>
+2
View File
@@ -235,6 +235,8 @@ Replay :: (level: s32, portrait: bool, seed: u32, route: []Point) -> bool {
replay_deaths: s32;
#program_export
main :: (argc: s32, argv: **u8) -> s32 {
// The certificate proves every board can be won without a portal.
portals_enabled = false
search := argc > 1
first: s32 = ifx argc > 2 then ParseNumber(argv[2]) - 1 else 0
last: s32 = ifx argc > 3 then ParseNumber(argv[3]) - 1 else LEVEL_COUNT - 1
+59 -1
View File
@@ -73,6 +73,7 @@ main :: () -> s32 {
Expect(StageOf(first - 1) == stage && StageOf(first) == stage + 1, "landscape boundary")
Expect(StageNumber(first) == 1 && StageLevels(cast(s32)stage) == 40, "chapter numbering")
StartGame(*game, first - 1, 0)
multiplier := game.multiplier
game.score = 12
game.apples = 0
game.worm[0] = Point.{328, 0}
@@ -80,7 +81,7 @@ main :: () -> s32 {
for i: 0..49 { Tick(*game) }
Expect(game.mode == MODE_FINISHED, "landscapes connect without ending the run")
LoadLevel(*game, first, 2000)
Expect(game.level == first && game.mode == MODE_PLAYING && game.lives == 3 && game.score == 17,
Expect(game.level == first && game.mode == MODE_PLAYING && game.lives == 3 && game.score == 12 + 5 * multiplier,
"next landscape preserves lives and score")
}
@@ -95,9 +96,66 @@ main :: () -> s32 {
game.score = 32
AddScore(*game, 1)
Expect(game.lives == 4, "extra life every 33 points")
// Points follow each board's difficulty, not its number.
lowest: s32 = 100
highest: s32 = 0
meadow_low: s32 = 100
meadow_high: s32 = 0
for level: 0..LEVEL_COUNT - 1 {
StartGame(*game, cast(s32)level, 0)
if game.multiplier < lowest { lowest = game.multiplier }
if game.multiplier > highest { highest = game.multiplier }
if level < 40 && game.multiplier < meadow_low { meadow_low = game.multiplier }
if level < 40 && game.multiplier > meadow_high { meadow_high = game.multiplier }
}
StartGame(*game, 0, 0)
Expect(game.multiplier == 1 && lowest == 1 && highest >= 8 && highest <= 9 && meadow_high > meadow_low,
"harder boards are worth more")
StartGame(*game, 120, 0)
multiplier := game.multiplier
AddScore(*game, 1)
Expect(game.score == multiplier, "an apple scores the board's multiplier")
game.score = 33 * multiplier - 1
lives := game.lives
AddScore(*game, 1)
Expect(game.lives == lives + 1, "extra lives keep pace with the multiplier")
game.death_ticks = 1
Tick(*game)
Expect(game.lives == 3 && game.worm[0].y == 496, "death consumes a life and respawns")
// Portals arrive slowly from level 61, then rings in open floor carry
// the head across.
for level: 0..PORTAL_FIRST - 1 {
StartGame(*game, cast(s32)level, 0)
Expect(game.portal_count == 0, "no portals before level 61")
}
Expect(PortalPairsFor(60) == 1 && PortalPairsFor(61) == 0 && PortalPairsFor(81) == 0 && PortalPairsFor(82) == 1 &&
PortalPairsFor(170) == 1 && PortalPairsFor(199) == 2, "portals spread out over the journey")
portal_boards: s32 = 0
portal_level: s32 = -1
for level: 40..LEVEL_COUNT - 1 {
StartGame(*game, cast(s32)level, 0)
if game.portal_count > 0 { portal_boards += 1 }
if game.portal_count > 0 && portal_level < 0 { portal_level = cast(s32)level }
for pair: 0..game.portal_count - 1 {
a := game.portals[pair].a
b := game.portals[pair].b
Expect(OpenAround(*game, a.x / 16, a.y / 16) && OpenAround(*game, b.x / 16, b.y / 16) &&
CellsApart(Index(a.x / 16, a.y / 16), Index(b.x / 16, b.y / 16)) >= 14, "portals stand in open floor, far apart")
Expect(!Near(game.apple, a, 12) && !Near(game.apple, b, 12), "apples never land on a portal")
}
}
Expect(portal_boards >= 70 && portal_level >= PORTAL_FIRST, "portals grow common after level 61")
StartGame(*game, portal_level, 0)
portal := game.portals[0]
game.apples = 3
game.worm[0] = Point.{portal.a.x, portal.a.y + 4}
game.direction = DIR_UP
game.next_direction = DIR_UP
Tick(*game)
Expect(game.worm[0].x == portal.b.x && game.worm[0].y == portal.b.y, "the worm comes out of the partner ring")
Tick(*game)
Expect(game.worm[0].x == portal.b.x && game.worm[0].y == portal.b.y - 4 && game.death_ticks == 0, "it keeps its course out of the ring")
game.lives = 1
game.death_ticks = 1
Tick(*game)
+3 -5
View File
@@ -107,12 +107,10 @@ def main():
assert ((title_pixels.max(axis=2) > 40).mean()) > 0.95, "title artwork is missing or black"
# Launch from build/, as the actual desktop launcher does, then use
# the single Play button. Q from a paused level returns to the title.
# A desktop has a keyboard, so Play starts swipe steering without
# asking, straight into level 1: no controls, stage or level menu.
pointer(480, 530)
time.sleep(0.15)
capture("controls-choice")
pointer(340, 428)
assert (level_directory / "controls.dat").read_bytes() == bytes([0]), "swipe choice was not persisted"
# The choice goes straight into level 1: no stage or level menu.
assert not (level_directory / "controls.dat").exists(), "the desktop asked for controls"
time.sleep(0.2)
key("space")
time.sleep(0.15)
+1 -1
View File
@@ -25,7 +25,7 @@ main :: () -> s32 {
unused File.CreateDirectory("build/progress-test-data")
unused File.RemoveFile("build/progress-test-data/controls.dat")
Clear()
Expect(!Controls.Chosen(), "first play asks for controls")
Expect(Controls.Chosen() && !Controls.Pad(), "a desktop starts with swipe steering without asking")
Expect(Controls.SetPad(true) && Controls.Pad(), "choose direction pad")
Controls.mode = -2
Expect(Controls.Chosen() && Controls.Pad(), "pad survives restart")
+4 -4
View File
@@ -26,8 +26,8 @@ try{
const click=async(x,y)=>{await command('Input.dispatchMouseEvent',{type:'mouseMoved',x,y});await delay(80);await command('Input.dispatchMouseEvent',{type:'mousePressed',x,y,button:'left',clickCount:1});await delay(80);await command('Input.dispatchMouseEvent',{type:'mouseReleased',x,y,button:'left',clickCount:1});await delay(180);};
await until("typeof Module!=='undefined' && Module.FS && document.getElementById('loading').hidden");await until("(()=>{try{return Module.FS.stat('/kryon-apps').mode>0}catch{return false}})()");await delay(1800);await capture('title');
const colorful=await evaluate("(()=>{const c=document.getElementById('canvas'),p=c.getContext('2d').getImageData(0,0,c.width,c.height).data,s=new Set();for(let i=0;i<p.length;i+=80)s.add(p[i]+','+p[i+1]+','+p[i+2]);return s.size})()");if(colorful<200)throw new Error('Title artwork did not render: '+colorful);
await click(1018,82);await delay(400);await capture('profile');await click(48,78);await delay(200);
await click(1066,82);await delay(200);await capture('settings');await key('Escape',27);
await click(1018,34);await delay(400);await capture('profile');await click(48,30);await delay(200);
await click(1066,34);await delay(200);await capture('settings');await key('Escape',27);
await key('Enter',13);await delay(200);await capture('controls');await key('1',49);await until("(()=>{try{return Module.FS.readFile('/kryon-apps/wurm/controls.dat')[0]===0}catch{return false}})()");await delay(300);await capture('level-1');
await key('ArrowRight',39);await delay(150);await key(' ',32);await capture('playing');
await command('Emulation.setDeviceMetricsOverride',{width:390,height:844,deviceScaleFactor:1,mobile:true});await delay(400);await capture('portrait');
@@ -61,9 +61,9 @@ try{
if(await gridFingerprint()===beforeScroll)throw new Error('Browser selector did not scroll under touch drag');
if(!await evaluate("Module.FS.readFile('/kryon-apps/wurm/run.dat')[0]===57"))throw new Error('Dragging the selector started a level');
await capture('level-selector-scrolled');
await click(354,138);await click(90,280); // Future Pinewood shows only locks.
await click(354,96);await click(90,238); // Future Pinewood shows only locks.
if(!await evaluate("Module.FS.readFile('/kryon-apps/wurm/run.dat')[0]===57"))throw new Error('A locked browser level started');
await capture('locked-levels');await click(36,138);await click(90,280);
await capture('locked-levels');await click(36,96);await click(90,238);
await until("JSON.stringify(Array.from(Module.FS.readFile('/kryon-apps/wurm/run.dat')))==='[40,3,0,0,0,0]'");
if(!await evaluate("Module.FS.readFile('/kryon-apps/wurm/unlocked.dat')[0]===57"))throw new Error('Level selection erased progress');
await key(' ',32);await key('q',81);await key('l',76);await key('Escape',27);await key('c',67);
+68 -1
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Sign and verify both Apfelwurm Android download names, as Shovey does."""
"""Sign and verify both Apfelwurm Android download names and the Google Play bundle, as Shovey does."""
import argparse
import hashlib
import json
@@ -9,6 +9,7 @@ import re
import shutil
import subprocess
import tempfile
import xml.etree.ElementTree as ET
import zipfile
ROOT = Path(__file__).resolve().parents[1]
@@ -66,6 +67,47 @@ def verify(apk):
sha256=hashlib.sha256(apk.read_bytes()).hexdigest(), certificate_sha256=expected)
def verify_bundle(bundle, bundletool):
version = json.loads((ROOT / 'version.json').read_text())
subprocess.run(['java', '-jar', str(bundletool), 'validate', '--bundle=' + str(bundle)],
check=True, stdout=subprocess.DEVNULL)
manifest = ET.fromstring(subprocess.check_output(['java', '-jar', str(bundletool), 'dump', 'manifest',
'--bundle=' + str(bundle)], text=True))
android = '{http://schemas.android.com/apk/res/android}'
assert manifest.get('package') == 'xyz.waozi.wurm'
assert manifest.get(android + 'versionName') == version['version']
assert int(manifest.get(android + 'versionCode')) == version['version_code']
assert int(manifest.find('uses-sdk').get(android + 'targetSdkVersion')) >= 35, 'Google Play needs a current target SDK'
assert manifest.find('application').get(android + 'debuggable') != 'true', 'A debug bundle cannot be released'
environment = dict(os.environ, LC_ALL='C')
assert 'jar verified.' in subprocess.check_output(['jarsigner', '-verify', str(bundle)], text=True, env=environment)
certificate = subprocess.check_output(['openssl', 'x509', '-in', str(ROOT / 'packaging/android/certificate.pem'), '-outform', 'DER'])
expected = hashlib.sha256(certificate).hexdigest()
found = re.findall(r'SHA256:\s*([A-Fa-f0-9:]+)', subprocess.check_output(
['keytool', '-printcert', '-jarfile', str(bundle)], text=True, env=environment))
assert found and {item.replace(':', '').lower() for item in found} == {expected}, 'Unexpected upload certificate'
with zipfile.ZipFile(bundle) as archive:
abis = sorted({name.split('/')[2] for name in archive.namelist() if re.fullmatch(r'base/lib/[^/]+/libmain\.so', name)})
assert abis == ['arm64-v8a', 'armeabi-v7a'], 'Both ARM architectures are required'
with tempfile.TemporaryDirectory(dir=ROOT / 'build') as directory:
for name in archive.namelist():
if not name.startswith('base/lib/arm64-v8a/') or not name.endswith('.so'):
continue
library = Path(directory) / Path(name).name
library.write_bytes(archive.read(name))
headers = subprocess.check_output(['readelf', '-lW', str(library)], text=True)
loads = [line.split() for line in headers.splitlines() if line.strip().startswith('LOAD ')]
assert loads and all(int(parts[-1], 16) >= 16384 for parts in loads), 'Native libraries require 16 KB load alignment'
for name in ('title.png', 'title-portrait.png', 'stage-covers.png'):
assert archive.read('base/assets/assets/art/' + name) == (ROOT / 'assets/art' / name).read_bytes(), name
assert not any(name.startswith('base/assets/assets/campaign-levels/') for name in archive.namelist()), 'Personal campaign edits must stay private'
assert archive.read('base/assets/assets/entity.zx') == (ROOT / 'build/profile/entity.zx').read_bytes(), 'The shared Profile must be packaged'
dex = b''.join(archive.read(name) for name in archive.namelist() if name.startswith('base/dex/'))
assert b'Lorg/kryonlabs/play/PlayBilling;' in dex, 'The Google Play edition must include Play Billing'
return dict(version=version['version'], version_code=version['version_code'], package='xyz.waozi.wurm', abis=abis,
sha256=hashlib.sha256(bundle.read_bytes()).hexdigest(), certificate_sha256=expected)
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('action', choices=('sign', 'verify'))
@@ -73,7 +115,32 @@ def main():
parser.add_argument('--keystore', type=Path, default=ROOT / 'backup/android-signing/wurm-release.p12')
parser.add_argument('--password-file', type=Path, default=ROOT / 'backup/android-signing/password')
parser.add_argument('--output', type=Path, default=ROOT / 'build/downloads')
parser.add_argument('--bundletool', type=Path, help='Google bundletool JAR, required for .aab files')
args = parser.parse_args()
if args.apk.suffix == '.aab':
assert args.bundletool, '--bundletool is required for a Google Play bundle'
bundle = args.apk.resolve(strict=True)
if args.action == 'sign':
args.output.mkdir(parents=True, exist_ok=True)
version = json.loads((ROOT / 'version.json').read_text())['version']
bundle = args.output / f'wurm-v{version}-gplay.aab'
temporary = args.output / 'wurm.new.aab'
try:
subprocess.run(['jarsigner', '-keystore', str(args.keystore.resolve(strict=True)),
'-storepass:file', str(args.password_file.resolve(strict=True)),
'-signedjar', str(temporary), str(args.apk.resolve(strict=True)), 'wurm'], check=True)
result = verify_bundle(temporary, args.bundletool.resolve(strict=True))
temporary.replace(bundle)
finally:
temporary.unlink(missing_ok=True)
else:
result = verify_bundle(bundle, args.bundletool.resolve(strict=True))
records = ROOT / 'backup/android-release'
records.mkdir(parents=True, exist_ok=True)
(records / 'play-verification.json').write_text(json.dumps(result, indent=2) + '\n')
print(f'Apfelwurm {result["version"]} ({result["version_code"]}): Google Play bundle identity, version, '
'both ARM architectures, upload signature, alignment and current assets verified.')
return
if args.action == 'verify':
verify(args.apk)
else:
+15 -4
View File
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
"""Build Apfelwurm's native debug APK, including its art, scores and levels."""
"""Build Apfelwurm's native APK or Google Play bundle, including its art, scores and levels."""
import argparse
import json
import os
@@ -23,6 +23,8 @@ def main():
parser = argparse.ArgumentParser()
parser.add_argument('--abi', choices=('arm64-v8a', 'armeabi-v7a', 'universal'), default='arm64-v8a')
parser.add_argument('--release', action='store_true', help='build the unsigned production APK for signing')
parser.add_argument('--bundle', action='store_true',
help="build the unsigned Google Play edition's App Bundle for signing")
parser.add_argument('--verification', action='store_true',
help='build a separate test install without replacing the normal game')
args = parser.parse_args()
@@ -56,8 +58,8 @@ def main():
# The account provider uses the same native cryptography on both ABIs.
# These changes belong to this app's generated scaffold, never Kryon's.
cmake = ROOT / 'droid/app/src/main/cpp/CMakeLists.txt'
text = cmake.read_text().replace('set(APP_ZIRAN_DEFINES --define ANDROID_BUILD)',
'set(APP_ZIRAN_DEFINES --define ANDROID_BUILD --define WURM_ACCOUNTS)')
text = re.sub(r'set\(APP_ZIRAN_DEFINES --define ANDROID_BUILD[^)]*\)',
'set(APP_ZIRAN_DEFINES --define ANDROID_BUILD --define WURM_ACCOUNTS)', cmake.read_text(), count=1)
text = text.split('\n# Apfelwurm account libraries\n')[0]
text += f'''
# Apfelwurm account libraries
@@ -95,14 +97,23 @@ target_link_libraries(main oqs)
aapt = sdk / 'build-tools/36.0.0/aapt2'
assert aapt.exists(), 'Install Android build-tools 36.0.0'
abis = 'arm64-v8a,armeabi-v7a' if args.abi == 'universal' else args.abi
task = 'assembleRelease' if args.release else 'assembleDebug'
task = 'bundleRelease' if args.bundle else 'assembleRelease' if args.release else 'assembleDebug'
command = ['sh', 'droid/gradlew', '-p', 'droid', '--no-daemon', '--max-workers=1', task,
'-Pkryon.dir=' + str(kryon), '-Pziran.dir=' + str(ziran), '-Praylib.dir=' + str(raylib / 'src'),
'-Papp.abis=' + abis, '-Papp.minSdk=21', '-Papp.codegen=c99',
'-Pandroid.aapt2FromMavenOverride=' + str(aapt)]
# Kryon's Google Play edition adds Play Billing, so Dew is bought through Play.
if args.bundle:
command += ['-Papp.edition=gplay', '-Pandroid.useAndroidX=true']
install_id = 'xyz.waozi.wurm.verification' if args.verification else 'xyz.waozi.wurm'
command.append('-Papp.installId=' + install_id)
subprocess.run(command, cwd=ROOT, env=environment, check=True)
if args.bundle:
target = ROOT / 'build/android/Apfelwurm-release-unsigned.aab'
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(ROOT / 'droid/app/build/outputs/bundle/release/app-release.aab', target)
print('Built ' + str(target))
return
label = 'Apfelwurm-verification-' if args.verification else 'Apfelwurm-'
variant = 'release' if args.release else 'debug'
suffix = '-release-unsigned.apk' if args.release else '-debug.apk'
+6
View File
@@ -76,6 +76,12 @@ def main():
for source in (ROOT / 'src/web').iterdir():
if source.is_file():
shutil.copy2(source, OUT / source.name)
# The page shows the title art while the game loads and in link previews.
# Small copies keep that first paint fast; the game keeps the original.
from PIL import Image
title = Image.open(ROOT / 'assets/art/title.png').convert('RGB')
title.resize((1280, 853), Image.Resampling.LANCZOS).save(OUT / 'loading.webp', 'WEBP', quality=86, method=6)
title.resize((1200, 800), Image.Resampling.LANCZOS).save(OUT / 'social.jpg', 'JPEG', quality=88, optimize=True, progressive=True)
version = json.loads((ROOT / 'version.json').read_text())['version']
revision = subprocess.check_output(['git', 'rev-parse', 'HEAD'], cwd=ROOT, text=True).strip()
(OUT / 'version.json').write_text(json.dumps({'version': version, 'revision': revision,
+2 -2
View File
@@ -1,4 +1,4 @@
{
"version": "0.2.2",
"version_code": 12
"version": "0.2.7",
"version_code": 17
}
+18 -18
View File
@@ -3,7 +3,7 @@
"packages": [
{
"commit": "dc1cfe389905c63c0bb453727d06d72afc1fa0b0",
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p3127065409ca96f6"},
"dependencies": {"crypto": "pc23fbf455e97614d", "kryon": "p974af619ca377b85"},
"id": "p00b93f1ddcd2802f",
"name": "Apps",
"ref": "master",
@@ -17,14 +17,6 @@
"ref": "master",
"url": "https://github.com/ziranlang/qrcode.git"
},
{
"commit": "0931212f92d5f1a3f8b1be80abab7a9695bda50e",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "p3127065409ca96f6",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "e1f480f382d9443c4412133b55948374c77a5c21",
"dependencies": {},
@@ -34,14 +26,6 @@
"source": true,
"url": "https://github.com/open-quantum-safe/liboqs.git"
},
{
"commit": "ca637d08b0d6b54ab6bb56bbfd9a25d7fb70f56c",
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "p3127065409ca96f6", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "p52862c0351d05875",
"name": "Entity",
"ref": "master",
"url": "https://github.com/waozixyz/entity.git"
},
{
"commit": "fafa2cea97d0cb379d832086ba45a989fa6f9c8e",
"dependencies": {},
@@ -68,6 +52,14 @@
"source": true,
"url": "https://github.com/LoupVaillant/Monocypher.git"
},
{
"commit": "3fad22341997f7c58ed1b11b1e88217358e51af5",
"dependencies": {"raylib": "p5a77c9c35110e925"},
"id": "p974af619ca377b85",
"name": "kryon",
"ref": "master",
"url": "https://github.com/kryonlabs/kryon.git"
},
{
"commit": "25d9f649c43a8de44a5fea602d2835e33e6ca999",
"dependencies": {"crypto": "pc23fbf455e97614d", "oqs": "p7098ac9cd92f7e5f"},
@@ -76,6 +68,14 @@
"ref": "master",
"url": "https://github.com/ziranlang/daochi-client.git"
},
{
"commit": "dc4946f0be5c15c15f79bd7cd69df8222e6c1b0d",
"dependencies": {"daochi_client": "p9972fcdd2d5ba999", "kryon": "p974af619ca377b85", "monocypher": "p809b4d31a48625a3", "qrcode": "p0dfa70137405b096"},
"id": "pa3f5fd1ab5a1f780",
"name": "Entity",
"ref": "master",
"url": "https://github.com/waozixyz/entity.git"
},
{
"commit": "944826f70779a6b6cd53f6b06a75b36f4d8a2558",
"dependencies": {},
@@ -94,7 +94,7 @@
}
],
"root": {
"dependencies": {"apps": "p00b93f1ddcd2802f", "entity": "p52862c0351d05875", "kryon": "p3127065409ca96f6", "mingcute": "pe1027b9d16704793"},
"dependencies": {"apps": "p00b93f1ddcd2802f", "entity": "pa3f5fd1ab5a1f780", "kryon": "p974af619ca377b85", "mingcute": "pe1027b9d16704793"},
"name": "Apfelwurm"
},
"toolchain": {