Files
iron-arc/docs/status/autonomous-log.md
T
SoftwareApp 92b5ef16cb m7c: brand splash instead of the white startup screen
- LaunchTheme/NormalTheme on #05070A (was the stock light theme + white
  windowBackground) and the Android 12 splash API in values-v31
- splash icon is a padded 512x512 canvas: Android masks everything outside the
  inner 192dp of the 288dp icon area, which clipped the wordmark at the top;
  the icon plate is set to the icon navy
- Flutter splash (lib/src/ui/splash_screen.dart): logo pulses (scale 0.96-1.04,
  opacity 0.72-1.0, 1100 ms) plus a thin progress line, min 700 ms measured
  from the first Flutter frame
- boot work (session, FFI library, ad SDK) now runs after the first frame and
  the game fades in over the splash: no blocking work before the first frame
- numbers (Redmi Note 10, API 31): debug 3053 ms, profile/AOT 2040 ms on the
  first start, 850-960 ms on later cold starts, ready log ~1030 ms
- fixed: top-level Stopwatch only started on first access (Dart lazily
  initialises top-level finals), so the boot log always showed 0 ms
- tools/device/startup.sh measures cold start + boot log; testing.md documents
  the splash chain and the MIUI release-install trap
2026-10-25 02:34:09 +02:00

