Living design document. Not a user guide or an implementation commitment. decided rows below are frozen.
The game owns the runtime. The launcher owns the folder, enablement, and launch. Launcher-side catalog and install: DRH Launcher architecture (Mods). This document is the source of truth for how mods load and talk to DRH.
open = not decided. recommended = working direction. decided = frozen here. Notes stay short; the linked section has the rule.
| Topic | Status | Notes |
|---|---|---|
Fairness / layers |
decided | No fairness police. layers dropped; taxonomy is uses. Policy |
| First-run disclosure | decided | Once in DRHL; --play gated like updates. First-run disclosure |
| API surface | decided | Host core modding.* + api mod + host extends / replace. API surface |
| hxScript fork | decided | Lasting fork: classpath-entry scan + replace. API surface, Compilation |
| Mod kinds | decided | Every mod builds on api. uses: extends / replace, empty for stable only (recommended). Mod kinds |
| Dependencies | decided | Versioned. The launcher installs them; a failure fails the dependents. mod.json |
| Enabled list | decided | mods/enabled.json + --mods-dir. No flag → no mods. Passing the list |
| Debug scan | decided | Same --mods-dir. Later optional: --mods-all, --mod <id>. No implicit scan next to the exe. |
| Lifecycle | decided | onInit before new DBFacade(), onReady before the loop, onDispose on exiting. Lifecycle |
hxScript Environment |
decided | One shared world, one compile batch, package mods.<id>. Compilation |
| Checksummed JSON overlay | decided | No extra warn/block. Policy |
| Game → launcher status | decided | mods/last-run.json + one log line per mod. Last-run report |
mod.json schema |
decided | mod.json |
| cppia bytecode cache | open | Future optimization, not v1. |
| Private / offline scripted gameplay | open | Out of scope while DRH only talks to official servers. |
| Distribution | decided | Pointer index we control; not a monorepo; not Thunderstore/Nexus as identity. Distribution |
| Trust for updates | decided | Trust artifacts (id + version + SHA-256), not author repos. |
| v1 discovery UI | decided | Minimal catalog in DRHL, same index a later site can reuse. |
| Index schema | decided | Tutez64/DRH-Mods-Index, served by GitHub Pages; one file per version, a merged entry only gets yanked. Index entry |
| Mod page in the launcher | decided | description above the long description: the index entry's longDescription, else the shown zone of README.md (Mod repository). The rest is DRH Launcher's. |
| Mod repository and publishing | decided | Repo = mod folder from DRH-Mods-Template, DRH Launcher commands for every step (checks implemented once, also run by the index CI), vX.Y.Z tags, flat zip, PR to the index with git. Mod repository |
| Thunderstore / Nexus / itch as mirrors | open | Optional later; must not replace mod.json or the index. |
| Mod settings and keys | decided | Declared through api, shown in the game's settings menu: keys in CONTROLS, options in ADVANCED until a MODS tab. Mod settings and keys |
| Resource overlay rules | open | Until DR's Starling update, a mod's Resources/ are its own files only, read from that folder; overriding the game's assets (precedence, SWF vs JSON, Locale/ merge) comes after. |
| Type blacklist | decided | None. Interpreted and compiled see the same types. Compilation |
| Host build (cppia) | decided | -dce no, force-include std, patch hxcpp, JIT on, verbose log, HXCPP_CHECK_POINTER. Compilation |
Mod id and zip extract |
decided | id = folder = package mods.<id>. Regex + keyword/reserved-name lists. No zip-slip, no size cap. mod.json |
dependencies cycles |
decided | Not an error. Order inside a cycle is not defined. Passing the list |
import.hx in a mod |
decided | Skipped with a warning. mod.json |
drh in mod.json |
decided | Required with extends / replace, omitted for api only. Closed tag string. Warns, does not block. mod.json |
Dungeon Rampage Haxe (DRH) is a Haxe/OpenFL port, compiled natively with hxcpp. Official Dungeon Rampage is still moving (art overhaul, Starling for 1.0), so DRH internals will keep changing.
The script runtime is a fork of hxScript, pinned as submodules/hxscript: mods in ordinary Haxe, compiled in-process to cppia, no Haxe toolchain on the player's machine. Same model as the other submodules: rebase on upstream, stack our commits, PR immediately, do not wait for acceptance. Stock hxScript bridges whole packages (-D hxscript_bridge_packages). The fork adds the classpath-entry scan, the exclude list, and replace.
Constraints:
- hxcpp only (
project.xml). - Fully multiplayer on official servers. The client
sCodefold is not a catalog special case (Policy). - Updates replace
Dungeon Rampage Haxe/current/. Mods live outside that directory.
flowchart LR
subgraph publish [Publish]
author["author zip + hash"]
index["index repo"]
end
subgraph launcher [DRH-Launcher]
catalog["v1 catalog"]
modsDir["install-dir/mods/"]
enabled["enable + load order"]
end
subgraph game [DRH hxcpp]
host["modding host"]
hxscript["one shared Environment"]
cppia["compile cppia or interp"]
core["modding core"]
gameCore["GameMaster timelines UI"]
end
author -->|"PR per version"| index
index --> catalog
catalog -->|"verify SHA-256"| modsDir
modsDir --> enabled
enabled -->|"--mods-dir + enabled.json"| host
host --> hxscript
hxscript --> cppia
cppia -->|"api mod"| core
cppia -->|"extends / replace"| gameCore
core --> gameCore
The launcher does not compile. It discovers mods, keeps the enabled set and load order, and passes --mods-dir. The game loads every enabled mod into one hxScript Environment (mods.<id>), compiles that world in one batch, and interprets what the emitter skips. Every mod builds on the official api mod. extends / replace are explicit, costlier kinds on top.
"Compiled" means Compiler.compile(env) inside the game process at load — not a rebuild of the DRH binary, and not a Haxe compile in the launcher.
| Role | Owns |
|---|---|
| Launcher | folder, index/catalog, enablement, --mods-dir, first-run disclosure. No Haxe toolchain. |
| Game | parse the flag, load, compile, lifecycle, last-run.json. |
| Author | zip + mod.json. Publish = PR to the index. Playing does not need the Haxe SDK. |
DR is PvE, not a ladder. The official client is already leaky; DRH itself is a modified client. v1 does not reject mods for in-game advantage (exact HP, FOV, stacked-chest UI, chat macros, damage meters, client bugfixes).
How you hook is uses (extends / replace, or nothing). A layers field (client / data / gameplay) was dropped: FOV is “client” and a large advantage; a mana-check patch sits in a weapon controller; it reopened the fairness debate.
Official tables and sCode. Resources/Levels/DB_GameMaster.json, Resources/Combat/AttackTimeline.json, and Resources/Levels/library_server.json feed mSecurityGM / mSecurityTL / mSecuritySL. The fold only counts runtime "int" fields; AttackTimeline is shallow (top-level keys of each attack: name, flags, totalFrames, the frames array object — not nested actions). { "type": "helloMod" } does not change mSecurityTL. Timeline/library values are then % 1097. blockCheater() is only Hero.BaseMove > 250 in the loaded GameMaster. sCode is sent on ClientRequestEntry; server use is unknown. A mismatch would at most fail dungeon entry (ResponceCode != 0). It is not an automatic ban in the client.
v1 does not warn or block those three paths in the index, the launcher, or the host. An indexed mod was reviewed and plays; sideload is already labeled unreviewed. Index review still refuses or yanks malware and combat bots / protocol spoof.
DRHL shows this once (launcher config) the first time the user would actually use mods: first install or enable, or first Play with a non-empty enabled.json. Do not nag every launch. --play with a non-empty enabled.json and no confirmation yet opens the full UI with the notice; confirming it plays. Browsing the catalog does not require it. Not an EULA lecture: one line per point.
- Code in-process. It runs inside the game, with the game's access to the computer. Catalog mods are open source, one click from their page, and get a human review, which is not a proof. Sideload is not reviewed.
- Servers. The same as DRH alone. No promise about bans either way.
- Updates and clashes. A DRH update can break a mod; some mods may not work together.
- Back to vanilla. Disable them. Nothing is written into
current/. - EULA / blessing. Like DRH, mods are not made or endorsed by the rights holders.
hxScript is ordinary Haxe in-process, not a JS-style "patch any function" runtime. private / inline / final methods, and a comparison buried inside a compiled function, stay out of reach.
Core + api mod + host types. Every mod builds on the api mod. extends / replace exist so a mod can still reach what it does not cover. The submodules/hxscript fork commit is the pin, rebased on upstream, PR'd once it works for DRH. hxScript's compiler is BETA; replace touches bridge generation and the emitter, so rebases will conflict more than on lime/openfl. Accepted: the goal is a clean replace, not the smallest diff.
- Core (
modding.*, in the host). What must exist before any mod or touchessrc/: loading, compile, Lifecycle, isolation, overlay layers, key routing, and the game events that hand game objects. Small, and changes only with a release. The foundation ofapi, not meant for mods: a host type like any other, so using it directly isextends. apimod (mods.api.*). The official mod that turns game objects into stable wrappers (players, heroes, weapons, floor, account, art) and re-emits its own events. Not rawHeroGameObject. A fix or an addition is a newapiversion, not a game release. What its version promises is in Versioning.- Host types. Two features:
A scriptable base is any eligible class that ships as game or engine code: DRH's own source roots and the vendored engine. Not bridged: the toolchain (hxcpp, hxScript, Haxe std) and haxelibs the engine uses internally (format). A curated allow-list puts the burden of proof on the wrong side.
| Root | Package(s) | In / out |
|---|---|---|
src/ |
35 packages incl. vendored box2D, org, com, generatedCode |
in — the game |
src-steam/ |
com.amanitadesign.steam (FRESteamWorks shim, if="cpp") |
in — DRH code; replace(FRESteamWorks, …) intercepts Steam calls |
submodules/ax4/compat |
compat.* plus 15 root-level files (ASCompat, ASDictionary, ASProxyBase, …) |
in — DRH code. Abstracts (ASAny / ASObject / ASFunction) and macros drop out via eligible() / *.macro.hx |
submodules/openfl |
openfl |
in — display list (Sprite, MovieClip, Bitmap, TextField, …) |
submodules/lime |
lime |
in — windows / input / timing |
submodules/swf |
swf |
in — Animate symbols and timelines |
submodules/SteamWrap |
steamwrap |
in — binding under src-steam; mostly @:cffi / statics, near-zero cost |
submodules/libhxcpp |
— | out — C++ runtime / build tool. cpp.* lives in the Haxe std |
hxScript (-lib hxscript) |
hxscript |
out — the loader, not game content. replace(Environment, …) would rewrite the loader that loaded the mod; compile.* / cppia.* bridges break on every rebase |
Haxe std, cpp.* |
— | out of the bridge scan — presets handle the std; cpp.* is almost all extern / abstract / @:coreType |
haxelib format |
format |
out — used from Lime / OpenFL / swf internals, never from src/. Add it the day someone has a use |
"Not bridged" means no extends, not "unreachable": a mod can call any host static (cpp.vm.Gc.run, …). The GC algorithm is C++ / compile-time defines, out of reach by nature. What keeps unreferenced std members in the binary is DCE / include, not bridging (Compilation).
One default exclusion: DungeonBustersProject. Lime's ApplicationMain constructs it before the host exists (the host runs inside its constructor), so replace is impossible and extends would be a second application. Its bridge would be the whole Sprite surface through GameEntry for a use that cannot exist. The other two src/ root classes (Loading_screen_swf, Db_UI_skip_button_swf) stay in: they go through ASCompat.createInstance, which consults the replace table.
Whole submodule trees are bridged (openfl._internal, Lime backends included). Stock hxScript's thin OpenFL preset (Sprite only) is a size default, not a limit. Measure first: the first cppia build records binary size and build time; the lever if it is too fat is hxscript_bridge_exclude, not final on DRH types one by one.
The fork keeps upstream Bridges.eligible. Four rules are Haxe; two are scan filters:
| Kind | Source | Why skipped |
|---|---|---|
final class |
language | Haxe forbids the subclass. Un-final a type we own if it must be extendable (kills hxcpp de-virtualisation on that type). In src/ only vendored helpers (com.greensock, com.adobe, com.wildtangent), AssetCache and RootFacade are final. |
extern class |
language | No Haxe body. Scripts can still call it. |
interface |
language | Not a class base. Scripts implements a native interface already. |
private class |
language | Invisible from a mod package. Make it public in DRH if a mod needs it. |
generic class (Foo<T>) |
eligible() |
Haxe allows extends Foo<Int>; the generated bridge cannot substitute the erased parameter. DRH has no generic class; v1 does not lift this. |
| class without its own constructor | eligible() |
Conservative: generator already handles inherited super. In DRH the only such class is RootFacade, already final. Lever = the filter, not an explicit new added to DRH. |
-D hxscript_bridge_types also goes through eligible(); only the presets' curated bases skip it. -D hxscript_verbose names every skipped module and why.
final / inline methods on an otherwise scriptable class still cannot be overridden.
Do not hand out internal instances as the stable API. A HUD that peeks actor.HeroGameObject is an extends mod, even if it only reads fields.
Explicit replace(HostClass, Sub) so host new HostClass(...) constructs the subclass. extend is not replace. class HudIcon extends Sprite is a widget; it does not steal OpenFL's new Sprite(). Only replace(Sprite, …) would. Same rule for every type, including OpenFL/Lime: no special blacklist.
Disjoint-method merge lives in hxScript; DRH calls replace and gets one class or a conflict. A new rewrite does not see dynamic instantiation. DRH's own goes through ASCompat.createInstance (submodules/ax4/compat/ASCompat.hx): AssetRepository, the loading clip, the skip button, every var X:Dynamic = SomeClass pattern. The host makes createInstance consult the same replace table. That function is inline, so the lookup goes into its body; a runtime wrap would miss every already-inlined call site. Outside: Lime's Type.createInstance (e.g. AnimateLibrary from the asset manifest) — extends works, replace does not.
- Off by default: a type is replaceable because a mod registered it, not because it is scriptable or because a script
extends it. - Any number of mods may
extendwithoutreplace. Severalreplaceon the same base are OK if rewritten methods/fields/newdo not overlap. Overlap → error or explicit priority. Residual risk:A.updatecan callthis.onWeaponDown()and hitB's override on the same instance. A wrap/callNextchain is how you intentionally stack one method. Out of scope to prove disjointthisuse statically.
- The stable API is
mods.api.*, nothing else. The core (modding.*),facade.DBFacade,actor.*,combat.*,uI.*are host types: usable viaextends/replace, not covered. - The
apimod's version is semver over its written contract: when an event fires, what a wrapper represents, the empty-until-event rules. A fix is a patch, an addition a minor, a change to that text a major. Until DRH V14 it is published as previews,0.y.z, where a minor may change that text ("0.1"accepts0.1.zonly);1.0.0comes with V14. Each version's release notes list what it added, so a mod can aim below the version it was tested with. A core change is absorbed byapiwhere it can be; its major moves only when its own contract does. Game content behind a stable reading, and OpenFL/Lime used to draw on the overlay, are outside it. - The
apimod isextends: itsdrhlists the tags it was verified on. It lives in its own repository, published and indexed like any mod; DRH pins it as themods/apisubmodule, the version its examples and test mods run against.apiand its index entry are published before the DRH release, so a release is never without one: a DRH tag only drafts its release; that draft's archive is tested by hand withapi(a dungeon run withapi_tour; everything pastonReadyneeds an account, and social actions are never exercised), then a version whosedrhadds the tag is published and indexed (a patch when the code did not change), then the DRH release. The launcher installs the highestapiversion that satisfies every enabled mod, one whosedrhcontains the installed tag first (mod.json). The game does not check versions. - The written contract is the
apireference, in its repository. Official examples: Party Board (stable only) and Inspector (extends). The example and test mods ofmods/load with the pinnedapion every tag. A signature break fails that load. Whether a call site still matches the written when/what is review.
Every mod depends on api (mod.json api field). uses says what it touches beyond it. Recommend stable only; the other two exist because the api mod will not cover everything.
| Kind | What it means | DRH versions | Other mods |
|---|---|---|---|
stable only (uses empty) |
Uses only mods.api.*. OpenFL/Lime for drawing on the overlay is OK, subclassing their display classes included; the core, actor.* / combat.* / facade.* are not. |
Tied to the api major. Versioning. |
Best. No replace occupancy. |
extends |
Subclasses or calls host types but does not replace vanilla new. Helpers, new MyRepeater(), reading public internals. |
Tied to those class/method names. Starling / conversions can break it even if api is unchanged. |
Usually fine with others. Still shares live objects with a replace on the same type (is RepeaterWeaponController remains true). |
replace |
Explicit replace(HostClass, Sub) at onInit. Host new HostClass(...) becomes the subclass (merge if rewritten methods/fields/new are disjoint). |
Same host-type fragility as extends, plus construction. |
Conflicts when rewritten surfaces overlap. One occupancy per method/field/new. |
A mod may list both (uses: ["extends", "replace"]). Catalog / index show the strongest present: replace > extends > stable only (labelled API). Index review checks the declare matches the code (honor + grep). Sideload can lie; label it. The api mod, recognized by its repository (DRH-Mod-API), never by its id, is shown without that label or its warning, since its compatibility follows DRH's releases; its extends and drh still drive which version is installed.
Players see a short warning on extends / replace (may break on game updates; replace may clash), not a fairness lecture.
Core. mods.api.Mod mirrors them as init(context), ready(context) and dispose(), with its own Context, at the same moments, and its major covers that. They are boot hooks; names are frozen. Two anchors: onInit = nothing of the game exists yet; onReady = every singleton exists (tables, account, inventory, clock, network) and the loop is about to start. Neither means "a hero is on screen": live moments are events.
mod.json entry extends mods.api.Mod (only the api mod's own extends modding.Mod); otherwise the host fails the mod (entry must extend mods.api.Mod). All three methods are optional (empty defaults).
| Method | When | Typical use |
|---|---|---|
onInit(ctx:ModContext) |
DungeonBustersProject constructor, after --mods-dir parse + compile, before new DBFacade(). Process and stage are up; nothing of the game is constructed (no facade, no Logger, no clocks, no camera, no state machine, no FRESteamWorks; FeatureFlags does not exist yet and its values come later anyway). |
replace(...), subscribe, draw on the overlay layer ctx hands out. State wrappers empty. Read feature flags in onReady. |
onReady(ctx:ModContext) |
LoadingFinishedEvent, inside DBFacade.architectureLoaded, after mDBAccountInfo is set and gameClock.initTime(), before run() and mainStateMachine.start(). Tables, account (inventory, active avatar, friends), feature flags (CLI + config), matchmaker, server time, clock are up; the loop has not ticked. No town, hero, or floor. Once per process. |
Read tables and account-level wrappers. Closest to Unity Start. Hero / floor wrappers stay empty until the matching event. |
onDispose() |
NativeApplication exiting, registered at the top of the constructor (before compile, ahead of the game's listener, so it runs before mSteamworks.dispose()). Once, reverse load order. Every graceful exit (window close, WM_CLOSE, SIGTERM, Cmd+Q, Quit, socket error). The launcher's Stop force-kills after 3 s. Not called on a crash, a force-kill, or if the loop never pumps the quit (compile stuck, hung frame). |
Timers, listeners, flush a local file. No network, no waiting. Must not block exiting. |
onInit is before new DBFacade() because that is the only placement where replace covers every host new. HUD, sound, Steam Input and MainStateMachine are built later (stagetwo_init, buildEngines, createHUD); an onInit at the end of onInvoke would already see them. What it would miss is field initialisers and Facade.init: FRESteamWorks (mSteamworks = new FRESteamWorks() runs inside new DBFacade(), before init()), both GameClocks, EventManager, Camera, work managers, letterbox, loading clip. A second early hook would be a second "what exists here" list, and that list moves with Starling. Steam identity and the auth ticket are readable from onReady; feature flags are only complete after LoadingState.configReady. AssetRepository, the loading clip and the skip button go through ASCompat.createInstance (same replace table).
onReady is LoadingFinishedEvent, not ManagersLoadedEvent, because the api mod promises an inventory wrapper and inventory is account data. At ManagersLoaded the tables are in and the account / matchmaker / initTime() are not. Mutating GameMaster before the account is parsed against it is the additive tablesLoaded event, not a fourth method.
Order: onInit → (tablesLoaded) → onReady → any gameplay event. Town / tutorial dungeon is entered by the mainStateMachine.start() that follows onReady. Objects ready during loading are announced right after onReady, in order; state changes before it are not reported. An actor is announced after its floor (the host holds it back until then).
Boot that never reaches onReady: SocketErrorState (service discovery failed) and blockCheater() — ManagersLoadedEvent never fires. Mods must tolerate a missing onReady; last-run.json records ready: false. An account with no active avatar is not that case: MainStateMachine.start() logs and returns, but it runs after onReady, so ready: true and no town. Wait for heroSpawned, do not infer a hero from onReady.
Return to town (ReloadTownState) is not a second onReady. That is additive townEnter.
Host obligations:
- Overlay root stays on top. Root z-order is
Facade.addRootDisplayObject(child, layer)(letterbox at 1000, loading clip at 0), notstage.addChild. A child added duringonInitis unknown tomChildLayerand counts as layer 0, so the letterbox lands above it. AfterDBFacade.initthe host re-registers the overlay above the letterbox. Inside it, each mod has its own layer (ctx.overlay), in load order. Authors do not manage z-order against vanilla. - No
LoggerduringonInit.Logger.initruns insideFacade.init. The host buffers compile /onInitlogs and flushes them, or usestrace. - Throw isolation. Move the game's
uncaughtErrorlistener to the top of the constructor (null-guardmDBFacade) so compile,onInitandnew DBFacade()are inside it. That listener catches event-dispatch errors, not a synchronous throw in the constructor chain: the host still wraps each mod's compile andonInitin try/catch. Isolation is themodding.*contour (onInit/onReady/ event handlers). The build setsHXCPP_CHECK_POINTER, so a null dereference in mod or game code throwsNull Object Referenceand follows these rules rather than killing the process. A throw inonDisposeis logged and ignored. A throw from a replaced host method is a host throw. Areplacesubclass whose constructor throws whilenew DBFacade()orinit()constructs it kills the boot. Accepted.last-run.jsonis written right afteronInit(ready: false); the launcher's "process exited +ready: false" reading covers it. - A failed mod goes quiet. A throw in
onInitoronReadycancels all its subscriptions (those toapievents included) and removes its overlay layer;last-runisfailed. After a failedonInit: noonReady, areplacefrom that call is dropped, later mods still start, its types stay. A failedonReadydoes not undo areplace.onDisposestill runs at exit. Files, threads, and statics are not rolled back. A throw in an event handler is only logged. - A failed dependency fails its dependents. When a mod fails (load,
onInit,onReady), every enabled mod that depends on it (apiordependencies), directly or through another, fails too (dependency <id> failed) and goes quiet the same way, whatever the load order. A dependency that is skipped or not enabled fails the mod before it loads (dependency <id> missing). Versions are the launcher's check, not the game's. - Startup cost. Parse + compile of every enabled mod happens before the first frame (hxScript: ≈10 ms per module). Measure with real mods. If it becomes a visible black window, the fix is a splash before
new DBFacade()(OpenFL preloader, or a Lime-level clip), not a split ofinit():new DBFacade()already constructsFRESteamWorks. A bytecode cache is the later lever.
Subscribe from onInit or onReady with ModContext.on<Event>(handler) (onObjectReady(f:GameObject->Void), …), which returns a ModSubscription (cancel()). Host-emitted; not existing game Event class names. They are generic on purpose: the api mod turns them into its own events (hero, floor, town…), so it grows without a DRH release. The game's own event bus (facade.eventManager: chat, HP, mana, experience, currencies, friends…) is read directly, from onReady.
| Event | Hands | When |
|---|---|---|
objectReady / objectGone |
GameObject |
A game object is ready: a network object once generated (floor, loot, dungeon summary, matchmaker…), an actor (hero, monster, NPC) once initialised, never before its floor. Gone: a ready object starts its destroy(), from the server or the game; it is still whole while the handlers run. |
fieldReceived |
GameObject, field id, name |
The server set a field or called a method on a ready object: its network field id, and its name as the generated code's recv_ method calls it, <Class>.name. Only looked up while someone listens. |
stateEnter / stateExit |
StateMachine, State |
A state machine of the game entered a state, after its enterState / leaves it, before its exitState: the main one (loading, town, run…), the town's (inventory, shop, map…), an actor's. |
tablesLoaded |
— | ManagersLoadedEvent: tables in, account not yet parsed against them. Window to mutate tables (extends use). |
keyDown |
key code | A key goes down: once per press, not while a text field (chat) has focus. A handler returning true keeps the key: the game never sees that press (its shortcuts, OpenFL's Tab focus, repeats, release). |
The game calls the host at a few points every object or state goes through: object creation and field reception in DcSocket, actor initialisation in ActorGameObject.checkIfReadyForInit, transitions in StateMachine. objectGone needs no src/ edit: a build macro over src/ (modding.Hooks) starts every game object's destroy() with it, so the most derived class reports the object before tearing it down. The same macro gives each generated network component the names of the fields its recvById dispatches, which fieldReceived hands with the id.
ModContext: overlay layer and view size, its Resources/ folder (resources), its folder to write in (data), log, replace, these subscriptions, facade (from onReady, a host type), and alive, false once the mod failed, so another mod holding handlers for it stops calling them.
mods.api.*, loaded before every other mod. What it offers is in its reference. It builds its events on the core's (Game events); context.core hands a mod the core itself, an extends use. Its subscriptions hold the subscriber's ModContext: a handler of a failed mod is no longer called (alive), and a handler's throw is logged under that mod.
mods.api._internal is the api mod's own plumbing: not API, not covered by its version.
Load order is enabled.json's, dependencies first (Passing the list). Outcomes land in last-run.json. modding.Host is not API: its hooks are private, @:allowed to their game callers.
A mod's options and keys are declared through the api mod and shown in the game's settings menu, where the player changes them as the game's own. A mod neither draws a settings window nor binds a key code itself: index review refuses it, from the api version that has this on. onKeyDown stays for the keys of a mod's own window while it is open (Enter, Escape).
Options (context.settings), declared in init:
| Kind | Declares | Value |
|---|---|---|
flag |
id, label, description, default | Bool |
choice |
the same, and the choices, each a value and its label | the chosen value |
slider |
the same, and minimum, maximum, step | Float |
button |
id, label, the button's caption | none: it tells when it is pressed |
Each answers its current value, from init on, and calls its change handlers when it changes: set by the player in the menu, by the menu's reset, or by the mod itself; in town or during a run.
Keys (context.keys). A mod declares an action: id, label, description, a default key and default modifiers (Shift, Ctrl, Alt; none unless given). It is told when the action is pressed, and asks api whether it is held and for the label of what is bound ("SHIFT+R", empty when nothing is). It never reads a key code or a modifier's state. A pressed action keeps its key from the game. None is pressed while the settings menu is open, where a key pressed is one being picked.
- The player rebinds an action's key in the menu. Its modifiers are the declared ones for now; the player will set or remove them later, so a mod cannot count on its modifier being held.
- A key is bound once: assigning one takes it from any other action, the game's or a mod's, compared by the key alone (R and Shift+R are the same key). An action whose key another already holds when its mod loads, the game's first, then the mods' in load order, starts unassigned, and has it at a later start once it is free.
- The keys that can be bound are the game's (
KeyBindings.isBindable).
Where. Keys go at the end of CONTROLS, options in the MODS tab, which the menu has while a mod has one, both grouped by mod under a header with its name. A mod does not choose.
Kept in data/<id>/settings.json, read and written by api. Ids are the mod's own: two mods may use the same. An entry the mod no longer declares is ignored. The menu's reset puts a mod's options and keys back to their declared defaults. A failed mod's entries leave the menu.
The host opens the game's settings to the api (modding.ModSettings, not for mods): a definition added there joins the game's catalog, so its row, the menu's reset and the rule that a key is one action's are the game's own. The host does what the game has nothing for: the MODS tab, a seventh laid out with the game's six from a second copy of the popup's art; the headers; a button's row; and values kept out of the game's settings.json. modding.Hooks has the game call it at four points, with no edit of src/: its settings file written, a tab's rows shown, a row made, the popup's art set up. A game method that is no longer where the macro expects it fails the build.
Before V18 the game has none of this: api then puts the definitions in the catalog itself, options in ADVANCED, draws the headers, and shows no button. Modifiers the player sets come later and change nothing a mod declares.
Mods live outside Dungeon Rampage Haxe/current/, so they survive updates and rollbacks.
<install-dir>/
data/
Dungeon Rampage Haxe/
current/ # game, replaced on every update
previous/ # launcher rollback
mods/
enabled.json # launcher-owned: enabled ids, the user's load order
last-run.json # game-owned: last session outcome per mod
data/
some_mod/ # what the mod writes (ctx.data), kept through updates and uninstall
some_mod/ # folder name = id
mod.json
src/ # .hx sources; package mods.some_mod (+ subfolders); no import.hx
Main.hx # package mods.some_mod;
ui/Panel.hx # package mods.some_mod.ui;
Resources/ # the mod's own files, read from ctx.resources
README.md # long description
<install-dir> is the launcher managed content root (not the launcher executable). Linux default looks like ~/.local/share/DRH Launcher.
No destructive overlay in current/Resources/. A mod reads its own files from its Resources/ (resources in its context); they do not replace the game's (open). The launcher does not copy, patch, or verify files inside the game install.
The game cwd is Dungeon Rampage Haxe/current/. Enablement must not live in current/ (wiped on update) or inside each mod.json (author artifact).
The launcher writes <install-dir>/mods/enabled.json:
{
"mods": [
{ "id": "example_hud" },
{ "id": "chat_macros" }
]
}Array order is the user's load order. The host starts every mod after its dependencies (api included), whatever their place in the file, and keeps that order otherwise; last-run.json lists mods in the order they started. Disabled mods are omitted. Enabling a mod installs and enables its missing dependencies (mod.json). If one cannot be (absent from the index, disabled by the user), the launcher warns and still writes the file; the game fails the mod (dependency <id> missing).
Cycles are not an error, and enabling is never refused. In one shared batch, mutual imports compile; the only undefined thing is which onInit of the cycle runs first.
If an id in enabled.json has no folder / no mod.json, the game skips it, logs, and records skipped in last-run.json. It does not abort boot. On the Mods page scan (not during --play), the launcher drops those ids and rewrites the file.
On Play the launcher passes --mods-dir <absolute path to mods/> (quote paths with spaces). The game parses it from Sys.args() in the constructor, like --fps. Then it reads enabled.json and resolves each id to a directory (scan mod.json if the folder name differs). Missing or empty enabled.json → load nothing (same as an empty list). Prod CLI does not list ids (Windows command-line length, quoting). Session logs already capture the flag.
No --mods-dir → no mods. Intentional vanilla.
Debug: the same flag. Later optional --mods-all (ignore enabled.json) and --mod <id>. No environment variables (the launcher sanitizes env; wrappers like prime-run make that channel unreliable).
When --mods-dir is set, the game writes <install-dir>/mods/last-run.json. Without the flag, it writes nothing. The session log is not a Mods-page UI.
Draft, not frozen:
{
"drh": "20",
"started": "2026-09-15T13:20:00Z",
"ready": true,
"mods": [
{
"id": "example_hud",
"version": "0.1.0",
"status": "ok",
"mode": "compiled"
},
{
"id": "broken_replace",
"version": "1.0.0",
"status": "failed",
"mode": "interpreted",
"error": "replace overlap on RepeaterWeaponController.onWeaponDown"
}
]
}| Field | Role |
|---|---|
drh / started |
Tag-number string of the game that wrote the file ("20", no V — same space as mod.json) and UTC start time, for display. |
ready |
false until onReady has run; stays false when boot never gets there (SocketErrorState, blockCheater()). A mod ok with ready: false only got onInit. While the game is still loading the file also says false; the launcher disambiguates with process state (alive → loading, exited → boot stopped before LoadingFinished). No active avatar still reports true. |
status |
ok / failed (its own error or a dependency's) / skipped (id in enabled.json but folder, mod.json, or valid id missing) |
mode |
compiled if every module of the mod compiled, interpreted if none did, mixed otherwise. |
error |
Present on failed, mixed, an interpreted skip, or a replace overlap. One line (2 modules left interpreted). Per-module reasons stay in the session log. |
Write after compile + onInit (ready: false). Rewrite after onReady (ready: true, plus any onReady failure). Update the same file if a later replace conflict happens. Not live IPC.
The launcher deletes the file before each Play with --mods-dir, so a file present is this session's. Missing: still booting while the process is alive, a crash before the first write once it has exited. A file that does not parse (read during a write, or cut by a crash) is read again once shortly after, then counts as missing.
The launcher reads it when the Mods page is shown. That is where replace overlap becomes visible for that mod.
At load, one Logger.info per enabled mod (id, version, uses, mode, skip/fail reason). The session log already captures stdout.
Out of v1: in-session toasts, a pipe back to a running launcher.
Shared launcher/game contract.
{
"id": "some_mod",
"name": "Some Mod",
"description": "Short summary for the catalog.",
"version": "0.1.0",
"author": "example",
"api": "1.2",
"entry": "Main",
"uses": [],
"dependencies": { "cool_lib": "0.3" }
}| Field | Role |
|---|---|
id |
Stable identifier, install folder, and the mod's package: every source file is in mods.<id> or a sub-package. Must match ^[a-z][a-z0-9_]{1,62}[a-z0-9]$ (3–64, snake_case, letter start, no trailing underscore) and must not be a Haxe keyword, a Windows reserved device name, or data (the mods folder's data/, where each mod writes). Index CI, launcher install, and host skip all apply the same regex + lists. Display name stays in name. It is the one the name gives, in lowercase with _ between its words (Cool Mod → cool_mod), unless the name gives none (a letter outside ASCII, a keyword), and stays so: a mod keeps its name, since its id never changes. --check-mod and the index CI note another one without refusing it; a reviewer may accept it. |
name |
Display name, at most 64 characters. |
description |
One line for the catalog, at most 120 characters. |
version |
MAJOR.MINOR.PATCH, digits only. Semver over what other mods may rely on. |
author |
Display name of the author or team, at most 32 characters. Free text, not an account: the launcher shows the GitHub owner of the mod's repository next to it, and searches and sorts by that owner. |
api |
Version of the api mod this one is written and tested against: any later one of the same major is accepted. Required, except in the api mod itself. Same syntax as a dependency. Nothing checks it is the lowest that works; one too low fails at compile, in last-run.json. |
drh |
Tags this artifact was built for (no V, no >=). "20", "20,21", or "20-22" (closed, inclusive). Required if uses contains extends or replace; omit otherwise. Never blocks: the launcher warns when the installed tag is not in the set. Untagged local builds ("0") skip it. |
entry |
Short class name, resolved as mods.<id>.<entry> (e.g. Main → mods.some_mod.Main, extends mods.api.Mod). Cannot name anything outside the mod's package. |
uses |
extends and/or replace. Empty: stable only. Until the game supports replace, --check-mod and the index refuse it. |
dependencies |
Other mods whose types this one imports, as { "id": "version" }. Not api, which has its own field. May be empty or absent. A cycle is not an error (Passing the list). |
Lengths count characters. --check-mod and the index CI refuse a longer value.
Versions. api and each dependency take "x.y" or "x.y.z": the same major, and not older ("1.2" accepts 1.2.0 up to anything below 2.0.0). With major 0, the minor is the major ("0.3" accepts 0.3.x only). The launcher installs and enables, from the index, the highest version that satisfies every enabled mod naming it. For extends / replace (api included), one whose drh contains the installed tag comes first; when none does, the highest satisfying version is installed anyway, with the drh warning. One version per id; when no version satisfies everyone, it keeps the installed one and warns. No backtracking across dependencies' own constraints. The game only checks that dependencies loaded (Lifecycle).
Haxe keywords (the regex alone lets package mods.new; through): abstract, break, case, cast, catch, class, continue, default, dynamic, else, enum, extends, extern, false, final, for, function, implements, import, inline, interface, macro, new, null, operator, overload, override, package, private, public, return, static, switch, this, throw, true, try, typedef, untyped, using, var, while.
Windows reserved device names (the folder cannot be created): con, prn, aux, nul, com1–com9, lpt1–lpt9.
Package rule. hxScript requires the package the host passes to match the file. The host derives it from the path under src/: mods/<id>/src/ui/Panel.hx is mods.<id>.ui, src/Main.hx is mods.<id>. A file that declares anything else is hxScript's parse error; the module declares nothing; the mod is failed. Ids are unique (index) and the host refuses a second mod with the same id (sideload), so two mods can never declare the same type — otherwise the interpreter silently replaces the earlier module (Environment.modules) and hxcpp's cppia class table overwrites (last wins). mods. also keeps a mod from shadowing a host or engine root (combat, com, openfl, …).
import.hx is not supported (v1). The host skips it with a warning attributed to the mod (import.hx ignored); other files still load. hxScript's prelude (ImportModule) is host-wired and interpreter-only; the cppia emitter reads a module's own imports only, so honouring it would silently interpret every file of that mod. Fed as a normal module it would fail the package rule (no package line). Each file lists its imports. Lifting this later is additive if hxScript teaches the emitter about preludes.
Using another mod's types holds as long as its author follows semver on version. Nothing checks that but review.
The launcher refuses to install (index or local zip) if id fails the regex / lists, and extracts to mods/<id>/ with the same path rules as game releases (enclosed_name / safe_relative_path: no .., no absolute paths, files and directories only). No uncompressed size cap: index artifacts already have size + SHA-256; sideload is a file the user picked. A hand-copied folder whose directory name differs from id can still be scanned via mod.json; a bad id is skipped (game) or not a mod (launcher).
A directory without mod.json is not a mod.
Three roles, kept separate so a nicer front can land later without moving mods:
| Role | v1 | Later |
|---|---|---|
| Discussion | Discord | still Discord |
| Listing (source of truth) | Index repo we control | same index |
| Files | Author-hosted zip (e.g. GitHub Release) | same, plus optional mirrors |
| Human catalog | Minimal list in DRHL | polish in DRHL and/or a website reading the same index |
The index points. It does not contain community mods. Official example mods may live in the DRH tree; third-party mods do not, nor does api, which has its own repository (Versioning).
A listing is an artifact, not a repo: id + version + sha256 + download URL plus its mod.json fields. Trusting github.com/alice/cool-hud forever would auto-approve the next Release. Reviewing "the repo" once does not review v1.2. A new version is not visible until it is a new index entry (PR). CI can check that the zip opens, mod.json matches, and the hash is correct; a human still diffs against the last indexed version. Auto-ingest of GitHub Releases without the index is out.
Sideload (Open mods folder / install from zip / a GitHub repository link) stays, labeled unreviewed. A repository link installs the zip of its latest published release, never a branch.
Thunderstore, Nexus, itch.io are not the identity of a DRH mod. They may become mirrors of the same zip with a generated extra manifest. Nexus is the weakest legal fit for a fan port. Steam Workshop is out of scope (DRH is not a Steam app).
The Mods page (fetch, install, enable, order, last-run display) is specified in the launcher architecture. This document owns the shared files and --mods-dir.
A mod's repository is its folder: mod.json, src/, Resources/ (when the mod has any) at the root, plus README.md, LICENSE and .github/. Cloning it into a mods folder runs it as is, and DRH can pin one as a submodule (mods/api). It is named DRH-Mod-<Name>, <Name> free: --pack-mod and the index CI refuse another name, so a repository's name says it is a DRH mod, and a search on it finds them. The repositories around mods are named DRH-Mods-*: DRH-Mods-Index, DRH-Mods-Template, DRH-Mods-Workflows.
README.md is also the long description, shown on the mod's page in the launcher. HTML comments, invisible on GitHub, pick what the launcher shows: <!-- drh:show --> … <!-- /drh:show --> keeps only those zones (several allowed, joined in order), and <!-- drh:hide --> … <!-- /drh:hide --> drops one, inside a shown zone too. Without a shown zone, the whole file is shown, minus its hidden zones. The page always shows description above it, so an empty shown zone (<!-- drh:show --><!-- /drh:show -->) leaves just that. Zones do not nest, except a hidden one inside a shown one; an unclosed or misplaced marker fails --check-mod. What is shown is Markdown, at most 4000 characters. It need not say it is a DRH mod, nor which DRH and api it needs or that it is extends: the catalog says so, from mod.json. What GitHub alone shows comes first, saying what the repository is.
A mod builds on api and runs combined with it and with DRH's own code, all GPLv3, so its license must be GPL-compatible (GPL, LGPL, MIT, BSD, Apache 2.0, MPL 2.0, …). A reviewer checks it at an id's first entry and whenever LICENSE changes.
Resources/ holds the mod's own files. Art that is in the game is loaded from the game at runtime, not copied into the mod: it is not under the mod's license, and what the game's tables name, such as a chest's icon, then follows the game. A mod derived from an indexed one says so in what its README shows: which mod it comes from, and whether it replaces it, so that a player does not enable both. A reviewer checks both.
DRH-Mods-Template is the skeleton: mod.json, src/Main.hx (class Main extends mods.api.Mod), README.md (a placeholder: a first line for GitHub, pointing to Making a mod, the modders' steps, then a shown zone to fill; --check-mod refuses it while the shown zone keeps the template's sentence), LICENSE (GPLv3, as DRH and api), and .github/workflows/release.yml, which only calls the reusable workflow of Tutez64/DRH-Mods-Workflows, pinned to its moving major tag (@v1, moved along its v1.x.y releases): fixes reach every mod, only a breaking change needs a new major. Nothing else is copied into a mod, so nothing there needs updating. It runs as is, as my_mod (its Main logs loaded): the id is only in mod.json and in the package line of src/Main.hx. --new-mod copies it into a fresh history; it is also a GitHub template repository, whose Use this template leaves both to change by hand.
Every step is a DRH Launcher command. The checks exist once, in the launcher; the release workflow and the index CI run its latest Linux release (the AppImage, with APPIMAGE_EXTRACT_AND_RUN=1: runners have no FUSE), and a modder editing them gains nothing.
| Command | Does |
|---|---|
--new-mod <dir> |
Copies the template with git into a fresh history and its first commit, asks for name and author, takes the id the name gives or asks for one when it gives none, and writes them (the id into the package line of src/Main.hx too, the name into the README's title) with api set to the major.minor of the latest indexed api, then opens github.com/new with the suggested name. The repository is created there; the first push is plain git. |
--check-mod <dir> |
Checks what needs no game: the mod.json schema (id rules, version, api and dependency syntax, drh present exactly when uses names extends or replace), values left from the template (id my_mod, name, description, an empty author, README.md), the lengths (what README.md shows included) and its markers, no field outside the schema, the package rule for every file under src/ (and folder names that are package names), nothing under src/ but .hx files, none holding a character that is not seen when the code is read (a control character such as NUL, a zero-width one, a direction mark: an escape in a string writes it), the entry's module (src/<entry>.hx), no import.hx, a non-empty LICENSE, no mods.api._internal outside api. It notes, without refusing, code that reaches .core without extends, names a mod its dependencies do not list (in an import, in context.isActive("<id>"), or by its classes, such as Type.resolveClass("mods.<id>.Main"), where it points to context.isActive), or has empty catch blocks. |
--run-mod <dir or zip> |
Installs the mod's dependencies (api included) from the index into a cache, composes a temporary mods folder with them and the mod (its folder, or a zip such as the one the release workflow drafted), and launches the installed DRH on it, the launcher's options and its own --mods-dir included. Prints the game's output, then each mod's outcome from last-run.json; fails unless the mod is ok. Only id, api and dependencies need to be valid. Loading and behaviour are the author's own run. |
--pack-mod <dir> [<out-dir>] |
Checks, then builds the zip from a fixed list (mod.json, src/, Resources/ when present, LICENSE, README.md, flat at its root, extracted as is into mods/<id>/; sorted, fixed dates: the same sources give the same zip) and its index entry, <id>-<version>.zip and .json in <out-dir> (the current one by default). source is the repository the workflow runs in, or else the origin remote. It refuses a source not named DRH-Mod-<Name> and, run on a tag, a tag that is not v<version>. |
--submit-mod <dir> [<fork-owner>] |
Checks the published release as the index CI will, against a clone of the index (a version not indexed yet, dependencies that resolve, the id's source, where another one is only a note: a reviewer accepts a takeover) and in its zip (size and sha256, nothing but what --pack-mod packs, --check-mod, the entry it gives, the files of its tag, the mods its code names), prints the notes and stops on a problem. Then adds the index entry of the release on a branch of the author's fork of the index (forked once, in the browser: without one, it opens the fork page), pushes it with git, and opens the pre-filled compare page: one click opens the PR, whose template says the entry is published under CC BY 4.0. The branch is named after the mod's id, and the PR's title names the mod without a version: run again, for a new version or a release redone before the merge, it makes the branch again from the index with that entry alone, so the open PR gets it. The fork is the source owner's unless <fork-owner> is given (a repository owned by an organization). |
Publishing:
- Tag
vX.Y.Z, equal tomod.jsonversion, or nothing is built. - The release workflow packs and drafts a GitHub release with the zip and its index entry.
- The author tests that zip, then publishes the release.
--submit-mod. Git and a GitHub account are required; nothing else is installed and no token is handed out.
The index is Tutez64/DRH-Mods-Index. One file per version (mods/<id>/<version>.json), so concurrent PRs do not conflict; the index CI checks each one and generates the static file the launcher reads, https://tutez64.github.io/DRH-Mods-Index/index.json, served by GitHub Pages, not through the GitHub API, whose unauthenticated rate limit would throttle the catalog. A later website can live on the same Pages site. A move to another owner keeps that URL with a custom domain or a redirect left behind.
{
"id": "some_mod",
"name": "Some Mod",
"version": "0.1.0",
"author": "example",
"description": "Short summary for the catalog.",
"longDescription": "What the mod's README.md shows.",
"api": "1.2",
"drh": "20-22",
"uses": ["extends"],
"dependencies": { "cool_lib": "0.3" },
"url": "https://github.com/example/DRH-Mod-Some/releases/download/v0.1.0/some_mod-0.1.0.zip",
"size": 48213,
"sha256": "...",
"source": "https://github.com/example/DRH-Mod-Some"
}--pack-mod writes it. The fields of mod.json are copied, and the index CI checks them against the zip's. The others:
| Field | Role |
|---|---|
longDescription |
What README.md shows (Mod repository), so the catalog shows it before install. Empty: the page shows description only. |
url |
The zip, a release asset of source: <source>/releases/download/v<version>/<id>-<version>.zip. Other hosts may be allowed later. |
size, sha256 |
Of the zip, checked by the launcher before extracting. |
source |
The repository the release workflow ran in (issues, code). An id belongs to the source of its first entry: the index CI refuses a version from another one, unless a reviewer accepts a takeover. |
yanked |
Absent, or why the version was withdrawn. |
A merged entry never changes, except to add yanked: the launcher no longer offers that version and, where it is installed, shows the reason and offers the highest version not yanked. Removing the file would lose the history, and the source an id belongs to with its first entry.
The generated file lists every entry, same shape, sorted by id then version:
{ "format": 1, "generated": "2026-10-10T12:00:00Z", "entries": [] }There, each entry also says what GitHub counts for its release, as of generated:
| Field | Role |
|---|---|
published |
When the version's release was published, as GitHub writes it (2026-11-16T23:26:40Z). |
downloads |
How many times its zip was downloaded: by the launcher, to install it or to update to it, and by anyone else. |
The CI reads both from the releases of the entry's source, one request for each repository; an entry file has neither, and the index CI refuses one that does. The launcher sorts the catalog on them and shows them: a mod's downloads are those of all its versions, next to those of the version it offers; it was added when its first version was published, and last updated when the offered one was. A version GitHub says nothing of, its release deleted or GitHub not answering, has neither field: the index is deployed all the same, and the launcher shows no count for that mod and sorts it last.
A launcher refuses a format it does not know and asks to be updated. Each version keeps its longDescription; if the file grows too heavy, a later format moves them to one file per mod.
Index CI. On a pull request (pull_request: a read-only token, no secret; never pull_request_target), for each entry it adds or yanks:
- the pull request only adds
mods/<id>/<version>.jsonfiles that match their content, for versions not indexed yet, or addsyankedto one; - the zip downloads from
urlwithout an account (the release is published) and matchessizeandsha256; - the zip holds only what
--pack-modpacks (mod.json,README.md,LICENSE,src/,Resources/), under names that Windows writes as they are and as that many files: the CI extracts a zip on Linux, a player's launcher maybe on Windows, whereSRC/issrc/,main.hxisMain.hx, and a final dot or::$DATAis dropped; - the launcher's checks (
--check-mod) pass on the extracted zip, and itsmod.jsonand shown README match the entry: the entry--pack-modwould write from that zip is the one submitted; sourceis namedDRH-Mod-<Name>, and is the one theidbelongs to (its highest indexed version's), or a reviewer adds thetakeoverlabel;- every dependency,
apiincluded, has an indexed version that satisfies it; drhnames only DRH releases: a tag not released yet would keep the launcher from warning its players. One that leaves out the latest DRH is noted for the reviewer.
It writes in the job summary the diff of the sources against the zip of the last indexed version, what the reviewer reads, and flags an author that changed since that version, an id that is not the one its name gives, what --check-mod notes in the zip's code, a mod that code names and the index does not have, and a zip that does not hold the files its tag packs (a release made by hand), line ends aside. The reviewer reads that diff in place of the zip, so the zip does not choose what it shows: every file that differs is shown whole (a file moved as it is, from Resources/ into src/ say, is not a line that names it), no .gitattributes of the zip applies, and a source git still takes for binary, which a NUL character is enough for while the game reads it as the end of the source, fails the check. After a push to the pull request, it also writes what that push changed: the sources against those of the entry the pull request held before, whose zip is checked against that entry's size and sha256. A release redone under the same version leaves nothing to compare with. Both are posted on the pull request, the first in a comment kept up to date, the second in one comment for each push. A run is posted on the pull request it names alone, when that one is to the main branch and still at the run's commit: two pull requests may share a commit, and one to another branch would be checked by that branch's workflow and scripts, against its entries, which is also why a merged branch is deleted. The comment kept up to date records the commit whose report it shows; when a push is replaced by another before its report is posted, the next one's comment says that it is not all that changed since. The checks on an entry are the launcher's --check-entry <entry> <base-index> <work-dir> [--takeover]; the rest, the pull request's shape and the summary, is the CI's script. A pull request only brings JSON; the CI downloads and inspects a zip, never runs it. Merging needs the CI and the owner's approval (CODEOWNERS, branch protection). On the main branch, the CI generates index.json (--build-index <index> <out-file> <broken-file>, with the job's token for GitHub's rate limit) and deploys it to Pages: on each push, and once a day, since the download counts change without one. A zip GitHub no longer has, or whose digest is no longer the entry's sha256, no longer installs, unless the version is withdrawn: once the index is deployed, the CI opens an issue for that version (label broken-zip), mentioning the source owner, or for an organization who opened the entry's pull request, and closes it once the zip is found again or the version is withdrawn. A repository GitHub did not answer for leaves its issues as they are. The repository variable DRHL_VERSION picks the launcher release both run, a pre-release to test one; empty, the latest.
The entries and index.json are under CC BY 4.0 (credit the index, and each entry's author for its texts), so a website or a tool may reuse them. Submitting an entry publishes it so, its texts included; a reviewer makes sure someone else than the author has their consent. The CI's code, under .github/, is GPLv3.
Out of v1, same index: ratings, galleries, collections, dependency solving beyond one version per id, a publishing UI in the launcher (its commands cover it), a separate website.
hxScript parses .hx at runtime. On hxcpp a module can become cppia loaded as a real class. The interpreter is the default and the safety net: anything the emitter cannot express is skipped with a reason and stays interpreted.
Intended game build flags (hxscript = our fork):
-lib hxscript
-D hxscript_cppia
-D scriptable
-D hxscript_verbose # the CI log is where a skipped module is explained
-D hxscript_host=modding
-D hxscript_bridge_classpath=src,src-steam,submodules/ax4/compat,src-modding # classpath entries walked with an empty package
-D hxscript_bridge_exclude=DungeonBustersProject,... # value in project.xml, explained below
-D hxscript_bridge_packages=openfl,lime,swf,steamwrap # stock; whole trees until measured
-D hxscript_bridge_eager # type each bridge before the next: hundreds of bases overflow the compiler otherwise
-dce no # hxScript's own cppia setting
--macro include('haxe', true, ['haxe.macro', 'haxe.atomic.AtomicObject']) # force-type the std; AtomicObject is #error on hxcpp
--macro include('sys', true, ['sys.db']) # sys.db is @:cffi over hxcpp sqlite/mysql
-D hxscript_keep=cpp.vm.Gc,cpp.vm.Profiler # cpp.* by name (package has objc / link)
Bridge scan (fork). Submodules each have one root package, so stock -D hxscript_bridge_packages=openfl,lime,swf,steamwrap covers them (recursive; presets' ignore lists do not apply). DRH's own roots need a classpath-entry scan — walking the empty root would include the std — so the pinned fork has -D hxscript_bridge_classpath=src,src-steam,submodules/ax4/compat,src-modding and -D hxscript_bridge_exclude. src-modding is the cpp-only host (modding.Mod). Necessity is submodules/ax4/compat (root-level types no package scan can reach); for src/ alone a 35-package list would do. The define names classpath entries walked with an empty package, not a package called src (modulesUnder("src") would look for src/src/ and emit src.actor.Hero). The walk skips *.macro.hx. -D hxscript_host=modding stays upstream's meaning: packages scanned for @:scriptAmbient / @:scriptStatic. -D scriptable is hxcpp's cppia flag; it does not generate extend bridges.
What the first cppia build does not compile:
DungeonBustersProjectis the entry point, not a base a mod extends.openfl.flimportsopenfl._internal.formats.xfl, absent here.openfl.datais#if windowswith no else.WebSocketandServerWebSockethave noopenfl.utils.io.ByteArray.openfl.xml:XMLhas noNamespace, andXMLList's inlined methods do not type in C++ under-D scriptable.openfl.display._internal.native,NativeLocalConnectionandNativeVideoBackend@:includea file that pullsWindows.h.- Lime's cpp backend is
native. The exclude dropshtml5,air,flash,emscripten, andlime.tools(the CLI). - The swf exporters and
SWFLiteLoaderimporthxp.ActionNextFrame,ActionGotoFrame,ActionGetURLandActionGotoLabelhave apackageline with no semicolon.AS3GraphicsDataShapeExporterandFrameScriptParserdo not type on cpp. b2internalandas3commons_collectionsare leftover AS3namespacefiles.
If the binary is too fat, cut openfl._internal and Lime backends first, then narrow to display roots (openfl.display, openfl.text, openfl.geom, openfl.events).
DCE. DRH and Lime's cpp templates pass no -dce, so the build is Haxe's default -dce std: unused standard library members are stripped; game / OpenFL / Lime / swf / SteamWrap never were. The host switches to -dce no. That is hxScript's cppia position (-D scriptable resolves host classes by name at load; DCE removes whatever no compiled call site references). Its probe: 42 of 83 commonly-scripted std members unreachable under -dce std, 3 under -dce no. hxscript_keep as the primary mechanism is the same curated list we rejected for bridges.
-dce no keeps what is typed; it does not type what nothing references. A mod calling haxe.crypto.Sha256 when nothing in the host names it gets Type not found. Libraries are already covered (Autowire + the bridge scan). The std is the gap. DRH goes further than hxScript and force-includes it: --macro include('haxe', true, ['haxe.macro']) and include('sys', true, ['sys.db']). sys is 34 modules and Lime already types most of them; the net addition is Http, FileStat, thread pools, EventLoop, Condition, Semaphore, ssl.Digest. sys.db is excluded up front (Sqlite / Mysql need linking). haxe.atomic.AtomicObject is #error on hxcpp, so it is on the ignore list; anything else that fails to type joins it. cpp.* is not included wholesale (cpp.objc, cpp.link); name what a mod may want via -D hxscript_keep. Cost is mostly build time (one .cpp per class). If it hurts, grow the ignore list; never return to -dce std.
hxcpp. libhxcpp (submodules/libhxcpp) already has the fixes of submodules/hxscript/patches/apply-hxcpp.py, two of them (issues 1 and 3) in its own form, which the script reports as NO MATCH.
JIT. On before any module loads: Compiler.compile does it (Compiler.jit) and retries a refused batch once without it.
Start, then compile (upstream's order: the emitter resolves bare names through each module's interpreter). Static initialisers therefore run once interpreted, compiled modules included. A module-level, type-init or static-initialiser throw fails its mod. A mod that failed before the compile (load, start, or a dependency's) has its files removed first. A throw inside the compiler fails no mod: the emitter skips the module it was writing, and if Compiler.compile throws anyway, everything stays interpreted.
Size / time. Real binary cost: -D scriptable, OpenFL/Lime/swf bridges (DisplayObject has a large method surface; swf ~240 modules; SteamWrap / src-steam / compat are negligible), and the src/ classpath bridges. -dce no plus the std include is mostly build time. Measure a first cppia build against current DRH before treating compiled mods as free.
No type blacklist. Do not set -D hxscript_sandbox. Interpreted and compiled resolve the same types.
The compiled path is not automatic: the host must call Compiler.compile(env) and wire Compiler.ambient / Compiler.statics (hxScript trap: interpreter ambients are not the compiler's).
One world, one batch (v1). All enabled mods go into a single Environment and a single Compiler.compile(env). That is what lets a mod import another's types and stay compiled: cppia resolves a class either inside the module being loaded or as a host class; a scripted class in another batch is neither. Inside one batch, every module is declared before any is emitted. Price:
- Skips cascade. If
mods.cool_lib.Apiis refused, every module naming it is skipped too. A parse error incool_libmeans it declares nothing and dependents fail at import.dependenciesmakes that visible; it does not remove the coupling. - Blast radius of
Module.boot(). A loader reject recompiles the batch without one module at a time, the module the reject names first, and keeps the first batch the loader takes: the bad module and the modules using it stay interpreted, the rest compiles. Only when no single module is to blame is the batch split (narrowOnFailure, default on), which leaves modules using a class of the other half interpreted. Per-mod worlds would confine that and forbid compiled inter-mod use. - No selective unload. Dropping the world drops all mods. v1 does not unload.
Name collisions are excluded by the package rule, not by isolation.
Bytecode cache (cppia bytes on disk, invalidated when the game version, mod.json, or sources change) is a future optimization, not what makes mods "compiled".
Vanilla code will follow DR.
apimods follow Versioning. Internals can move behind wrappers.extends/replacedepend on host types. They can break on Starling without anapibump.drhis how the launcher warns (not a hard refuse).- The game still tries to load; failures go to
last-run.json.
Needed before a real host; not a restatement of the rules above.
- Done. Patch hxScript. Except
replacewhich is still missing. - Done. hxcpp cppia patch.
- Done. The flags above are in
project.xml. - Done, except
replace.src-modding/loads--mods-dirinto one world, runs the lifecycle, re-registers the overlay, and bakes the release tag (noV) into the host.uncaughtErrorand the modexitinglistener sit at the top of the constructor. Still later:ASCompat.createInstanceconsulting thereplacetable, once the fork hasreplace. - Done. Launcher
0.4.0: the Mods page (catalog and installed mods, install with dependencies from the index, a zip or a repository link,enabled.jsonand load order,--mods-dir,last-run.jsondisplay; no destructive overlay), and the modders' commands,--new-modto--submit-mod. The CI of 6 and 8 runs its latest release. - Done.
Tutez64/DRH-Mods-Index: README, licenses, owner, its CI, which runs the launcher with--check-entry. - Done. The
apimod has its repository, pinned asmods/api(Versioning). The wrappers live in theapimod, core events hand game objects, dependency failures propagate. - Done.
DRH-Mods-Template, andDRH-Mods-Workflows, which runs the launcher with--pack-mod.
- User guide, polished store UX, or Steam Workshop.
- Final JSON schema for the index.
- Host code or hxcpp patch.
- Private servers, offline solo, or bypassing official checksums.
- Making Thunderstore, Nexus, or Discord the source of truth.