Runtime and Data Flow
This page explains what happens from game launch to active overlay, and how the translation and storage systems move data around.
Startup sequence
When the plugin is installed into a game, the startup path is:
- The game launches the injected
main.js. - That file loads
cheat/init/import.jsbefore the standard engine scripts. import.jscreates the app root, injects CSS and libraries, and loadscheat/init/setup.js.setup.jsmounts the Vue app and rendersMainComponent.MainComponentinitializes RPG Maker customizations, registers keyboard listeners, and exposes helper actions.CheatModalrenders the active panel tree.
UI flow
The top-level UI is intentionally simple:
MainComponentowns visibility state and the current panel.CheatModalowns navigation and panel switching.- Each panel is a plain JavaScript Vue component.
- Shared dialogs and snackbars are mounted once at the top level.
This structure keeps the app small enough to run directly inside the game without a bundling pipeline.
Shortcut flow
Global shortcuts are handled centrally.
- Keydown and keyup events are captured by
MainComponent. - Events are normalized into the internal key model.
ShortcutConfig.jsdefines the shortcut catalog, parameter rules, and bound actions.ShortcutPanelState.jsshapes runtime shortcut data into panel-safe view rows.ShortcutStorage.jshandles persisted shortcut settings.GlobalShortcut.jsloads those mappings and decides whether a shortcut should fire.- The target action can open the overlay, switch panels, or trigger a gameplay helper.
Because shortcuts are global, contributors should be careful to avoid conflicts with base game controls.
Reading and writing game state
Panels interact with RPG Maker globals directly.
Common sources include:
$gameParty$gameActors$gameVariables$gameSwitches$dataItems$dataWeapons$dataArmors$dataSystem$gameMap
Typical pattern:
- Read a primitive identifier or display list for the UI.
- Let the user choose an action.
- Apply the change back into the relevant RPG Maker global.
Avoid storing live engine objects in Vue state when those objects can later be serialized by the game.
Storage flow
Persistent plugin state is handled through KeyValueStorage.
Behavior differs by environment:
- In NW.js, JSON is read and written through Node's file system APIs.
- In browser preview mode, the same API falls back to
localStorage.
This lets the same UI code run in both the game and the preview shell.
Typical stored data includes:
- Translation settings
- Translation bank cache
- Shortcuts
- Window and panel preferences
Translation flow
The translation system is split into batch processing and runtime application.
Phase 1: collect strings
TranslateHelper.js collects text from:
- database arrays such as items, skills, enemies, classes, and actors
- system terms and names
- variables and switches
- map metadata
- common events
- map event dialogue loaded from JSON files in the game's
data/folder
Phase 2: translate and cache
The translator:
- checks the selected endpoint
- removes already-cached strings
- builds one deduplicated uncached pool from the selected target groups
- runs category-by-category translation work while updating progress state
- batches the remaining strings through focused helpers
- sends requests to the configured service through endpoint-specific request modules
- stores the result in the translation bank
Key split modules in this flow:
TranslateHelper.jscoordinates the overall translation workflow.TranslationBatching.jshandles chunk sizing, batch grouping, and recursive batch fallback.TranslationBasicRequest.js,TranslationLingvaRequest.js, andTranslationLlmRequest.jshandle endpoint-family-specific requests.TranslationPool.jsandTranslationWorkflow.jshandle uncached-pool construction and per-target progress flow.
Supported endpoint families visible in the repo include:
- Lingva and local Lingva clusters
- Ollama
- OpenAI-compatible APIs
- Gemini-compatible APIs
Phase 3: apply cached translations
translation/in-game/InGameTranslator.js applies the cached results by:
- patching RPG Maker data arrays
- intercepting dialogue windows
- intercepting generic text draw calls
- patching names and menu commands where needed
This means translation during play is intended to be cache-first, not request-first.
Preview flow
The preview environment is useful for UI work but behaves differently from the real game:
start-preview.pyserves the preview folder with cache disabled.preview.jsmounts the same cheat UI in a browser page.rpg-mocks.jsplus preview globals stand in for RPG Maker objects and services.
This is ideal for layout, navigation, and light interaction changes. It is not sufficient for validating every game integration patch or every translation hook.
Dev-sync flow
When you need real-game testing:
- Run
deploy/dev.py. - The script detects MV or MZ structure.
- It copies the right injected
main.js. - It merges support files.
- It creates a junction or symlink from your source
cheat/folder into the target game.
After that, editing the source updates the game-linked folder immediately, and pressing F5 in the running game refreshes the client.
Release flow
Release packaging is handled by deploy/main.py:
- Copy
cheat-engine/www/to a temp folder. - Merge the correct MV or MZ initialization files.
- Remove
_cheat_initialize/from the packaged output. - Write
cheat-version-description.json. - Produce
tar.gzarchives underoutput/.
GitHub Actions uses the same script when a version tag is pushed.
Contributor checkpoints
Before merging a change, verify the right layer:
- UI-only changes: preview mode plus at least one in-game check.
- Engine patches: in-game verification on the affected engine.
- Translation changes: cache behavior, extraction behavior, and runtime display behavior.
- Packaging changes: output archive layout for both MV and MZ.