17 KiB
v1.2 original offline battle runtime — development build
Updated 2026-11-08. The original compiled engine now completes actual offline
scenes through BattleCenter → BattleGround → BattlePanel.battleCompleteHandler.
Ordinary stage, embedded task battle, and task passStage each have a completed
snapshot-driven native scene with original statistics and original checks.
This is executable development functionality; complete game coverage, matching
the current live resources, and server acceptance have not been established.
No game API actions were performed for this validation.
Frozen development checkpoint: scope stopped at the user's quota request.
The fixed bridge completed the cached roster in all three contexts with
cheatNum=0 and two retained player checks per scene. Its actual cached team has
two occupied slots. The final identity comparison accepts original decimal-string
audit IDs without modifying either output. Revalidation of all three existing
executed callback bodies passes; no additional native trial was launched.
Automatic native admission is deliberately disabled by
NATIVE_ADMISSION_ENABLED=False pending final Engine/native/fake-client integration
QA. Offline execution remains available. This is an integration checkpoint,
not a restriction based solely on untested server acceptance.
Public integration contract
The runtime accepts BattleRequest or the equivalent dictionary:
request = BattleRequest(
context="ordinary_stage", stage_id="0101", difficulty=1,
original_data={"battle": canonical_original_battle},
roster=raw_master_snapshot, team="teamB",
battle_position={"battleType": "stage", "stageId": "0101",
"stageLevel": "1", "taskTypeId": None, "taskStep": 0},
)
runtime = BattleRuntime() # optional config: {"backend": "original_air"}
capability = runtime.inspect(request)
result = runtime.run(request, cancel_event=event, timeout=None)
roster={"snapshot": raw_master_snapshot, "team_name": "teamB"} is also
accepted for CLI callers. Both forms normalize to the same native input.
An explicit team is required. Conflicting selectors refuse; no default changes
teamB to teamA. Requests are copied once before inspection and execution.
original_data optionally accepts source="original_apk" and the exact pinned
resource_identity; it never accepts executable commands, replacement tables,
an estimated result, or a manifest claiming verification.
| Context | Original config selected | Native BattlePosition |
|---|---|---|
ordinary_stage |
stage_info[stage_id].level[difficulty].battle |
battleType=stage, string stage ID/level |
task_battle |
task_info[type_id].steps[step_index].battle, status battle |
battleType=task, task type and zero-based step |
task_pass_stage |
stage/level from the original step's statusValue, status passStage |
Same task position; no ordinary-stage result substitution |
With canonical orchestration requests, battle_position.taskTypeId identifies
the original task definition; task_id may retain the account task-instance ID.
Without battle_position, legacy CLI task requests use task_id for the original
task type. Task step conflicts and wrong supplied positions refuse. The supplied
battle must equal the independently decoded original config for that context.
The engine-side runtime_request must retain battle, team, and
battle_position; an identity-only request cannot reconstruct the selected team.
inspect returns supported, offline_supported, specific reasons, original
resource identity, input coverage, native position, original battle duration, and
derived watchdog. Support refers to offline execution of those supplied inputs,
not to every stage or skill having an observed test. The complete original SWF
contains the combat implementations; this adapter does not handport skill math.
Unknown controllers, effects, formations, data shapes, and required missing images
refuse. The native bridge additionally validates and constructs the snapshot.
An unseen dynamic dependency can still fail execution and produce no outcome.
Validated snapshot execution reports original-code fidelity (faithful=True,
approximate=False); diagnostic fixtures and invalid inputs do not qualify.
settlement_eligible=False remains enforced at this frozen checkpoint pending
final integration QA. server_acceptance_verified=False and the compatibility
alias server_validated=False are independent of original-code fidelity.
The implemented eligibility path requires original input/resource validation,
natural completion, zero original check points, callback/roster/route binding,
complete original statistics, and a valid asset audit. Strict synchronized trace
parity and current server resource matching remain unverified. Online orchestration
must gate before starting a battle.
Successful run results contain status="completed", battle_executed=True,
battle_completed=True, outcome, and offline_result with the actual original
battle_data, anomaly_records, per-unit original records, timing, and terminal
reason. Positive original cheatNum yields status="anomaly", preserves the
completed native evidence, and keeps eligibility false. Unsupported, cancelled,
technical timeout, or failed jobs do not return an outcome or BattleData.
Interrupted worker execution is battle_executed=None when progress is unknown;
pre-start refusal/cancellation is False.
Native execution and artifact identity
REA inspected the shipped original APK; retained AS3 was used for focused call inspection, not rebuilt as a replacement engine. The shipped identities are:
| Resource | Identity |
|---|---|
| APK 1.9.68 SHA-256 | 01678ee3a8465d818d32cbbd94baa0d8253b04b4c57b70ebc5544ed341f1015d |
assets/MYRMain.app SHA-256 |
c6838331a198a22ffa486cbf61cc74c97619e011bc3364c8bb8dc99e269036cf |
| Main SWF header | Version 50, 50 FPS, 640×960 RECT; FPS was decoded separately from the version byte |
| Local SDK | Official AIR SDK 51.5.1.1, Windows x64; executable/JAR/SWC pins in trusted.py |
swf_library.py removes document-class binding ID 0 and makes DoABC blocks lazy.
All 1,641 main ABC payloads remain byte-identical; 1,324 eager flags change.
Executable/import tags are refused. Neither the original game document class nor
the loader's login/update startup executes. Framework, main, UI, and movieclip
library copies load into one child ApplicationDomain. No native extension, phone,
rooting, protection bypass, rebuilt APK, or modified battle code is required.
OriginalProbe.as is a small compiled bootstrap. It injects original compressed
AMF tables using native ByteArray.readObject, initializes the generic display
framework, invokes SnapshotBridge.build, and starts the stock BattleCenter.
Stock movement, AP, AI, skills, collisions, animation callbacks, timers, result
statistics, and cheat checks execute. Only local win/loss observers are installed;
the harness never forces a winner. Component probes are a separate action, so they
do not consume random values or temporary unit IDs before a scene.
All original NetCenter service bases are replaced with a nonexistent local file URI before snapshot/scene construction. The image hook refuses URL/colon/path traversal inputs; sounds are disabled through original settings. Completion checks the original NetCenter request counter is zero. Python execution imports no game transport. This is deliberate transport isolation and neutralized startup, not a claim of an OS network sandbox around arbitrary AIR code.
The correct launcher is adl64.exe -runtime ... -nodebug -profile extendedDesktop descriptor.xml -- .... The x86 launcher returned exit 4;
misordered -runtime arguments were rejected. ADL uses the SDK runtime without a
global installation. -cmd is unsuitable because its stage is null; the game uses
display objects and frame callbacks. See official ADL documentation.
Assets, callbacks, and timing
Normal preparation builds a ZIP-entry index directly from the pinned APK: original hashed resource key, local-header data offset, compressed size, size, method, and CRC32. It verifies local/central metadata and entry bounds. Native FileStream reads the original packed bytes, decompresses ZIP deflate, verifies size/CRC, and passes those bytes to the original image decoder. Reading a new unit's assets does not require extracting the 1.4 GB resource tree. Existing earlier extracts remain ignored. Post-run audit compares every observed resource with the APK ZIP metadata. The native compression API is documented in the official ByteArray reference.
An absent required image refuses. Empty optional frame declarations that are
also absent from the original APK retain the original local IO-error callback;
their paths remain in evidence. No replacement pixels or fabricated completion
callbacks are supplied. The base slime's original 1001010_q_2s.png absence is one
such observed fallback. Native skill effects and additional spawned-unit assets
are audited when read; an unapproved missing dependency stops the scene.
The stage runs hidden, 640×960, at the original 50 FPS. The harness records a separate ENTER_FRAME/100 ms Timer sample and full-scene frames/wall time, plus original frame-driver callback/delta observations. Initial short cold samples were about 42.7 FPS; full 1-1 scenes were about 49 FPS. New measurements include a 300 ms warm-up and 2.5-second observation window. The subsequent three hidden samples measured 48.26–48.30 FPS and 22 Timer ticks over 2.505–2.527 seconds; the repeated task scene measured 47.45 FPS over 7.566 seconds. Requested FPS is never presented as measured FPS. Hidden-window execution is demonstrated on this workstation; timing under another host's background throttling remains an environment limit.
A critical bootstrap error was fixed: original EnterFrameDriver's constructor
already calls startup(). Calling it again created a second ENTER_FRAME source,
corrupted delta timing, and froze a skill pause. The harness now only registers
its observer. Earlier 30-FPS and stalled 50-FPS evidence remains retained, and is
not counted as correct original-timing validation.
The default technical watchdog is 2 × original battle seconds + 90 (690 s for
the original 300-second normal limit). An explicit caller deadline is preserved,
including source inspection and bootstrap. Cold APK hashing checks cancellation
and the deadline between chunks; a 0.1-second cold deadline returned in 0.103 s
without launching combat. Natural native clock completion is a completed native
result with terminal_reason="time_limit"; winner still comes from original
rules, including survival scenes that win on time. A technical watchdog supplies
no BattleData and never changes the battle's original time limit.
Observed completed native scenes
The following runs use unchanged original battle configs. Synthetic selected IDs
exceed the NPC/player-check exemption threshold. Every row has retained original
player check records; callback data is original BattleData.getObj().
| Input and route | Outcome | Original clock used | Scene wall time / frames | Original checks |
|---|---|---|---|---|
Three level-1 adult green slimes, mean original growth, master level 1, ordinary 0101/1 |
Win | 37.127 s | 41.112 s / 2,020 = 49.13 FPS | cheatNum=0, 3 player records |
Complete synthetic snapshot, original levels 1/2/3, ordinary 0101/1 |
Win | 38.883 s | 44.299 s / 2,190 = 49.44 FPS | cheatNum=0, 3 player records |
Same snapshot, original task 2002014, zero-based step 2 |
Natural loss | 5.133 s of 60 s | 8.701 s / 405 = 46.55 FPS | cheatNum=0, 3 player records |
Same snapshot, task 1001004, step 0 (passStage 0101/1) |
Win | 30.943 s | 35.473 s / 1,750 = 49.33 FPS | cheatNum=0, 3 player records |
The first row read 12 distinct asset members with one genuine original optional
absence and zero CRC/size mismatches. It retained 11 original unit records:
player-side damage 784; enemy-side damage 371; five enemies dead. Native final
AP was 13 and aliveNum was 5. These are actual engine outputs, not expected
values filled by the harness. Randomness is native and unseeded, so subsequent
valid fights need not reproduce those numbers.
Legacy killNum, totalDamage, deadNum, and bossDamage remained zero as in the
retained original code path. killMonster={} in 1-1 follows the original mode-2
enemy counting condition; its five enemies are juvenile mode 1. No counters are
repaired. anomaly_records has four fields, not four anomalies: the count is
battle_data.cheatNum, and even a zero count may retain +0uneqmon audit text.
Additional bounded experiments: an authored 30-second survival/spawn-controller
scene completed in a natural loss before time expired, cheatNum=0. An invalid
synthetic level-90/potential-1 roster triggered three original +50overlv records:
cheatNum=150, adapter status anomaly, all records retained. That attempt is
negative validation, not a successful timing or valid-roster proof.
Snapshot bridge status and resolved bootstrap blockers
The independently owned SnapshotBridge.as compiles with the native harness.
It uses original History/Monster/Bag/Team/global/addition builders and original
AP getters, preserves input, and restores prior master on construction failure.
The complete synthetic snapshots above passed the real bridge and full scenes.
The first authorized cached-snapshot attempt stopped before combat at:
phase: original_snapshot_bridge
SnapshotBridge[missing_attributes] monsterAttributes:
a complete attribute row is required for every selected monster instance
Original MasterCenter allows a complete empty independent-addition list; the
earlier bridge instead required every selected row. It also indexed
Table.skin_info.skins, whereas original
Table startup and this harness expose the flat Table.skin_info dictionary.
The helper owner fixed both issues. No zero rows or nested table wrappers were
fabricated. Cached-roster scenes now complete in all three contexts with zero
original check points; their callback bodies pass the corrected binding validator.
The original audit IDs may be strings while BattleData IDs are numbers; comparison
normalizes identity only and retains original output types. A full skin/equipment
scene and final Engine/native/fake-client integration remain pending at freeze.
Private roster content,
account identifiers, paths, statistics, and logs are omitted from this document.
Process isolation and validation
Every worker has a fresh cwd/log directory, input/result nonce, captured compiler sources and their hashes, unique AIR application ID, and distinct native storage directory. Fixed Python → Java → ADL commands run without a shell. The Windows Job Object kills the worker and descendants on cancellation, deadline, or parent close. A process-tree test confirms the descendant is terminated. Imported runtime commands/paths/env/support manifests and unsigned verification claims are refused. SDK and prepared libraries use bundled reviewed hashes; native result verification also checks APK/main identity, input digest, nonce, route, outcome, anomaly count, actual execution/completion, and resource audit.
Two simultaneous native component probes passed with different native app IDs,
storage directories, and nonces. The first concurrent trial exposed Windows
WinError 5 replacing a shared asset index during a read. Preparation now reuses
identical immutable verified bytes and safely accepts a competing identical write;
the repeated simultaneous trial passed. No cross-account invoke forwarding or
shared application storage was observed.
Focused validation: 46 no-network unit tests pass. They cover data/route/team contracts, unknown mechanics/assets, native result binding, anomaly preservation, time-limit result semantics versus watchdogs, default/explicit deadlines, arbitrary command rejection, SWF document neutralization/ABC preservation, ZIP offsets/CRC, resource preparation races, cancellation, and process-tree termination. Native execution is explicit opt-in and is not part of routine unit tests. The same 46 tests also passed with Python socket connection methods blocked. Combined runtime/orchestration validation passed 130 tests. The latest explicit native task/concurrency validator exited 0, and no ADL worker remained after completion.
python -B -m unittest ranch_assistant.tests.test_battle_runtime -v
python -B -m tools.battle_runtime.prepare
python -B -m tools.battle_runtime.probe --compile-only
python -B -m tools.battle_runtime.validate_native
python -B -m tools.battle_runtime.validate_native --contexts task_battle --concurrent
validate_native --request <local JSON> runs the public API against a data-only
request, writes full evidence under ignored local_state, and prints aggregate
results. --rich selects synthetic gear/skin inputs; their full-scene validation
remains pending at freeze. The opt-in acquire_air tool downloads pinned
51.5.1.1 dependencies into ignored local_state using official ZIP ranges; normal
runtime/test execution never downloads anything or alters PATH/global config.
This owner changed only battle_runtime.py, its runtime tools/tests, and this
document. Engine/UI/progression/AMF fixes belong to their respective owners.
No commit, push, game request, battle submission, or reward action was performed.