176 lines
9.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Autonomer Arbeitsbericht
| Feld | Wert |
|---|---|
| Datum | 2026-10-24 |
| Modus | Act Mode, ohne Rückfragen (Nutzer abwesend) |
| Ergebnis | **M0 und M1 vollständig, Gates bestanden** |
---
## Umgebungshinweise (wichtig für die nächste Session)
- Die **Shell-Integration des Terminals ist defekt**: Befehle werden ausgeführt, aber die Fertigstellung wird nicht erkannt. Workaround: Ausgaben nach `/tmp/*.txt` umleiten und mit dem Datei-Reader prüfen. Ein Neustart des Terminals/der Session behebt das.
- Mehrere Kommandos in *einem* Aufruf werden parallel ausgeführt und können sich bei Heredocs gegenseitig stören. **Regel: ein Schreibvorgang pro Befehl(skette).**
- `flutter config --jdk-dir=/usr/lib/jvm/java-21-openjdk-amd64` ist gesetzt (JDK 25 meiden).
- `PATH` muss `~/Android/Sdk/platform-tools` zuerst enthalten (zwei adb-Binaries vorhanden).
## M0 — Skeleton & Toolchain (erledigt)
| Ergebnis | Beleg |
|---|---|
| Cargo-Workspace mit 5 Crates (`sim`, `content`, `ffi`, `server`, `balance`) | `cargo build --workspace` grün (11,5 s) |
| `rust-toolchain.toml` inkl. Android-Targets | Targets installiert |
| Flutter-App (`app/`, `com.ironarc.iron_arc`) | `flutter create`, 27 getrackte Dateien |
| `compileSdk/targetSdk 36`, `minSdk 24`, NDK 28.2 gepinnt | `android/app/build.gradle.kts` |
| Debug-APK baut | `flutter build apk --debug` (100,6 s) |
| Rust-CDylib für 3 ABIs im APK | `lib/arm64-v8a/libffi.so`, `armeabi-v7a`, `x86_64` |
| **16-KB-Page-Size** | alle LOAD-Segmente `0x4000` |
| Build-Skript mit Alignment-Check | `tools/build_rust_android.sh` |
| CI-Gate | `tools/ci.sh` (fmt, clippy -D warnings, Float-Grep, Tests) |
## M1 — Sim-Kern (erledigt)
| Modul | Inhalt |
|---|---|
| `fixed.rs` | Q16.16, `mul/div/sqrt/dist`, Trigonometrie über LUT, Floor-Rundung |
| `trig_table.rs` | 1 025 Stützstellen, **eingecheckt** (nicht zur Build-Zeit erzeugt → plattformunabhängig) |
| `rng.rs` | eigener PCG32, gepinnte Referenzsequenz |
| `terrain.rs` | Heightmap (1 024 Samples), 3 Materialien, Krater, beidseitiger Sand-Kollaps |
| `weapons.rs` | 6 Waffen als Datentabelle |
| `state.rs` | Tanks, Züge, Timer, Ballistik, Schaden, Lava, Sudden Death, State-Hash |
| `hash.rs` | FNV-1a-Kette, Testvektoren |
| `replay.rs` | Replay v1 (serde), **Verifikation durch Re-Simulation**, Tamper-Erkennung |
**Gates**
- 32 Tests grün, davon `thousand_seeds_are_reproducible` (1 000 Seeds, identischer Hash)
- Replay: `verify()` reproduziert `final_hash`; manipulierter Seed ⇒ abweichender Hash
- Clippy `-D warnings` clean, `cargo fmt` angewendet
- Kein `f32`/`f64` in `crates/sim` (per Lint und CI-Grep)
**Bewusste Vereinfachungen (dokumentiert, nicht vergessen)**
- MIRV teilt sich noch nicht auf (Einzelprojektil).
- Panzer-Ultimates und Panzer-Passivwerte noch nicht implementiert.
- Roller rollt noch nicht bergab; Digger nutzt denselben Krater-Pfad.
- Schaden fällt linear statt quadratisch ab (Balancing-Entscheidung offen).
- Spawn-Positionen fest (220 / WORLD_W-220); Karten-Presets folgen in M2.
## Gerät verifiziert (2026-10-24)
| Punkt | Wert |
|---|---|
| Gerät | Xiaomi M2101K7AG (Redmi Note 10), Android 12 / API 31, `arm64-v8a` |
| Display | 1080x2400 @ 440 dpi, 60 Hz, Notch 93 px, Ecken 106 px |
| GPU / RAM | Adreno 612 / 3,5 GB |
| APK | Debug, arm64-only, 144 MB (inkl. Debug-Symbole) |
| FFI | `DynamicLibrary.open("libffi.so")` → `iron_arc_abi_marker` = `1a2b3c4d` |
| **Determinismus** | Geräte-Hash == Host-Hash: `11470816335946967992` (Seed 42, 300 Ticks) |
| Nachweis | Screenshot mit grünem Banner „DETERMINISM PASS (arm64 == x86_64)" |
| Tooling | `tools/device/{steckbrief,install,smoke,perf,logs}.sh` |
**Lesson learned:** Dart-`int` ist vorzeichenbehaftet. Ein `uint64`-Rückgabewert muss als
`BigInt.toUnsigned(64)` formatiert werden, sonst zeigt die UI einen falschen „Mismatch"
(`-6975927737762583624` ist bitgleich mit `11470816335946967992`).
## M2 — Content & Balance (erledigt)
| Ergebnis | Beleg |
|---|---|
| `crates/content` mit JSON als einzige Datenquelle | `assets/content.json`: 6 Waffen, 4 Panzer, 2 Karten |
| Validierung + `content_hash` | 6 Tests (Duplikate, Wertebereiche, Hash-Sensitivität) |
| Sim konsumiert Content statt hartkodierter Tabelle | `weapons.rs` entfernt, `content_hash` ist Teil des State-Hash |
| Balance-CLI mit KI + CSV | `tools/balance`: 100 000 Matches in **19,1 s** |
| Balance-Befunde | [balance-m2.md](balance-m2.md) – 5 Probleme gefunden und behoben |
| Geräte-Gegencheck | Hash `6237310299140737418` auf arm64 == x86_64 (Screenshot) |
**Wichtigste Erkenntnisse:** Wind war 5× zu stark, Panzer folgten dem Terrain nicht, der lineare
Schadensfalloff machte Beinahetreffer wertlos (0 Kills/500 Matches), und ohne alternierenden
Startspieler hatte Spieler 0 einen 59/40-Vorteil.
## M3a — Spielbarer Flame-Client (erledigt)
| Ergebnis | Beleg |
|---|---|
| C-ABI-API für Matches | `crates/ffi/src/match_api.rs`, 13 Funktionen, 4 FFI-Tests inkl. Match-Roundtrip |
| Dart-Wrapper | `app/lib/src/native/native_match.dart` (Zero-Copy-Terrain-View) |
| Flame-Renderer | Terrain aus Heightmap-Path, Panzer, Projektil, Zielpunkte, Kraftbalken, Impact-Flash |
| Kamera | Zoom auf Welthöhe, horizontaler Follow (Panzer/Projektil), Drag-Empfindlichkeit 250 Welt- px = Vollkraft |
| HUD | HP-Pills, Zug, Wind, Hinweis, Game-Over-Overlay mit Rematch |
| **Gerätenachweis** | Schuss per `adb input swipe` gefeuert: Zug 1 → Projektil im Flug → Krater → Zug 2 (Screenshots) |
| **Performance** | `tools/device/perf.sh`: **60,0 fps**, p50 16,66 ms, p90 16,83 ms, p99 17,02 ms, **Jank 0,0 %** |
**Erkenntnisse**
- `dumpsys gfxinfo` ist für Flutter-Apps wertlos (HWUI rendert 0 Frames) – Messung über SurfaceFlinger-Layer nötig.
- Layer-Namen mit Klammern brechen `adb shell`-Quoting; Lösung: lokal doppelt, remote einfach quoten.
- Fit-to-world-Transform verschenkt im Portrait 3/4 des Screens → Kamera mit Höhen-Fit ist Pflicht.
## M4 — Referee-Server (erledigt)
| Punkt | Umsetzung |
|---|---|
| Stack | axum + tokio, SQLite (sqlx), Tower-Middleware |
| Auth | Signierter Geräte-Token, Ablauf, Replay-Schutz |
| Rate-Limit | Token-Bucket pro Gerät/IP, 429 mit `Retry-After` |
| Validierung | Replay wird serverseitig nachgerechnet; Manipulation → **409** |
| Lasttest | 342 k Anfragen/s im synthetischen Benchmark (Axum+SQLite auf dieser Maschine) |
## M5 — Client↔Server-Sync (erledigt)
- `MatchSession` kapselt online/offline; Offline-Queue mit persistenter Warteschlange.
- Replay-Wiedergabe im Client (gleiche Pfade wie Live-Match).
- 6 Bugs beim Zusammenführen gefunden und behoben (u. a. `BigInt.toInt()`-Clamping,
u64-Hashes als JSON-Zahl > 2^53).
## M6 — Release-Pipeline (erledigt)
- HP 150, R8/ProGuard, `native-debug-symbols.zip`, signiertes AAB, Store-Assets.
- 16-KB-Page-Check ABI-bewusst (`armeabi-v7a` 4 KB, 64-bit 16 KB).
## M7a/M7b — AdMob + UMP-Consent (erledigt 2026-10-25)
| Punkt | Nachweis |
|---|---|
| App-ID + Test-Units | Rewarded auf Gerät angesehen (`onUserEarnedReward` gefeuert) |
| Consent-Nachricht | In AdMob veröffentlicht; Formular erscheint auf dem Redmi |
| Reihenfolge | `consent=ConsentStatus.obtained` **vor** `SDK initialised` → keine Ad-Anfrage ohne Einwilligung |
| Einstiegspunkt | Zahnrad → Datenschutz-Optionen öffnet das Formular erneut |
## M7c — Startzeit & Splash (erledigt 2026-10-25)
**Problem:** 5 s weisser Bildschirm vor dem ersten Frame (Stock-`launch_background` mit
`@android:color/white`, dazu die gesamte Bootarbeit vor dem ersten Frame).
| Massnahme | Datei |
|---|---|
| Launch- und Normal-Theme dunkel (`#05070A`), Status-/Nav-Bar gleich | `res/values/styles.xml`, `values-night`, `values/colors.xml` |
| Androids Splash-API ab 31: Markenfarbe, beschnitt-sicheres Icon, Icon-Platte in Icon-Navy | `res/values-v31/styles.xml`, `res/drawable-xxxhdpi/launch_logo{,_splash}.png` |
| Pulsierendes Logo + Fortschrittslinie waehrend der Bootarbeit | `lib/src/ui/splash_screen.dart` |
| Boot (Session, native Lib, Ad-SDK) erst **nach** dem ersten Frame, Splash mit Mindeststandzeit | `lib/main.dart` (`_bootstrap`) |
| Logo-Mark aus dem Store-Icon freigestellt (Alpha-Ramp + Un-Premultiply, kein Navy-Saum) | `store/assets/logo_mark.png` → `app/assets/logo_mark.png` |
**Messung** (Redmi Note 10, API 31, Consent erteilt): Debug 3053 ms, Profile/AOT **2040 ms**,
`iron_arc: ready after` 1740 / **1037 ms**. Neues Skript `tools/device/startup.sh`.
**Erkenntnisse**
- Android 12 maskiert beim Splash-Icon alles ausserhalb der inneren 192 dp eines 288-dp-Bereichs →
ein breites Wortmarken-Logo wird oben/unten abgeschnitten; Loesung ist eine 512×512-Vorlage mit
Motiv auf 59 % Breite.
- Die Icon-Platte ist ueber `windowSplashScreenIconBackgroundColor` steuerbar (mit Testfarbe Rot
verifiziert), Groesse ~153 dp.
- `am start -W` zaehlt den UMP-Dialog mit (7863 ms statt 3076 ms) → nur nach erteiltem Consent messen.
- Dart initialisiert Top-Level-`final`s **lazy**: `final Stopwatch _bootWatch = Stopwatch()..start();`
startete erst beim ersten Zugriff (Bootlog 0 ms). Jetzt Start in `main()`.
- MIUI verweigert `adb install` von release-signierten APKs (`INSTALL_FAILED_USER_RESTRICTED`) →
fuer Messungen `--profile` (AOT, debug-signiert).
## Nächste Schritte (aktualisiert)
1. `bundletool build-apks --connected-device` aus `~/exports/iron-arc-0.7.0.aab` → Install → Smoke.
2. AdMob: echte Unit-IDs einsetzen (Test-IDs nur für Debug).
3. Play Console: App anlegen, Data Safety, IARC, Internal Testing.
4. Keystore auf zwei Offline-Medien sichern.
5. M7c: Play Billing + Kontolöschung, oder symmetrische Ranked-Maps.