dotzuki-engine-script 0.1.0

Boa-based async JavaScript scripting runtime for the dotzuki JRPG engine
Documentation

dotzuki-engine-script — an async JavaScript scripting engine (Boa-based) for games.

Provides an async/await-based scripting system using Boa (a pure-Rust JS engine) that replaces the hardcoded ScriptAction queue. Map scripts are written in JavaScript and can await game operations like showText(), moveNpc(), etc.

Architecture

JS Script (async fn)
    │
    ├─ await game.showText("...")  ──► ScriptCommand::ShowText
    │       ↑ Rust resolves promise when text dismissed
    │
    ├─ game.getFlag("GOT_STARTER") ──► synchronous bool return
    │
    └─ await game.startBattle("RIVAL") ──► ScriptCommand::StartBattle
            ↑ Rust resolves promise with battle result

The game loop calls ScriptEngine::tick() each frame:

  1. If a pending command was resolved by Rust, run_jobs() drains the JS microtask queue so the async function continues to its next await.
  2. If the script issues a new command, it's returned to the caller for dispatch.
  3. If no script is active, returns None.