mirror of
https://github.com/horizon-rust/horizon.git
synced 2026-12-03 20:54:04 +07:00
[GH-ISSUE #5109] Proposal (sketch): runtime mod loading via stable-ABI native plugins — a vision for modding's future #1556
Open
opened 2026-11-02 15:47:57 +07:00 by bsakaguchi
·
5 comments
No Branch/Tag specified
main
layers/tab-mark
layers/render-telemetry
automation/native-hook-stamp
layers/plan
bench/smp-perf-union3
bench/smp-perf-union2
perf/hopper-cart-item-columns
perf/guest-pickup-columns
perf/hopper-container-entity-columns
bench/smp-perf-union
perf/spawner-player-scans
perf/ticking-chunk-neighbours
pr-screenshots
nightly-state
nightly/build-2026-11-08-1
nightly/build-2026-11-08-2
agent/native-prebuilt-install
feat/shop-fortnite
agent/native-prebuilt-export
ci/runner-gc-busy-versioned-bin
nightly/build-2026-11-07-2
agent/cg69-11273-after-11457
nightly/build-2026-11-07-1
fix/storage-is-multiple-of
perf/name-tag-layout-cache-from-10328
perf/zlib-level-2
deploy/smp-profile
pvp/hud-layout
fix/launcher-uninstall-window
nightly/build-2026-11-05-3
nightly/build-2026-11-05-2
nightly/build-2026-11-05-1
fix/9382-review-fixes
deploy/r9-1-moderation
deploy/rtp1-8669
bench/site-2026-11-04
nightly/build-2026-11-04-3
screenshots/launcher-dezer
nightly/build-2026-11-04-2
dezer/partner
perf/spawn-start-palette
agent/rdbtcvs/server-preload-existing-world
agent/rdbtcvs/server-no-mesh-tables
screenshots/launcher-redesign-5
deploy/r8-1-slowtick-culprit
fix/8570-font-fishy-any
screenshots/lr6-audit
lr6/instance-defaults
nightly/build-2026-11-04-1
nightly/build-2026-11-03-3
nightly/build-2026-11-03-2
bench/stps1-diag
hotfix/r6-1-station-crash
bench/stps1-cart
perf/still-cart-collisions
fix/launcher-ko-hr-wardrobe
screenshots/launcher-redesign-4
perf/vulkan-pipeline-cache
perf/dx12-fxc-measure
perf/teleport-forget
perf/prebuild-lazy-pipelines
perf/mesh-view-first
perf/sync-data-once
perf/entity-skin-eyes
perf-jobs/pool
perf/gpu-solid-draws
perf/gpu-solid-lists
perf/upload-budget-follows-frame
perf/surface-rules-by-biome
perf/section-instances-once
nightly/build-2026-11-01-5
nightly/build-2026-11-03-1
bench/sp3-int
perf/cart-collisions-near
sweep-l/5696
sweep-l/5645
sweep-l/5644
sweep-l/5643
nightly/build-2026-11-01-4
bench/sp2-tags
mod-api-rework
bench/sp2-ovl-b
perf/world-prepare-overlap-b
nightly/build-2026-11-01-3
sweep-l/5513
sweep-l/5598
sweep-g/remerge-5696
sweep-g/remerge-5693
sweep-g/remerge-5645
sweep-g/remerge-5644
sweep-g/remerge-5643
nightly/build-2026-11-01-2
bench/sp2-prepare-times
nightly/build-2026-11-01-1
bench/sp2-props-count
bench/sp2-start-stages
perf/mimalloc-lazy-arena-commit
bench/sp2-lant
bench/sp2-lanb
bench/sp2-emk
perf/entity-models-wanted-keys
bench/sp2-mem-loaders
bench/sp2-mem-stages
bench/sp2-lan-spans
bench/sp2-stream-spans
fix/5326-remove-native-build
perf/decoration-order-lookups
perf/dedicated-world-preload
bench/sp2-rt-span
launcher-gpui-fast
bench/sp2-purge-env
feat/native-nicknames-stamped
perf/random-tick-reads-first
a3/fix-perf-bench-test
agent/finish-4958
hotfix/attack-arm
a2/fix-hub-attack
fix/audio-share-fields
feat/native-sidebar-stamped
perf/attr-ids
perf/mobs-move-back
bench/sp1-f5
bench/sp1-f4
bench/sp1-all
bench/sp1-f3
bench/sp1-f2
bench/sp1-f1
perf/net-events-list
fix/join-message-order
feat/smp-grief-hooks
feat/anticheat-speed
fix/server-floating-kick
bench/st2-f1
perf/spawn-placement-first
tools/bots-server-mix
tools/bots-view-time
debug/light-edge-4294
w5/data-file
perf/collision-shapes-w4
bench/sn-abuse
bench/sn-w4-scratch
bench/sn-w4-ladder
fix/remote-thrown-egg
union/pt3-w2
union/pt2-e3
union/wasm-removal
union/pt2-e2
union/pt2-e
union/pt2-c2
union/pt3-w1
triage/pt3-3106-check
union/pt2-c
union/pt3-5
triage/pt3-bisect-rest
triage/pt3-bisect-2608
triage/pt3-2960
ci/parity-incremental
union/pt3-4
union/pt3-3
union/pt2-a
union/pt1-wave1
triage/pt3-2608
union/pt3-2
triage/pt3-2586
triage/pt3-2544
launcher-java-inherits-abca441
launcher-java-play-99b52c2
launcher-native-auto-8ea9a2c
union/pt3-1
launcher-native-auto-f220157
union/cg29-2
union/cg29-1
launcher-delete-instance-cbacada
union/cg28-1
union/cg27-3
union/cg27-2
union/cg27-1
union/cs2-b9v2-3403
union/cs2-b9v2-2888
union/cs2-b9v2-3455
union/cs2-b9v2-text
launcher-java-command-c5221cc
launcher-java-command-266c457
launcher-join-40073ab
union/cs2-b9-2888
union/cs2-b9-e
union/cs2-b9-a
union/cs2-b9-c
launcher-java-command-a7841cc
launcher-any-version-e470f3a
launcher-java-instances-2034db1
launcher-any-version-d4120a9
launcher-any-version-795a0db
launcher-java-test-windows-75b8a17
union/cs1-b9-3048
union/cg24-u1
feat/mod-shaders-game
feat/mod-shader-check
feat/mod-storage-quota
union/cg19-r5
screenshots/nightly-1
union/cg19-r4
union/cg19-r3
union/cg19-r2
union/cg21-kacpherek-2
union/cg19-r1b
carry/2592-headless-capture
union/cg19-r1
screenshots/sculk-sidebar-2
fix/entity-nbt-duplicate-rabbit
union/cg19-a3
union/cg19-a2
cg19/union-bc
union/cg19-bc
cg21/union
union/cg21-kacpherek
feat/mods-lua
cg20/union-c
union/cg19-a
cg20/fusseltv-followups
cg20/union
screenshots/launcher-features
feat/launcher-packs
integ/cg17-w4
chore/site-redeploy-workflow
feat/sculk-banner
ci/playhorizon-parity-trial
feat/world-post-chain-hook
ci/desktop-parity-trial-3
ci/desktop-parity-trial-2
ci/desktop-parity-trial
perf/packed-storage-no-div
feat/native-shaders-sdk
pr-evidence/remove-shader-packs
pa1/remove-dh-mixins
fix/st-border
screenshots/reports-gate-2
perf/metal-occlusion-cull
fix/macos-uncapped-redraw
screenshots/perf-rd32-1190
perf/visible-bucket-sort
screenshots/shaders-1
perf/screen-overlay-wrap
screenshots/menus-vanilla
screenshots/design-gaming-website
screenshots/design-gaming
feat/horizon-shaders-rust
feat/horizon-shaders-v1
feat/shader-pack-options
perf/metal-multi-draw
perf/random-tick-reads
screenshots/update-channels
screenshots/f2b-resource-packs
integ/w2
screenshots/f2a-resource-packs
feat/codemods-1
screenshots/live-count
perf/random-tick-batches
feat/raytracing-spike
screenshots/platform-batch
integ/w1
fix/main-moving-block-tint
screenshots/f3-dynamic-lights
screenshots/f1-shaders
docs/perf-comparison-v2
screenshots/q2-parity-entities-audio
screenshots/q1-parity-ui
screenshots/p4-worldgen-chunks
screenshots/b2-rendering
screenshots/perf-frame-cost
feat/companion-safety
feat/companion-polish2
feat/companion-route
feat/companion-nether
integ/contrib-10-21
feat/companion-planner
feat/companion-end
feat/companion-polish
feat/companion-integ
feat/companion-voices
feat/companion-engine
feat/companion-skills
feat/companion-body
feat/companion-brain
feat/companion-senses
feat/companion
screenshots/launcher-servers
perf/lod-side-faces
perf/section-occlusion-cull
perf/compact-terrain-vertex-20byte
fix/server-thread-default
perf/chunk-occupied-columns
media/modpacks-launcher
fix/server-game-rules-page
review/contrib-review-1-startup-batch
fix/f3-network-counters
fix/clouds-cached-mesh
fix/remesh-tail
feat/vaults
pr-evidence/291
pr-evidence/287
pr-evidence/285
feat/perf-comparison
pr-evidence/238
design-review
fix/particles-63-missing-types
t3/achieve-full-parity
prepare-fix
graphics
launcher-0.1.2
game-bugs
feel
menus
cleanup
launcher
parity/screens
parity/leftovers
parity/server-leftovers
parity/menus-golem
parity/platform-maths
parity/save-roundtrip
parity/old-saves
parity/old-saves-flat
parity/warden-sculk
parity/spawn-gear
parity/rendering-gaps
parity/dedicated-server
parity/villager-social
parity/render-distance
parity/mobs-b
parity/block-followups
parity/mobs-a
parity/score-subtitles
parity/loom-crafter
parity/tablist-border
parity/raids
parity/tooling
parity/rendering-be
parity/hud
parity/entity-ai
parity/rendering-anim
parity/rendering-hud
parity/saves
parity/blocks
parity/loot-spawn
parity/multiplayer
parity/input
parity/assets
ci/ludodesktop-runner
launcher@0.2.56
launcher@0.2.55
launcher@0.2.54
launcher@0.2.53
launcher@0.2.52
launcher@0.2.51
nightly-source/2026-11-08-fdc87ae
nightly
launcher@0.2.50
nightly-2026-11-07
nightly-source/2026-11-07-2ebf00a
nightly-source/2026-11-07-6560641
launcher@0.2.49
launcher@0.2.48
launcher@0.2.47
launcher@0.2.46
launcher@0.2.45
launcher@0.2.44
launcher@0.2.43
nightly-2026-11-05
nightly-source/2026-11-05-66f3981
nightly-source/2026-11-05-38609b7
nightly-source/2026-11-05-f319701
launcher@0.2.42
launcher@0.2.41
launcher@0.2.40
nightly-2026-11-04
nightly-source/2026-11-04-6475f62
nightly-source/2026-11-04-3fb4c31
launcher@0.2.39
launcher@0.2.38
nightly-source/2026-11-04-67dad0d
nightly-2026-11-03
nightly-source/2026-11-03-2944480
nightly-source/2026-11-03-f42ef42
launcher@0.2.37
launcher@0.2.36
launcher@0.2.35
launcher@0.2.34
nightly-2026-11-01
nightly-source/2026-11-01-c9d474d
nightly-source/2026-11-01-4aa6854
nightly-source/2026-11-01-8c02c0b
launcher@0.2.33
nightly-source/2026-11-01-07b7ea3
launcher@0.2.32
nightly-source/2026-10-31-d91cab6
nightly-source/2026-10-31-aa27eca
launcher@0.2.31
nightly-source/2026-10-31-68ac6f6
nightly-source/2026-10-31-9d979ca
nightly-source/2026-10-31-7635280
nightly-source/2026-10-31-7aa0e28
launcher@0.2.30
launcher@0.2.29
nightly-source/2026-10-30-1da354b
nightly-source/2026-10-30-587f81f
nightly-source/2026-10-30-41672b1
nightly-source/2026-10-30-ba6344a
nightly-source/2026-10-30-fbd7288
nightly-source/2026-10-30-a99ef86
nightly-source/2026-10-30-33f417f
nightly-source/2026-10-30-df583d3
nightly-source/2026-10-30-a46ce68
launcher@0.2.28
nightly-source/2026-10-29-a305d38
launcher@0.2.27
nightly-source/2026-10-29-baa379d
nightly-source/2026-10-29-d009ebd
nightly-source/2026-10-29-64e2989
nightly-source/2026-10-29-a491181
launcher@0.2.26
nightly-source/2026-10-29-45ecf7b
launcher@0.2.25
nightly-source/2026-10-29-5e391eb
nightly-source/2026-10-29-4baa571
launcher@0.2.24
launcher@0.2.23
nightly-source/2026-10-28-6f8c7a0
nightly-source/2026-10-28-9669600
launcher@0.2.22
v0.2.97
v0.2.96
v0.2.95
v0.2.94
launcher@0.2.21
v0.2.93
nightly-source/2026-10-28-83f15fa
nightly-source/2026-10-28-9b772b2
launcher@0.2.20
v0.2.92
launcher@0.2.19
launcher@0.2.18
launcher@0.2.17
v0.2.91
v0.2.90
v0.2.89
v0.2.88
v0.2.87
v0.2.86
launcher@0.2.16
v0.2.85
v0.2.84
v0.2.83
v0.2.82
v0.2.81
launcher@0.2.15
v0.2.80
v0.2.79
launcher@0.2.14
v0.2.78
v0.2.77
launcher@0.2.13
v0.2.76
v0.2.75
v0.2.74
launcher@0.2.12
v0.2.73
v0.2.72
v0.2.71
v0.2.70
launcher@0.2.11
v0.2.69
launcher@0.2.10
v0.2.68
v0.2.67
launcher@0.2.9
v0.2.66
v0.2.65
v0.2.64
v0.2.63
v0.2.62
v0.2.61
v0.2.60
v0.2.59
v0.2.58
launcher@0.2.8
v0.2.57
v0.2.56
launcher@0.2.7
v0.2.55
v0.2.54
v0.2.53
v0.2.52
v0.2.51
launcher@0.2.6
v0.2.50
v0.2.49
launcher@0.2.5
v0.2.48
v0.2.47
launcher@0.2.4
v0.2.46
v0.2.45
v0.2.44
v0.2.43
v0.2.42
v0.2.41
v0.2.40
v0.2.39
v0.2.38
v0.2.37
v0.2.36
v0.2.35
v0.2.34
v0.2.33
v0.2.32
v0.2.31
v0.2.30
launcher@0.2.3
v0.2.29
v0.2.28
launcher@0.2.2
v0.2.27
v0.2.26
v0.2.25
v0.2.24
v0.2.23
v0.2.22
v0.2.21
v0.2.20
v0.2.19
v0.2.18
v0.2.17
v0.2.16
v0.2.15
v0.2.14
v0.2.13
v0.2.12
v0.2.11
v0.2.10
v0.2.9
v0.2.8
v0.2.7
v0.2.6
v0.2.5
v0.2.4
launcher@0.2.1
v0.2.3
v0.2.2
v0.2.1
v0.2.0
launcher@0.2.0
v2026.10.23
v2026.10.22.16
v2026.10.22.15
v2026.10.22.14
v2026.10.22.13
v2026.10.22.12
v2026.10.22.11
v2026.10.22.10
v2026.10.22.09
v2026.10.22.08
v2026.10.22.07
v2026.10.22.06
v2026.10.22.05
v2026.10.22.04
v2026.10.22.03
v2026.10.22.02
v2026.10.22.01
v2026.10.22
launcher-v0.17.0
v2026.10.21
v2026.10.19.15
launcher-v0.16.0
launcher-v0.15.0
v2026.10.19.14
v2026.10.19.13
launcher-v0.14.0
launcher-v0.13.0
v2026.10.19.12
v2026.10.19.11
v2026.10.19.10
launcher-v0.12.0
v2026.10.19.09
v2026.10.19.08
v2026.10.19.07
v2026.10.19.06
launcher-v0.11.0
launcher-v0.10.0
v2026.10.19.05
v2026.10.19.04
v2026.10.19.03
v2026.10.19.02
v2026.10.19.01
v2026.10.19
v2026.10.18.27
v2026.10.18.26
launcher-v0.9.0
v2026.10.18.25
v2026.10.18.24
v2026.10.18.23
v2026.10.18.22
v2026.10.18.21
launcher-v0.8.0
v2026.10.18.20
v2026.10.18.19
v2026.10.18.18
launcher-v0.7.1
v2026.10.18.17
v2026.10.18.16
v2026.10.18.15
v2026.10.18.14
launcher-v0.7.0
v2026.10.18.13
v2026.10.18.12
v2026.10.18.11
v2026.10.18.10
v2026.10.18.09
v2026.10.18.08
v2026.10.18.07
launcher-v0.6.0
v2026.10.18.06
v2026.10.18.05
v2026.10.18.04
v2026.10.18.03
v2026.10.18.02
v2026.10.18.01
v2026.10.18
v2026.10.17.25
v2026.10.17.24
v2026.10.17.23
v2026.10.17.22
v2026.10.17.21
v2026.10.17.20
launcher-v0.5.1
v2026.10.17.19
v2026.10.17.18
v2026.10.17.17
v2026.10.17.16
v2026.10.17.15
v2026.10.17.14
launcher-v0.5.0
v2026.10.17.13
v2026.10.17.12
v2026.10.17.11
v2026.10.17.10
v2026.10.17.09
v2026.10.17.08
v2026.10.17.07
v2026.10.17.06
v2026.10.17.05
v2026.10.17.04
v2026.10.17.03
v2026.10.17.02
v2026.10.17.01
v2026.10.17
v2026.10.16.12
v2026.10.16.11
v2026.10.16.10
v2026.10.16.09
v2026.10.16.08
v2026.10.16.07
v2026.10.16.06
v2026.10.16.05
v2026.10.16.04
v2026.10.16.03
v2026.10.16.02
v2026.10.16.01
v2026.10.16
v2026.10.15.22
v2026.10.15.21
v2026.10.15.20
v2026.10.15.19
v2026.10.15.18
v2026.10.15.17
launcher-v0.4.0
v2026.10.15.16
v2026.10.15.15
v2026.10.15.14
v2026.10.15.13
v2026.10.15.12
v2026.10.15.11
v2026.10.15.10
v2026.10.15.9
v2026.10.15.8
v2026.10.15.7
v2026.10.15.6
launcher-v0.3.0
v2026.10.15.5
v2026.10.15.4
v2026.10.15.3
launcher-v0.2.1
v2026.10.15.2
v2026.10.15.1
v2026.10.15
v2026.10.14.5
v2026.10.14.4
v2026.10.14.3
launcher-v0.2.0
v2026.10.14.2
launcher-v0.1.6
launcher-v0.1.5
v2026.10.14.1
v2026.10.14
launcher-v0.1.4
launcher-v0.1.3
v2026.10.13.1
launcher-v0.1.1
v2026.10.13
v2026.10.12
archive/wip-horizon-mobs-split
archive/m2-gaming-optimization
Labels
Clear labels
bug
bug
client
crucial
documentation
duplicate
duplicate
enhancement
enhancement
enhancement
from-discord
from-discord
from-website
good first issue
in progress
launcher
multiplayer
parity
parity-regression
pull-request
Mirrored from GitHub Pull Request
release-blocker
release-now
roadmap:java-instances
roadmap:lean-code
roadmap:modpack-worldgen
roadmap:mods
roadmap:port-ledger
roadmap:server-thread
roadmap:server-tick
roadmap:smooth-frames
server
skip-release
test
No labels
bug
bug
client
crucial
documentation
duplicate
duplicate
enhancement
enhancement
enhancement
from-discord
from-discord
from-website
good first issue
in progress
launcher
multiplayer
parity
parity-regression
pull-request
release-blocker
release-now
roadmap:java-instances
roadmap:lean-code
roadmap:modpack-worldgen
roadmap:mods
roadmap:port-ledger
roadmap:server-thread
roadmap:server-tick
roadmap:smooth-frames
server
skip-release
test
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
horizon-rust/horizon#1556
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @BlueGradientHorizon on GitHub (Oct 31, 2026).
Original GitHub issue: https://github.com/horizon-rust/horizon/issues/5109
First of all - this is genuinely impressive work. A clean-room 26.3 client in Rust with this level of parity discipline (harnesses, oracles, the port ledger) is something I haven't seen anywhere else. Huge respect to everyone involved.
That said, I think the current modding direction - WASM removed (#3350), code mods only as native mixin bundles compiled into the game is a dead end, and I'd like to make the case for eventually building a runtime mod-loading mechanism back.
Minecraft arguably became what it is because modding was easy: download a ready .jar, drop it in a folder, launch. A couple of minutes, zero knowledge required. The current approach reverses all of that:
I understand the rationale, the WIT sandbox couldn't express what hook APIs now do (block entities, server menus, redstone, scheduled ticks, mobs, mod net), and building reviewed source locally sidesteps the "run someone else's binary" trust problem. But the cost is that code modding changes its audience from "any player" to "a player with a desktop and 10 free minutes".
My hope is that someday a runtime mechanism returns, even a narrow one (stable hook ABI, signed prebuilt game variants per mod-set from CI, or an opt-in sandbox for binary mods) so the content mods stay one-click for everyone, and code mods can be one-click too.
I did a small brainstorming session with an AI agent, and here is what we came up with.
Proposal: stable-ABI native plugins (
cdylib) instead of source patches (.hnmod)Keep everything Rust-only and native-speed, but stop recompiling the game per mod.
How it would work
horizon-abi— a small versioned stable-ABI crate, versioned per domain (e.g.worldgen:1, blocks:3), not one globalu32.#[repr(C)],extern "C", opaque handles, no generics/Vec<String>/dynon the boundary. This is the only contract a mod links against. Neverhorizon-clientinternals directly.horizon-sdk— a safe, idiomatic, header-only wrapper overabi. Compiled into the mod, so#[inline(always)]newtypes (EntityRef,Game,ServerCtx) optimize to the same asm as direct access. This is where canonical Rust lives: iterators,Result, lifetimes,#[mixin]proc-macros.cdylib(.so/.dll/.dylib), one artifact peros x arch(win/linux/mac x x86_64/aarch64). The registry keeps all binaries per version, the launcher downloads only the client's own. No source rebuild on player PCs — this fixes weak PCs and closed-source mods at once.[[injection]] target = Game::native_keybecomes a stable exported hook slot with a signature hash, e.g.horizon_hook_world_tick__v7__a3f9c1. The loader resolves it withdlsymat runtime and installs aretour-style detour only if the hash matches. No mod: one predictable branch (~0cost). With mod: one indirect call. Cancellable / replace / collect hooks reuse thelisten / cancel / replace / collectsemantics already merged into main via #5638/#6216 (an explicit encoding over FFI plus multi-mod order, not a raw detour).MODIFY_VARIABLE/RETURNpatches are not detoured — they become explicit upstream slots (see below).O(1)per frame/chunk. The host hands the mod contiguous slices or views (on_chunk_tick(pos: *const f32, vel: *mut f32, n: usize),ChunkView { get, set, biome }for worldgen), the tight loop lives inside the mod where LLVM/LTO sees it. Private fields via runtime-queried offsets cached in astatic— oneaddin the hot loop. Oldmod.sobuilt againstsdkkeeps working on a new client as long as the domain symbols it uses are unchanged.What changes for a mod —
zoomexampleToday (
horizon-mixin.toml+ source patch):Proposed:
runtime.rs(settings,STATE, all#[test]) moves over 1:1 — it never touchedGameanyway.horizon-mixin.tomldisappears,compatibility.json: horizon_revisionbecomesapi_versionper domain. Same pattern coverscoords-hud/fps-overlay/keystrokes/minimap(a handful ofHEADhooks each);recipesonly rewrites itsglue.rsintoFromimpls overrepr(C)slices;smpkeeps its pure-logic files untouched and rewrites onlyglue.rsplus one-function hook shims.The
zoompattern coversHEADhooks with primitives. A complex mod needs more:tectonic-horizonat75c5a2c(2026-11-01; taken as an example;mixins/tectonic_horizon/horizon-mixin.toml) uses 8 injections + 4 modules — plainHEAD(mod-menu-entry,worldgen-registries,river-decoration,activate-world), cancellableHEAD(parameter-seeds -> ControlFlow<[u64; 2]>,increased-build-height -> ControlFlow<Option<LevelHeight>>),MODIFY_VARIABLE(snow-height: localstartatSTORE),RETURN(monument-depth:BoundingBox, magic box58x23x58 at Y=39), and[[module]]in-crate code (terraintables,runtimelower/populate,selectionasimpl ... for super::WorldgenOverrides,decorationwithuse crate::registry::BlockStateId, crate::worldgen::..., super::{GeneratorData, ProtoChunk}plushorizon_core::density/noise/random). For that class the slot is a domain API, not a detour — details per kind below.What changes for a mod —
tectonicexample (per injection kind)Source:
tectonic-horizon @ 75c5a2c(2026-11-01; taken as an example — every Today snippet below verified against this commit). Each kind below shows Today (.hnmodsource patch) → Proposed (insidemod.sovshorizon-sdk).1.
HEADplain —mod-menu-entry(Game::native_mods,&mut Vec<NativeMod>).Today:
Proposed: no code hook — declarative manifest. The host reads it, no
Vec<NativeMod>over FFI:2.
HEADwith rich types —worldgen-registries(WorldgenOverrides::apply,&WorldgenOverrides + &str + &mut BTreeMap).Today:
Proposed:
BTreeMapnever crosses the boundary — JSON strings via arena:3.
HEADcancellable —parameter-seeds(seed_from_hash -> ControlFlow<[u64; 2]>).Today:
Proposed:
replacecontract from #6216 (firstSomewins), primitives only:4.
MODIFY_VARIABLE—snow-height(height_adjusted, localstartatSTORE,$value: i32 -> i32).Today:
Proposed: not a detour — an explicit slot. The fragile local disappears:
5.
RETURN—monument-depth(make_bounding_box -> BoundingBox).Today:
Proposed: explicit slot with
repr(C)box, no internal return patching:6.
HEADcancellable with struct return —increased-build-height(level_height -> ControlFlow<Option<LevelHeight>>).Today: reads host internals (
overrides.entries(DIMENSIONS),entries(DIMENSION_TYPES)) to decide.Proposed: host answers the queries, mod only decides on primitives:
7.
HEADchunk batch —river-decoration(Decoration::decorate,&Arc<GeneratorData> + i64 + &WorkerState + &mut [ProtoChunk; 9]).Today (inside host crate, full internal access):
Proposed: host owns
GeneratorData/samplers/ProtoChunk; mod gets a view + field callback. NoArc, noDensityCompilerin the mod:The
OnceLock<Mutex<Vec<Arc<Samplers>>>>cache indecoration.rsmoves host-side.8.
HEADlifecycle —activate-world(shared_data_with,&WorldgenOverrides+ModList::load,game_home,forget_shared_data).Today:
Proposed: lifecycle events, host owns cache + mod list:
9.
[[module]]—terrain/runtime/selection/decoration.Today: compiled into
crates/horizon-world(file = "crates/horizon-world/src/worldgen/overrides.rs"), souse crate::.../super::...works.Proposed:
terrain.rs(BASE/MOD/TALLconst tables) →data/JSON files in the.hmod, no Rust.runtime.rs(Config,lower,populate, tests) → puremod.socode overStr/JsonMap(unit-tested vs fakeApiTable);tectonic:config_*codecs lowered host-side.selection.rs(impl TectonicWorldSelection for super::WorldgenOverrides) → manifest flagper_world_selection = true, host implements.decoration.rs→ see (7); theuse crate::.../super::imports disappear because the APIs they used (DensityRegistry::from_json,decode_noise,BlockStateId,set_block_worldgen) become host calls behindChunkView/DecorCtx.Pros vs current
.hnmodmanifest permissions + sigstore/minisign, reproducible builds stay verifiable.horizon_revisionpin breaks on any commit.cargo add horizon-sdk,rust-analyzer,docs.rs,cargo testagainst a fakeApiTableinstead of rebuilding the whole game for checks.Remaining cons (honest)
revoked.tomlalready exists; fs/net access is reviewed via manifest, not technically enforced (why not a real sandbox — see the Sandbox section below).unsafeboundary to maintain:#[repr(C)]layout asserts,catch_unwindon everyextern "C"entry,Send/Syncaudits, no panics/async/allocation across FFI.native-hooks.jsonat the repo root plustools/native-hook-fragments/), which is exactly why discipline must be per domain rather than one global number.MODIFY_VARIABLE/RETURNare the most fragile patches (local ordinals,STOREsites, struct layout), so turning them into explicit slots (native_snow_offset,native_structure_box) is the right price — requested via the existingtools/native-hook-fragments/+stamp_native_hooks.pyprocess. Today's source mixins stay as the incubator: a working Tier 2 patch justifies the Tier 1 slot proposal.BTreeMap<String,String>,Arc<GeneratorData>,ProtoChunk) and[[module]]in-crate access (crate::/super::,DensityCompiler,XoroshiroRandom) cannot cross a.soboundary — they need the domain views above, so the ABI is ~12 narrow domain interfaces (lifecycle/server, worldgen, blocks/behaviour, block-entity + machines, items, entities/mobs, guards/players, menus/screens, loot/recipes, render/HUD, net, data/content), each versioned separately.Sandbox: options considered, and why this model has none
For the record, every sandbox shape was looked at and rejected for this architecture — not from dislike, but because none survives contact with «arbitrary compiled machine code in the game's own process»:
RLBoxcompiles untrusted libs to WASM and back (wasm2c): code physically cannot jump outside its region or touch foreign memory, overhead is single-digit percent. But that is a compiler-cooperation deal — the mod must be built to a constrained target. Applied here it is the old WASM path with a new name, and it reintroduces exactly the expressiveness ceiling the hook APIs outgrew (plus a mandatory batch/copy boundary on every hot loop). A different tier, not this proposal.seccomp+Landlock+ IPC/shared memory, cf. Google's Sandboxed API/Sandbox2). Real isolation with a tight per-library syscall policy — at microseconds per boundary crossing instead of nanoseconds. Fine for logic, fatal for the render/worldgen hot loops this proposal keeps at one indirect call.ERIM,<1%at 100k switches/s). The policy register is writable from userspace, so the sandbox must forbid itself from touching it — binary inspection plus syscall filtering (Hodor,Donky,Jenny), 16 domains max, per-core quirks. The one Rust-specific attempt (PKRU-Safe, patched rustc + LLVM passes) is a research prototype tied to a custom toolchain and CPUs with thepkuflag — not shippable to random player hardware.CHERI/Morello, ARMMTE/PAC,TME-Boxare further out still.HostAPI work while the hook catalog is still growing by dozens of points per weekend.So this proposal is honest about what it is:
cdylibplugins are full-trust native code, contained by signing, review, per-mod permission manifests andrevoked.toml— a trust model, not a sandbox. If the project ever wants untrusted-code execution, that is a separate, complementary tier (sandboxed logic mods through batch APIs), not a modification of this one.Maintenance
API evolves additively per domain, checked in CI by the catalog diff (
native-hooks.jsonat the repo root plustools/native-hook-fragments/, stamped bytools/stamp_native_hooks.py) +semver-checksonhorizon-abi. Launcher resolves(domain_versions, os, arch)fromindex.json.sdkis semver'd with the domain majors; old mods keep their bundledsdkand keep loading. Breaking changes bump that domain's major and old mods fail fast with "built for worldgen 1, client offers 2" instead of UB.Scope of work (from HEAD
fd57b86, 2026-11-02)Ground already laid by #5446/#5909/#6216, all in main:
crates/horizon-client/src/mod_api.rs(~23 KB hand-written) +mod_api/generated.rs(~444 KB) +mod_api/generated_host.rs(~54 KB), generated byxtask/src/mod_api.rs(~70 KB) fromnative-hooks.json(~63 KB catalog);game/native_hooks.rs(~422 KB) with one dispatch line per hook body;entry.rswithmain()+main_with(mods); launcher sidelauncher/src/native_mods.rs(~155 KB) +launcher/src/native_mods/{api,crates,dependencies,inject,inject_cache}.rs. What follows reuses all of it — nothing below redesigns hooks, only how mods attach:Hooks/Host/level-host traits, the four contracts, attachments and inter-mod dependency order from #6216 become thesdksurface;native-hook-fragments/+ stamping stays the intake for new slots.horizon-abi(small, the only versioned contract):repr(C)types per domain (lifecycle, worldgen, blocks/behavior, block-entity+machines, items, entities/mobs, guards/players, menus/screens, loot/recipes, render/HUD, net, data/content),API_VERSIONper domain, canonical-signature hashing. No game types leak in.xtask mod-api): from the samenative-hooks.json, additionally emit the C ABI table + stable symbol names with hashes (horizon_hook_<domain>_<name>__v<ver>__<hash>) + per-symbol contract encoding. Same--checkdiscipline as today.mod_apicontract and its ABI hash.dlopen/libloading,dlsymby hashed name, domain-version negotiation,retour-style detour or direct fn-pointer table, load order from declared dependencies, fail-fast errors (built for worldgen 1, client offers 2), per-mod state + re-entrancy rules. This is the only genuinely new unsafe code.horizon-sdkcrate: safe header-only wrapper overabi(#[inline(always)]newtypes, iterators, RAII guards),#[mixin]/#[worldgen_overlay]-style proc-macros, fakeApiTableforcargo testwithout the game.seed_remap/snow_offset/structure_box/level_height,ChunkView/DecorCtx+ host-owned sampler cache, registration ABI (blocks/items/entities with network IDs), capability vtables with batch ticking. Hardest part; each slot is one/claim-sized PR with in-game proof, same as the hook process.index.jsongains(domain_versions, os, arch), launcher downloads only the client's artifact;revoked.tomland signing already exist.zoomfirst (HEAD-only, ~6 hooks), thenrecipes(glue.rs→Fromoverrepr(C)), thensmpshims; trait-modmachine-samplerebuilt ascdylibwith the same proof table as #6216. Tier 2 source mixins stay as the incubator.Fit with #5638 / #6216 (typed mod API, now merged) and #4953 (what a large tech mod needs)
#5638 is closed and #6216 is merged into main: the generated
Hookstrait (listen/cancel/replace/collect),Hostand level hosts,entry::main_with, attachments, inter-mod dependencies and renderer hooks are now the baseline, not a preview branch. Thiscdylibproposal is step 2 on top of that merged work: take the same generated API ashorizon-sdk, stabilize it ashorizon-abi, and ship it as prebuilt binaries instead of relinking sources on player machines. Fast trait-mod rebuilds fix the dev loop; the stable ABI additionally fixes weak PCs, closed-source mods, and survival across client updates.It also tracks #4953, which now measures hook parity against NeoForge 26.3 events (plus a separate
Hooks without a NeoForge counterpartsection) with a much larger denominator than before, so its progress bar was reset by scope growth rather than regressions. Everything already at parity maps 1:1 onto hook slots. What still needs design beyond hooks — the remainder of #4953 — is a stable registration ABI (code-side blocks/items/entities with network IDs, attachments, data maps, custom ingredients) and stable capability vtables with batch ticking for fluids/energy/pipes/instanced moving parts, where a per-block-entity boundary would be too fine-grained — 6 subsystems instead of 200 per-site hooks.This keeps the current hook-point design (which is good — the hook-point catalog keeps growing, and community mods beyond the official set may already need different hooks) and only changes how mods attach to it: dylib + hash-checked slot instead of source merge + full rebuild, with Tier 2 source mixins kept for experiments that have no slot yet.
Recommended execution appendix (author's note: I most likely cannot carry this out myself, even with AI help — this is written for whoever picks it up)
Base pin. Start from a fresh
main(this proposal was measured againstfd57b86, 2026-11-02 — rebase first), then runcargo run -p xtask -- mod-api --checkandpython3 tools/pr_ready.py --quick. If either is red on stockmain, stop: the tree moved under you.First vertical slice (do this before anything else):
zoomend-to-end. Onecdylibexporting 6 hashed symbols (native_key,native_wheel,native_zoom,native_mods,native_settings,native_settings_click), one loader thatdlsyms them at startup, one launcher path that installs the.so/.dllinstead of rebuilding the game. Done means: (a) zoom works in-game from the binary with no game rebuild; (b) a client update that touches none of the 6 hooks leaves the samemod.soloading; (c) a client update that changes one hook's signature fails fast with the hook's name, not a crash; (d)cargo testin the mod crate passes against the fakeApiTable. Everything else in Scope items 1–8 is a repeat of this slice at larger scale.Defaults for the open forks (pick these unless measurement says otherwise). Fn-pointer table, not
retour-style detours (simpler auditing, same single-indirect-call cost). Signature hash = first 6 hex ofblake3over the canonical signature (name +repr(C)param/return types + ownership note). Arena allocation: host allocates, mod only reads, never stores pointers past the call.#[mixin]proc-macro output must be readable-expanded (cargo expand-clean) so reviewers never debug macro magic.Acceptance per item. Each Scope item lands as its own small PR with:
xtask mod-api --checkgreen,cargo test+pr_ready.pygreen on the touched crates, and a proof table in the PR body in the style of #6216 (what was run: server thread, dedicated server where applicable, before/after timings or load/no-load behavior). No proof, no merge.Guards. Hook-body semantics are never changed by this work — slots only expose them. Tier 2 source mixins keep building exactly as today. The four contracts (
listen/cancel/replace/collect) stay 1:1 with #6216; any deviation is a separate proposal. If a needed slot does not exist, file it vianative-hook-fragments/and build the Tier 2 mixin first — the working patch is the justification for the Tier 1 slot.I'll be honest: I can't afford a $200 subscription and therefore can't help this project in any substantial way. That doesn't change the fact that I genuinely care about its future, which is exactly why I'm writing this instead of staying silent. I would be glad to receive a response from a real human.
Thanks.
@BlueGradientHorizon commented on GitHub (Oct 31, 2026):
I asked my agent to dig through all open and closed issues in this repository (including the whole removal stack #3350 - #3351 - #3353 - #3371) looking for the reasoning behind closing the WASM path and it couldn't find any.
The only documented logic is "code mods are native now, so the duplicate runtime was deleted", plus the checklist that official mods had native versions. No benchmarks showing WASM was slow, no sandbox incident, no human discussion on the PRs at all.
I won't pretend to be a serious developer, but I'd still like to understand: what were WASM's practical problems? The sandbox? Performance? The cost of maintaining two APIs? Something else entirely? If the decision was just "native caught up, so we cut the duplicate" that's fine, but it would be good to hear it stated plainly by whoever owns the modding direction.
@bunchy7s commented on GitHub (Nov 1, 2026):
native-mods are NOT the way to go
@johalun commented on GitHub (Nov 1, 2026):
I agree. Don't do native mods. I'd like to see
@BlueGradientHorizon commented on GitHub (Nov 1, 2026):
I did a small brainstorming session with an AI agent, and here is what we came up with.
Proposal: stable-ABI native plugins (
cdylib) instead of source patches (.hnmod)Keep everything Rust-only and native-speed, but stop recompiling the game per mod.
How it would work
horizon-abi— a tiny versioned stable-ABI crate.#[repr(C)],extern "C", opaque handles, no generics/Vec<String>/dynon the boundary,API_VERSION: u32. This is the only contract a mod links against. Neverhorizon-clientinternals directly.horizon-sdk— a safe, idiomatic, header-only wrapper overabi. Compiled into the mod, so#[inline(always)]newtypes (EntityRef,Game,ServerCtx) optimize to the same asm as direct access. This is where canonical Rust lives: iterators,Result, lifetimes,#[mixin]proc-macros.cdylib(.so/.dll/.dylib), one artifact peros x arch(win/linux/mac x x86_64/aarch64). The registry keeps all binaries per version, the launcher downloads only the client's own. No source rebuild on player PCs — this fixes weak PCs and closed-source mods at once.[[injection]] target = Game::native_keybecomes a stable exported hook slot with a signature hash, e.g.horizon_hook_world_tick__v7__a3f9c1. The loader resolves it withdlsymat runtime and installs aretour-style detour only if the hash matches. No mod: one predictable branch (~0cost). With mod: one indirect call.O(1)per frame. The host hands the mod contiguous slices (on_chunk_tick(pos: *const f32, vel: *mut f32, n: usize)), the tight loop lives inside the mod where LLVM/LTO sees it. Private fields via runtime-queried offsets cached in astatic— oneaddin the hot loop. Oldmod.sobuilt againstsdk v7keeps working on a new client as long asAPI_VERSION=7symbols it uses are unchanged.What changes for a mod —
zoomexampleToday (
horizon-mixin.toml+ source patch):Proposed:
runtime.rs(settings,STATE, all#[test]) moves over 1:1 — it never touchedGameanyway.horizon-mixin.tomldisappears,compatibility.json: horizon_revisionbecomesapi_version = 7. Same pattern coverscoords-hud/fps-overlay/keystrokes/minimap(a handful ofHEADhooks each);recipesonly rewrites itsglue.rsintoFromimpls overrepr(C)slices;smpkeeps its pure-logic files untouched and rewrites onlyglue.rsplus one-function hook shims.Pros vs current
.hnmodmanifest permissions + sigstore/minisign, reproducible builds stay verifiable.horizon_revisionpin breaks on any commit.cargo add horizon-sdk,rust-analyzer,docs.rs,cargo testagainst a fakeApiTableinstead of rebuilding the whole game for checks.Remaining cons (honest)
revoked.tomlalready exists, plus sandboxing what can be sandboxed (fs/net reviewed via manifest, not technically enforced).unsafeboundary to maintain:#[repr(C)]layout asserts,catch_unwindon everyextern "C"entry,Send/Syncaudits, no panics/async/allocation across FFI.API_VERSIONand a compat shim.Maintenance
API evolves additively, checked in CI by
api.dump.jsondiff +semver-checksonhorizon-abi. Launcher resolves(api_version, os, arch)fromindex.json.sdkis semver'd with the API major; old mods keep their bundledsdkand keep loading. Breaking changes bump the major and old mods fail fast with "built for API 7, client offers 8" instead of UB.Fit with #5638 / #6216 (typed mod API) and #4953 (what a large tech mod needs)
This proposal only changes how mods attach to the hook points, not the points themselves. #5638 / #6216 is the natural step 1: the generated
Hookstrait (listen/cancel/replace/collect),Hostand level hosts,entry::main_with, attachments, inter-mod dependencies, renderer hooks — with measured trait-mod rebuilds in seconds instead of minutes. Thiscdylibproposal is step 2 on top of it: take that same generated API ashorizon-sdk, stabilize it ashorizon-abi, and ship it as prebuilt binaries instead of relinking sources on player machines. #5638 fixes the dev loop; the stable ABI additionally fixes weak PCs, closed-source mods, and survival across client updates. What still needs design beyond hooks — and matches theNot startedremainder of #4953 — is a stable registration ABI (code-side blocks/items/entities with network IDs, attachments, data maps, custom ingredients) and stable capability vtables with batch ticking for fluids/energy/pipes/instanced moving parts, where a per-block-entity boundary would be too fine-grained.This keeps the current hook-point design (which is good — the hook-point catalog keeps growing, and community mods beyond the official set may already need different hooks) and only changes how mods attach to it: dylib + hash-checked slot instead of source merge + full rebuild.
@johalun commented on GitHub (Nov 1, 2026):
Proper sandboxing sounds like a nightmare and I wouldn't run any compiled mods without it. Personally I'd go with Lua and disable all os and io libraries for sandboxing. I wrote a couple of mods for Minetest which uses Lua for modding and with a proper modding API and hook interface I think it can be really good. You can also do nice things like live edit and reload during mod development. For CPU intensive operations you provide native functions. There's also JIT to help with performance if the Lua code is doing a lot of computing.
[GH-ISSUE #5109] Reconsider the all-native modding direction: please keep a runtime mod-loading pathto [GH-ISSUE #5109] Proposal (sketch): runtime mod loading via stable-ABI native plugins — a vision for modding's future