Merge feat/launcher-horizon-tab (main merged) into feat/launcher-horizon-modpacks
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,6 +20,7 @@ To play, use [the launcher](../launcher/README.md); the project site is [playhor
|
||||
- [Resource packs](resource-packs.md): everything a 26.3 resource pack can change, whether Horizon honours it, and the proof.
|
||||
- [Opt-in data collection](telemetry.md): the consent, exactly what is sent, how it is stored and sent.
|
||||
- [Benchmark report format](benchmark-report.md): the versioned JSON every benchmark writes (game, launcher, `tools/perf_bench.py`), the local log and, with consent, the upload.
|
||||
- [Horizon APIs](api/README.md): every surface other programs build on (mods, shaders, agent control, servers, the launcher, data formats), each with its guide, generated reference, stability and changelog, and the [stability and versioning policy](api/stability.md).
|
||||
- Menus: every screen is vanilla's (title, world list, create world, multiplayer, options, pause). Horizon's own settings hang off vanilla's Options the way mods add theirs: **Horizon Settings...** and **Mods...** in the last two slots of the Options grid (Horizon Settings opens Graphics, Advanced Graphics, Controller Settings, Extras and Mods, each a vanilla options list), with Horizon Graphics and Advanced Graphics also at the top of Video Settings and Controller Settings at the bottom of Controls. The title screen's and pause menu's Friends buttons open Join a Friend and Play with Friends ([play-with-friends.md](play-with-friends.md)).
|
||||
|
||||
## Parity
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
# Horizon APIs
|
||||
|
||||
Horizon has six surfaces that other programs and people build on. Each one has an **API** (the contract: what you
|
||||
may call, read or write, and what Horizon promises about it) and an **SDK** (the tools that help you use it). This
|
||||
section has one page per surface, plus the rules every surface follows:
|
||||
[stability and versioning](stability.md).
|
||||
|
||||
| Surface | For | API today | Stability | Reference |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| [Mods](mods.md) | mod authors | WIT `horizon:mods@0.1.0`, manifest `api` 0.1 (code) and 0.2 (content) | preview | [mods-reference.md](mods-reference.md) (generated) |
|
||||
| [Shaders](shaders.md) | shader authors | none yet: packs were removed on 2026-10-24 | planned | none |
|
||||
| [Agent control](agent-control.md) | agents, scripts, tests | `horizon-ctl`, its MCP server, the game's control socket | preview | [horizon-ctl-commands.md](../horizon-ctl-commands.md) (generated) |
|
||||
| [Servers](server.md) | hosts, panels, bots | `horizon-server` commands, `server.toml`, control API `/api/v1` | stable | [server-reference.md](server-reference.md) (generated) |
|
||||
| [Launcher](launcher.md) | players' agents, pack makers | `horizon-launcher` commands and its MCP server | preview | [launcher-commands.md](../launcher-commands.md) (generated) |
|
||||
| [Data formats](data-formats.md) | tools that read Horizon's files | benchmark reports, telemetry, settings files, signed checksums | stable or preview, per format | on that page |
|
||||
|
||||
## How these APIs are designed
|
||||
|
||||
- **From the people who use them.** Each API starts from what a mod author, a pack author, a server host or an agent
|
||||
needs to do, written down as tasks ("a host backs up the world from a script"), and from how Horizon is built:
|
||||
Rust, wgpu, WebAssembly components and a server thread that runs every world. A function exists because a task
|
||||
needs it.
|
||||
- **Our own design.** Horizon's APIs are not modelled on any other project's. Contributors may know other mod
|
||||
loaders, renderers and server platforms exist, but their source and API references are never read, copied or
|
||||
paraphrased here, and our names, shapes and docs are not taken from theirs. Vanilla Minecraft 26.3 is the reference for game
|
||||
concepts: ids, commands, `server.properties`, data packs and resource packs.
|
||||
- **Safe by default.** Mods run in a sandbox and can only use the capabilities their manifest declares; the control
|
||||
sockets listen on this computer only, behind a token; nothing here is on by default where it would change vanilla's
|
||||
look or behaviour.
|
||||
- **Free when unused.** An API nobody uses costs nothing per tick or per frame: no engine, no thread, no allocation.
|
||||
- **One contract for every mode.** In-frame single player, the server thread, LAN and the dedicated server run the
|
||||
same gameplay code ([AGENTS.md](../../AGENTS.md)), so a server-side API serves all of them.
|
||||
|
||||
## References are generated
|
||||
|
||||
A reference page is written by code from the source it describes, and a test fails when the two differ:
|
||||
|
||||
| Page | Generated from | Update it with |
|
||||
| --- | --- | --- |
|
||||
| [mods-reference.md](mods-reference.md) | `crates/horizon-mod-sdk/wit/horizon.wit`, the manifest's capabilities | `HORIZON_WRITE_DOCS=1 cargo test -p horizon-mods --features pack --test api_reference` |
|
||||
| [server-reference.md](server-reference.md) | `horizon-server`'s help, `config::TEMPLATE`, `api::ROUTES` | `HORIZON_WRITE_DOCS=1 cargo test -p horizon-server reference` |
|
||||
| [horizon-ctl-commands.md](../horizon-ctl-commands.md) | the command table in `crates/horizon-client/src/bin/horizon-ctl/commands.rs` | `horizon-ctl help --markdown > docs/horizon-ctl-commands.md` |
|
||||
| [launcher-commands.md](../launcher-commands.md) | `launcher/src/cli.rs` | `HORIZON_WRITE_DOCS=1 cargo test --manifest-path launcher/Cargo.toml the_launcher_reference` |
|
||||
|
||||
So a pull request that changes an API also changes its reference, and the reviewer sees the API's diff in the
|
||||
reference's diff. The guides (overview, how-to, examples) are written by hand.
|
||||
|
||||
## Each surface's page
|
||||
|
||||
Every page has the same parts: **Overview** (what you can build), **Guide** (where to start), **Reference**,
|
||||
**Examples**, **Stability** (the level of each part, per [stability.md](stability.md)), **Changelog** and
|
||||
**Not there yet** (what is planned, so nobody builds on a guess).
|
||||
|
||||
The website's summary for players and authors is [playhorizon.dev/docs/apis](https://playhorizon.dev/docs/apis)
|
||||
(`website/docs/apis.md`).
|
||||
@@ -0,0 +1,55 @@
|
||||
# Agent control API
|
||||
|
||||
How a program drives a running game: an AI agent through MCP, a script through `horizon-ctl`, a test through the
|
||||
control socket. Design and inventory: [agent-control.md](../agent-control.md); for players:
|
||||
[playhorizon.dev/docs/agents](https://playhorizon.dev/docs/agents).
|
||||
|
||||
## Overview
|
||||
|
||||
The game listens on a local control socket (a Unix socket, or localhost TCP with a token on Windows), takes one
|
||||
command per text line and answers one JSON line. `horizon-ctl` wraps it: it starts the game, sends commands and
|
||||
serves the same commands as MCP tools. The launcher's MCP server offers them too, as `game_<tool>`.
|
||||
|
||||
| | Count |
|
||||
| --- | --- |
|
||||
| `horizon-ctl` commands | 96, in 8 groups (session, observe, move and look, act, screens and chat, multiplayer, world and cheats, scripting and benchmarks) |
|
||||
| MCP tools | 88 (8 commands are CLI only) |
|
||||
| Destructive commands (need `--confirm`) | 3 |
|
||||
| Command names the game's socket answers | about 160, test hooks included (`horizon-ctl help --game`) |
|
||||
|
||||
## Guide
|
||||
|
||||
1. Build `horizon-ctl` (`cargo build --profile fast -p horizon-client`), then
|
||||
`horizon-ctl --socket $PWD/ctl.sock launch --world W --creative --wait --resources <prepared files>`.
|
||||
2. `horizon-ctl --socket … state`, `keys`, `turn`, `command`, `screenshot`, `quit`.
|
||||
3. For an agent: `horizon-ctl mcp`, or the launcher's `horizon-launcher mcp` with `agent-config` to connect a client
|
||||
([launcher-commands.md](../launcher-commands.md)).
|
||||
|
||||
## Reference
|
||||
|
||||
[horizon-ctl-commands.md](../horizon-ctl-commands.md), generated from the command table in
|
||||
`crates/horizon-client/src/bin/horizon-ctl/commands.rs`: every command, its MCP tool and its arguments.
|
||||
|
||||
## Examples
|
||||
|
||||
- `tools/agent_control_e2e.py`: starts a game and drives it end to end through `horizon-ctl` and MCP.
|
||||
- `tools/lan_e2e.py`: two games over LAN, both driven through their sockets.
|
||||
|
||||
## Stability
|
||||
|
||||
Preview ([stability.md](stability.md)). The commands in `horizon-ctl`'s table and their MCP tool names are what the
|
||||
API offers; the other commands the game's socket answers are test hooks and experimental.
|
||||
|
||||
## Not there yet
|
||||
|
||||
- **A version.** A `hello` command that answers the protocol version, the game's release and the features it has;
|
||||
MCP `serverInfo` carries the same version; `horizon-ctl` refuses a game whose major it doesn't speak.
|
||||
- **Reply schemas.** Each command's reply described in the table (fields, types, units), so the reference documents
|
||||
replies as well as arguments and MCP tools declare an output schema.
|
||||
- **Events as a stream.** `events --since` polls today; a subscription that pushes events as they happen.
|
||||
- **Test hooks apart.** The hooks only harnesses use move under their own prefix, out of the agent's tool list.
|
||||
- **Compatibility tests.** A transcript per protocol version: commands and the reply keys each must keep.
|
||||
|
||||
## Changelog
|
||||
|
||||
- Unversioned so far: the command table and the generated reference are the contract.
|
||||
@@ -0,0 +1,40 @@
|
||||
# Data formats
|
||||
|
||||
The files Horizon writes that other tools may read: benchmark reports, telemetry, settings, mods, release checksums
|
||||
and worlds. Each entry names its version field, its documentation and its level ([stability.md](stability.md)).
|
||||
|
||||
## Overview
|
||||
|
||||
| Format | Where | Version | Level | Documented in |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| Benchmark report | the benchmark's output, the local log, uploads | `"format": "horizon-benchmark-report"`, `"version": 1` | stable | [benchmark-report.md](../benchmark-report.md) |
|
||||
| Telemetry batch | `POST /v1/batch` from the launcher | `"schema": 1` | stable | [telemetry.md](../telemetry.md) |
|
||||
| Telemetry consent | `telemetry/consent.json` in the game folder | `"version": 2` | stable | [telemetry.md](../telemetry.md) |
|
||||
| Mod package | `.hmod`: a zip with `horizon-mod.toml`, `mod.wasm`, `assets/`, `data/` | the manifest's `api` | preview | [mods.md](../mods.md#the-manifest), [mods-reference.md](mods-reference.md) |
|
||||
| Mods turned on | `horizon-mods.txt` | none | preview | [mods.md](../mods.md#playing-with-mods) |
|
||||
| Horizon settings | `horizon-graphics.txt`, `horizon-extras.txt` (`key:value`, as `options.txt`) | none: unknown keys fall back to defaults | preview | [graphics.md](../graphics.md), [extras.md](../extras.md#options-storage) |
|
||||
| Server settings | `server.toml` | its keys | stable | [server-reference.md](server-reference.md) |
|
||||
| Control endpoints | the game's socket file (TCP form), `.horizon/api.json` | none | preview | [agent-control.md](agent-control.md), [server-reference.md](server-reference.md) |
|
||||
| Release checksums | `SHA256SUMS`, `SHA256SUMS.sig` on releases since signing began (#1011) | the signed text names the tag | stable | [security.md](../security.md) |
|
||||
| Worlds | the world folder | vanilla 26.3's (`DataVersion`) | vanilla's | [world-data.md](../world-data.md) |
|
||||
|
||||
Worlds are vanilla's format, so any tool that reads a 26.3 world reads a Horizon world; Horizon adds itself to
|
||||
`level.dat`'s `ServerBrands` as vanilla's server does.
|
||||
|
||||
## Rules for every format
|
||||
|
||||
- A reader ignores fields it doesn't know, and refuses a version newer than it knows with a clear message.
|
||||
- An optional field may be added in the same version; renaming, removing or changing the meaning of a field makes the
|
||||
next version, and Horizon's own readers keep reading the older ones for the deprecation window.
|
||||
- Each versioned format has a sample file of every version its reader accepts, read by a test.
|
||||
|
||||
## Not there yet
|
||||
|
||||
- Versions for the settings files and the control endpoint files (a `version` line or field).
|
||||
- Sample files and reader tests for every versioned format.
|
||||
- A generated schema for the benchmark report and the telemetry batch from their Rust types, checked by a test like
|
||||
the references.
|
||||
|
||||
## Changelog
|
||||
|
||||
- Benchmark report version 1; telemetry schema 1, consent version 2.
|
||||
@@ -0,0 +1,57 @@
|
||||
# Launcher API
|
||||
|
||||
What a player's agent, a script or a pack maker can do with `horizon-launcher`: install and run versions, manage
|
||||
accounts, settings, mods, modpacks and hosted servers, from a terminal or over MCP. The launcher itself:
|
||||
[launcher/README.md](../../launcher/README.md).
|
||||
|
||||
## Overview
|
||||
|
||||
Every page of the launcher has a command, and every command but three has an MCP tool with the same arguments; a tool
|
||||
runs the command with `--json`. Tools that change the player's things for good need `confirm: true`; with No AI on,
|
||||
the MCP server is off.
|
||||
|
||||
| | Count |
|
||||
| --- | --- |
|
||||
| Commands | 46: versions, installs, play, the server, notes, links, accounts, settings, logs, updates, data collection, modpacks, mods, hosted servers, MCP, benchmark |
|
||||
| MCP tools | 43, plus the game's tools as `game_<tool>` ([agent-control.md](agent-control.md)) |
|
||||
| Modpack formats it imports | 3: a Modrinth `.mrpack`, a CurseForge zip, an instance folder |
|
||||
|
||||
## Guide
|
||||
|
||||
1. `horizon-launcher versions`, `horizon-launcher install latest`, `horizon-launcher play`.
|
||||
2. Modpacks: `horizon-launcher modpack import <file>`, then `modpack port` and `modpack play`
|
||||
([modpacks.md](../modpacks.md)).
|
||||
3. For an agent: `horizon-launcher agent-config` prints how to connect a client to `horizon-launcher mcp`.
|
||||
|
||||
## Reference
|
||||
|
||||
[launcher-commands.md](../launcher-commands.md), generated from `launcher/src/cli.rs`: every command, its arguments
|
||||
and its MCP tool.
|
||||
|
||||
## Examples
|
||||
|
||||
```sh
|
||||
horizon-launcher versions --installed --json
|
||||
horizon-launcher mods search minimap --kind mod --json
|
||||
horizon-launcher servers create --name "Weekend" --player Alex --json
|
||||
```
|
||||
|
||||
## Stability
|
||||
|
||||
Preview ([stability.md](stability.md)): command names, arguments and MCP tool names are the contract; `--json`
|
||||
output shapes are not yet described in the reference.
|
||||
|
||||
## Not there yet
|
||||
|
||||
- **A Horizon modpack manifest.** A pack made for Horizon (not a port of a Java pack) needs its own file: the pack's
|
||||
id, name and version; the Horizon API lines and the release line it needs; its `.hmod` mods (id, version, SHA-256,
|
||||
where to download it, client, server or both); resource packs; default settings; and whether it has a server side.
|
||||
One manifest serves the launcher, `horizon-server` (a server installs the server side of the same pack) and the mod
|
||||
browser. Designed from what a pack maker does, versioned per [stability.md](stability.md), with a schema test.
|
||||
- **JSON output schemas** for every command, in the generated reference, so MCP tools declare their output.
|
||||
- **A version** in MCP `serverInfo` and `--json` output, as for agent control.
|
||||
- **Compatibility tests**: golden `--json` output per command.
|
||||
|
||||
## Changelog
|
||||
|
||||
- Unversioned so far: the command table and the generated reference are the contract.
|
||||
@@ -90,6 +90,61 @@ Unknown keys are refused. `overrides/` may hold only `options.txt`, `horizon-gra
|
||||
capability `storage`), each at most 64 MiB and 256 MiB in all; anything else refuses the pack. The launcher copies
|
||||
them into the profile's game folder.
|
||||
|
||||
## The registry repository
|
||||
|
||||
[ludovic111/horizon-mods](https://github.com/ludovic111/horizon-mods) holds one `mods/<id>.toml` per project, written by
|
||||
the submission form or by hand, and `revoked.toml`. What an entry can't vouch for is read from its file by the kind's
|
||||
own check (`index::inspect`): a mod's API, side and capabilities, a modpack's mods, the size. Types and rules:
|
||||
`horizon_mods::index::registry`.
|
||||
|
||||
```toml
|
||||
id = "coords_hud" # the file's name, and the manifest's id
|
||||
kind = "mod" # mod | modpack | resourcepack; shader once its format exists
|
||||
name = "Coordinates HUD"
|
||||
summary = "One line, at most 160 characters."
|
||||
description = """Markdown.""" # optional
|
||||
authors = ["Horizon"]
|
||||
owners = ["ludovic111"] # GitHub logins who may publish updates
|
||||
license = "MIT"
|
||||
source = "https://github.com/..."
|
||||
icon = "icons/coords_hud.png" # optional: a PNG of at most 256 KiB in the repository, or https://
|
||||
key = "RWT..." # optional: the minisign public key every version is signed with
|
||||
|
||||
[[versions]] # newest first
|
||||
version = "0.1.0" # letters, digits, '.', '-', '_': the release tag is <id>-<version>
|
||||
published = "2026-10-24"
|
||||
game = "26.3"
|
||||
file = "coords_hud-0.1.0.hmod" # the name players download
|
||||
sha256 = "e113..." # pins the reviewed file
|
||||
signature = """untrusted comment: ...""" # when the project has a key
|
||||
changelog = "" # optional
|
||||
```
|
||||
|
||||
```toml
|
||||
# revoked.toml
|
||||
[[revoked]]
|
||||
id = "bad_mod"
|
||||
sha256 = "1111..." # optional: without it, every version
|
||||
reason = "Sent chat messages it didn't declare."
|
||||
date = "2026-10-24"
|
||||
```
|
||||
|
||||
The submission form's service (`crates/horizon-mod-registry`) writes these entries: it signs the creator in with GitHub, runs the file's checks, uploads the file to the repository's `staging` release as `<sha256>.<extension>` and opens the pull request. Only an entry's `owners` publish updates through it.
|
||||
|
||||
Unknown keys are refused. Its CI runs `cargo-horizon-mod` (`crates/cargo-horizon-mod`):
|
||||
|
||||
| Command | What it does |
|
||||
| --- | --- |
|
||||
| `cargo horizon-mod check <file> [--json]` | A submission's checks: its kind's (above), its signature with `--key` and `--signature`, and for a mod a trial run in the sandbox (40 ticks, 120 frames, a chat line, each command). |
|
||||
| `cargo horizon-mod registry check <base> <head> --files <dir>` | `check` on each file `head` lists and `base` doesn't: a pull request's new files. |
|
||||
| `cargo horizon-mod registry list <checkout>` | `<sha256> <id> <version> <file>` per version: the files to download. |
|
||||
| `cargo horizon-mod registry build <checkout> --files <dir> --out index.json` | Reads every entry and its file (`<dir>/<sha256>`), lists every problem, and writes the index with URLs `<release>/<id>-<version>/<file>`. |
|
||||
| `cargo horizon-mod registry review <base> <head> --author <login>` | A pull request's changes: a published file never changes and is never removed (take it down in `revoked.toml`), a kind never changes; changes by a non-owner and to owners or keys are pointed out for the reviewers. |
|
||||
|
||||
Kinds open to submissions: `mod`, `modpack`, `resourcepack`. `shader` is in the schema and stays closed until
|
||||
Horizon's own shader pack format exists (Iris and OptiFine packs are for the Modrinth browser); its check will compile
|
||||
the pack in a headless Horizon. A new kind gets its own check before it opens.
|
||||
|
||||
## Changelog
|
||||
|
||||
- Schema 1 (2026-10-24): kinds `mod`, `modpack`, `resourcepack`, `shader`; `.hpack` format 1.
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
# Mod API
|
||||
|
||||
Mods are Rust crates compiled to sandboxed WebAssembly components. They run in the player's game and, once server
|
||||
mods land, wherever a world is simulated. Design and the runtime: [mods.md](../mods.md).
|
||||
|
||||
## Overview
|
||||
|
||||
A mod today can read the local player and the world clock, show chat lines only that player sees, draw a text panel
|
||||
on the HUD, keep small files of its own, register chat commands, and run on every tick, frame or chat line it asks
|
||||
for. A content mod adds blocks and items from JSON in its `.hmod`, copying vanilla templates, plus tags, recipes,
|
||||
loot, models, textures and structures in its own namespaces. Every capability is declared in the manifest, shown to
|
||||
the player before the mod is turned on, and checked against the component's real imports.
|
||||
|
||||
| | Count |
|
||||
| --- | --- |
|
||||
| Interfaces the game offers | 5: `log`, `game`, `chat`, `hud`, `storage` |
|
||||
| Functions in them | 9 |
|
||||
| Hooks a mod exports | 5: `init`, `tick`, `frame`, `command`, `chat` |
|
||||
| Capabilities | 5: `game-read`, `chat`, `hud`, `storage`, `registries` |
|
||||
| Manifest `api` lines served | 2: `0.1` (code), `0.2` (content) |
|
||||
| SDK | the `Mod` trait (5 methods), `Registration` (4 builders), `export_mod!`, log helpers |
|
||||
| `cargo horizon-mod` | `new`, `build`, `run` |
|
||||
| Example mods | `coords-hud` (code), `ruby-content` (content) |
|
||||
|
||||
## Guide
|
||||
|
||||
1. `rustup target add wasm32-unknown-unknown`, `cargo install --git https://github.com/ludovic111/horizon
|
||||
cargo-horizon-mod`, then `cargo horizon-mod new my-mod` ([Making a mod](../mods.md#making-a-mod)).
|
||||
2. Implement `Mod` for your type, list the capabilities you import in `horizon-mod.toml`
|
||||
([The manifest](../mods.md#the-manifest)).
|
||||
3. `cargo horizon-mod run` builds the `.hmod` and starts the game with it as a dev mod; after an edit,
|
||||
`cargo horizon-mod build` and the running game reloads it.
|
||||
4. Content mods: [Content mods (API 0.2)](../mods.md#content-mods-api-02).
|
||||
|
||||
## Reference
|
||||
|
||||
[mods-reference.md](mods-reference.md), generated from `crates/horizon-mod-sdk/wit/horizon.wit`: every capability,
|
||||
interface, type, function and hook, with the limits the guide lists (16 HUD lines of 256 characters, 8 chat lines per
|
||||
call, 4 MiB of storage, fuel per call).
|
||||
|
||||
## Examples
|
||||
|
||||
- `crates/horizon-mod-sdk/examples/coords-hud`: coordinates, facing and time on the HUD; `/where`, `/coords`; storage.
|
||||
- `crates/horizon-mod-sdk/examples/ruby-content`: no code; a gem and a block of ruby from vanilla templates, with
|
||||
their recipes, loot, tags, models, textures and names.
|
||||
- `crates/horizon-mods/tests/guest`: a mod that misbehaves on command (spins, panics, grows its memory), for the
|
||||
sandbox tests.
|
||||
|
||||
## Ways in
|
||||
|
||||
One API (the WIT world) and one sandbox (WebAssembly), whatever the mod is written in. Every way in produces a
|
||||
component for the same world, checked against the same capabilities and given the same limits; there is no second
|
||||
scripting runtime in the game.
|
||||
|
||||
| Way in | For | Status | Template and example |
|
||||
| --- | --- | --- | --- |
|
||||
| Rust | most mods; the fastest | first-class: the SDK, `cargo horizon-mod` | `cargo horizon-mod new`, `coords-hud` |
|
||||
| Lua scripts | people who don't want a compiler | planned: a script mod whose code is a `.lua` file, run by Horizon's own interpreter mod | planned, with the same example as Rust |
|
||||
| C, C++, Zig | authors of those languages | to evaluate: bindings generated from the WIT, built without WASI | one each if it passes |
|
||||
| Go (TinyGo), AssemblyScript, JavaScript / TypeScript | authors of those languages | to evaluate: each needs its toolchain to emit a component without WASI imports, or an interpreter mod as for Lua | one each if it passes |
|
||||
|
||||
- **Scripts run inside the sandbox.** The Lua interpreter is itself a WebAssembly mod, built in Rust with the SDK and
|
||||
shipped by Horizon. A script mod's manifest names the interpreter and its own capabilities; the game links the
|
||||
interpreter with only those, so a script can do exactly what a compiled mod with the same manifest can.
|
||||
- **Hot reload.** The game keeps the interpreter compiled and loads the script into a fresh instance when the file
|
||||
changes, without restarting the game; what it saved with `storage` survives, as for dev mods.
|
||||
- **Measured, not guessed.** Each way in is listed with its measured cost on the same tick-heavy example (time and
|
||||
fuel per tick, memory, load time) against Rust, and a language is supported only with a template, an example and a
|
||||
test that builds and loads it in CI.
|
||||
|
||||
## Stability
|
||||
|
||||
Preview ([stability.md](stability.md)): API 0.1 and content 0.2 are served together; a mod built for 0.1.0 keeps
|
||||
loading on every 0.1.x game. Server mods come as their own line, `api = "0.3"`, experimental first.
|
||||
|
||||
## Not there yet
|
||||
|
||||
What real mods need next, in the order modpacks and servers need it:
|
||||
|
||||
- **Server mods** (`api = "0.3"`): the same component running on the server thread and the dedicated server, with world events (block
|
||||
broken or placed, entity spawned or killed, player joined or left), game rules and server commands with typed
|
||||
arguments.
|
||||
- **World and blocks**: read blocks, block states and biomes in loaded chunks; change them through the server's block
|
||||
log, so clients and the parity harnesses see vanilla's updates.
|
||||
- **Items and inventories**: the player's inventory, held item and open container; item stacks with components.
|
||||
- **Entities**: query and change entities near a position; spawn from a mod's own entity types (data first).
|
||||
- **Block entities and menus**: ticking machines with slots and their screens.
|
||||
- **Screens and UI**: widgets built from vanilla's, a screen the mod owns, a settings page under Options > Mods.
|
||||
- **Networking**: a channel between a mod's two halves, client and server, typed by the mod's own WIT.
|
||||
- **Config**: typed settings the game shows and stores for the mod, on the server too.
|
||||
- **Keys and the crosshair target**: keybinds in Controls; what the player is looking at.
|
||||
- **Script mods and other languages**: see [Ways in](#ways-in).
|
||||
- **SDK**: a headless test runner (load a mod, feed it ticks and events, assert on its output, no window), templates
|
||||
per kind of mod, typed wrappers in the SDK for every interface. Dev mods already reload when rebuilt.
|
||||
|
||||
## Changelog
|
||||
|
||||
- API 0.2 (content): data-driven blocks and items, tags, `horizon:add_to`, terrain adaptation.
|
||||
- API 0.1.0: `log`, `game`, `chat`, `hud`, `storage`; `init`, `tick`, `frame`, `command`, `chat`.
|
||||
@@ -0,0 +1,137 @@
|
||||
<!-- Generated from crates/horizon-server/src (the help text, config::TEMPLATE, api::ROUTES) by reference.rs; a test fails when this file is out of date. Update it with: HORIZON_WRITE_DOCS=1 cargo test -p horizon-server reference -->
|
||||
# Server reference
|
||||
|
||||
Everything `horizon-server` offers a host or a tool: its commands, every `server.toml` key and the control API. How to host: [hosting.md](../hosting.md); the design: [server.md](../server.md); stability and versions: [stability.md](stability.md).
|
||||
|
||||
## Commands
|
||||
|
||||
`horizon-server help` prints:
|
||||
|
||||
```text
|
||||
horizon-server: host a Horizon (Minecraft Java Edition 26.3) server
|
||||
|
||||
Usage: horizon-server [--dir DIR] <command>
|
||||
|
||||
init Set up a server here: the EULA, the world, the port, who may join (asks, or takes flags:
|
||||
--eula --world NAME --seed SEED --port N --whitelist/--no-whitelist --player NAME... --op NAME
|
||||
--offline --yes)
|
||||
run Run the server in the foreground; type console commands, Ctrl-C stops it cleanly. It
|
||||
restarts the game if it crashes.
|
||||
start Run the server in the background (its output goes to logs/supervisor.log)
|
||||
stop, restart
|
||||
status [--json]
|
||||
Up or not, TPS, MSPT, players, RAM and CPU
|
||||
cmd COMMAND...
|
||||
Run a console command on the running server and print what it answers
|
||||
logs [-f] [-n N]
|
||||
The last N lines of the log (default 50); -f follows it
|
||||
backup [NAME]
|
||||
Zip the world and the settings into backups/ (a running server saves first and stays up)
|
||||
backups [--json]
|
||||
List the backups
|
||||
restore BACKUP [--yes]
|
||||
Put a backup's world in place (the current one is kept in backups/); a running
|
||||
server restarts with it
|
||||
service install|uninstall|print [--system]
|
||||
Start the server at boot or login: a systemd unit on Linux (--system: for every user,
|
||||
with sudo), a launchd agent on macOS, a task at logon on Windows
|
||||
panel A one-time login link for the web panel ([panel] in server.toml; 127.0.0.1:8130 by
|
||||
default)
|
||||
update [--check [--json]] [--version TAG] [--timeout SECONDS]
|
||||
Install the newest release (checked against GitHub's SHA-256), back up the world and
|
||||
restart on it; goes back by itself if the game isn't up within the timeout (300 s).
|
||||
--archive FILE --version NAME installs an archive you have
|
||||
rollback Back to the release used before the update
|
||||
config [--json]
|
||||
The settings in server.toml
|
||||
config set KEY=VALUE... [--json]
|
||||
Change settings (for example world.difficulty=hard server.max_players=10), checked first;
|
||||
a running server takes the difficulty, default game mode and whitelist at once, the rest
|
||||
at its next start
|
||||
import FILE Write server.toml from a vanilla server.properties
|
||||
op NAME, deop NAME
|
||||
whitelist on|off|list, whitelist add|remove NAME
|
||||
Who may join (on the running server, or in the files when it is stopped)
|
||||
|
||||
--dir DIR The server folder (default: the current folder)
|
||||
|
||||
Settings live in server.toml; the server writes server.properties from it before every start.
|
||||
```
|
||||
|
||||
## `server.toml`
|
||||
|
||||
Horizon server settings (docs/server.md). The server writes them into server.properties before every start: edit this file, not that one. Unknown keys are refused. `horizon-server init` writes this file with these defaults; `horizon-server config set SECTION.KEY=VALUE` changes it.
|
||||
|
||||
### `[server]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `motd` | `"A Minecraft Server"` | `motd` | the line under the server's name in the server list |
|
||||
| `port` | `25565` | `server-port` | the port players connect to |
|
||||
| `bind` | `""` | `server-ip` | listen on every address, or only on this one (server-ip) |
|
||||
| `max_players` | `20` | `max-players` | how many players can be online at once |
|
||||
| `online_mode` | `true` | `online-mode` | check players' Minecraft accounts (false: anyone joins under any name) |
|
||||
| `whitelist` | `true` | `white-list` | only whitelisted players and operators can join |
|
||||
| `enforce_whitelist` | `false` | `enforce-whitelist` | kick online players taken off the whitelist |
|
||||
| `view_distance` | `10` | `view-distance` | chunks sent around each player |
|
||||
| `simulation_distance` | `10` | `simulation-distance` | chunks around each player where mobs, crops and redstone tick |
|
||||
|
||||
### `[world]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `name` | `"world"` | `level-name` | the world folder |
|
||||
| `seed` | `""` | `level-seed` | empty: a random seed on the first start |
|
||||
| `game_mode` | `"survival"` | `gamemode` | survival, creative, adventure or spectator |
|
||||
| `difficulty` | `"easy"` | `difficulty` | peaceful, easy, normal or hard |
|
||||
| `hardcore` | `false` | `hardcore` | one life: a player who dies becomes a spectator |
|
||||
|
||||
### `[properties]`
|
||||
|
||||
Any other server.properties key, spelled as vanilla spells it, for example: spawn-protection = 16
|
||||
|
||||
### `[engine]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `path` | `""` | | the game program; empty: the one installed beside horizon-server |
|
||||
| `resources` | `""` | | the prepared game files; empty: resources/ here, else the usual places |
|
||||
| `restart_on_crash` | `true` | | start the game again when it crashes |
|
||||
|
||||
### `[backups]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `every` | `"6h"` | | automatic backups while the server runs: 30m, 6h, 1d...; "0" turns them off |
|
||||
| `keep` | `12` | | automatic backups kept (backups made by hand are never deleted) |
|
||||
|
||||
### `[updates]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `keep` | `1` | | other releases kept by updates, besides the one in use and the one rollback goes to |
|
||||
|
||||
### `[panel]`
|
||||
|
||||
| Key | Default | In `server.properties` | What it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `bind` | `"127.0.0.1:8130"` | | the web panel: this computer only, or a tailnet address (100.x); "" turns it off |
|
||||
| `allow_public` | `false` | | true lets bind be any address; never put the panel on the open internet |
|
||||
|
||||
## Control API (`/api/v1`)
|
||||
|
||||
HTTP and JSON on 127.0.0.1. A running server writes its address and a random token to `.horizon/api.json`, readable only by its own user; every request sends `Authorization: Bearer <token>` and a `Host` that is that address. Errors answer `{"error": "..."}` with 400, 401, 403, 404, 405 or 409. The web panel uses the same routes with its session.
|
||||
|
||||
| Method | Path | Takes | Answers | What it does |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| `GET` | `/api/v1/status` | nothing | `phase`, `version`, `pid`, `uptime_seconds`, `engine_pid`, `engine_uptime_seconds`, `crashes`, `last_crash`, `sample` (TPS, MSPT, players, RAM, CPU), `update` | How the server does |
|
||||
| `GET` | `/api/v1/metrics` | `?since=T` (seconds since 1970) | `{"samples": [...]}`: one a second, the last 10 minutes | The samples taken after T, for graphs |
|
||||
| `GET` | `/api/v1/logs` | `?since=N` | `{"next": N, "lines": [...]}` | The log lines after the Nth (the last 2000 are kept) |
|
||||
| `POST` | `/api/v1/command` | `{"line": "<one command>"}` | the lines the command logged | Run a console command on the running game |
|
||||
| `POST` | `/api/v1/stop` | nothing | `{"ok": true}` | Stop the game and the supervisor |
|
||||
| `POST` | `/api/v1/restart` | nothing | `{"ok": true}` | Restart the game |
|
||||
| `GET` | `/api/v1/backups` | nothing | `{"backups": [{"name", "bytes"}]}` | List the backups |
|
||||
| `POST` | `/api/v1/backups` | `{"name": "..."}` (optional) | `{"name": "<file>"}` | Back up now (a running game saves first and stays up) |
|
||||
| `POST` | `/api/v1/restore` | `{"name": "<backup>"}` | `{"name": "<backup>"}` | Restart the game with that backup's world (the current one is kept in backups/) |
|
||||
| `POST` | `/api/v1/update` | `{"tag": "...", "timeout": seconds}` (both optional) | `{"ok": true}`; `status` says how it went (`update`) | Restart on that installed release, or download the newest first; goes back if the game isn't up within the timeout |
|
||||
| `POST` | `/api/v1/panel/login` | nothing | `{"url": "..."}` | A one-time login link for the web panel (with the token only, not from the panel) |
|
||||
@@ -0,0 +1,60 @@
|
||||
# Server API
|
||||
|
||||
What a host, a panel or a bot can do with a Horizon server: the `horizon-server` commands, `server.toml` and the
|
||||
control API. How to host: [hosting.md](../hosting.md); the design: [server.md](../server.md).
|
||||
|
||||
## Overview
|
||||
|
||||
`horizon-server` sets up a server folder, runs the game as a dedicated server under a supervisor (restarts on a crash,
|
||||
backups on a schedule, updates with a rollback), and lets other programs manage it through a local HTTP API with a
|
||||
token. The web panel uses that API.
|
||||
|
||||
| | Count |
|
||||
| --- | --- |
|
||||
| Commands | 22 (`init`, `run`, `start`, `stop`, `restart`, `status`, `cmd`, `logs`, `backup`, `backups`, `restore`, `service`, `panel`, `update`, `rollback`, `config`, `config set`, `import`, `op`, `deop`, `whitelist`, `version`) |
|
||||
| `server.toml` keys | 22 in 6 sections, plus `[properties]` for any other vanilla key |
|
||||
| Control API endpoints | 11 under `/api/v1` |
|
||||
|
||||
## Guide
|
||||
|
||||
1. `horizon-server init` in an empty folder, then `horizon-server start` ([hosting.md](../hosting.md)).
|
||||
2. From a script: `horizon-server status --json`, `horizon-server cmd say hi`, `horizon-server backup`.
|
||||
3. From a program: read `.horizon/api.json` (address and token), then `GET /api/v1/status` with
|
||||
`Authorization: Bearer <token>`.
|
||||
|
||||
## Reference
|
||||
|
||||
[server-reference.md](server-reference.md), generated from `horizon-server`'s source: the help text, every
|
||||
`server.toml` key with its default and the `server.properties` key it writes, and every endpoint.
|
||||
|
||||
## Examples
|
||||
|
||||
```sh
|
||||
token=$(jq -r .token .horizon/api.json); address=$(jq -r .address .horizon/api.json)
|
||||
curl -s -H "Authorization: Bearer $token" "http://$address/api/v1/status"
|
||||
curl -s -H "Authorization: Bearer $token" -d '{"line": "list"}' "http://$address/api/v1/command"
|
||||
```
|
||||
|
||||
## Stability
|
||||
|
||||
Stable ([stability.md](stability.md)): the commands, `server.toml`'s keys and `/api/v1`. A new key or endpoint is an
|
||||
addition; a change to one starts `/api/v2`, served beside `/api/v1`.
|
||||
|
||||
## Not there yet
|
||||
|
||||
- **Players**: list with ping and position, kick, ban and pardon, op and deop, the whitelist, as endpoints (today only
|
||||
through `cmd` and the files).
|
||||
- **Console stream**: the log as a stream (server-sent events) rather than `logs?since=N` polling; chat, joins, leaves,
|
||||
deaths and crashes as typed events.
|
||||
- **Metrics**: a plain-text metrics endpoint any monitoring tool can scrape (TPS, MSPT percentiles, players, chunks,
|
||||
entities, RAM, CPU), from the samples `status` already takes.
|
||||
- **Backups**: delete and download one; restore a single dimension.
|
||||
- **Server mods**: list, turn on and off, and their settings, once the mod API runs on the server
|
||||
([mods.md](mods.md)).
|
||||
- **An MCP server** for the same endpoints, so a host's agent manages the server as it manages the game.
|
||||
- **Compatibility tests**: golden replies per endpoint, and a `server.toml` from each release line.
|
||||
|
||||
## Changelog
|
||||
|
||||
- `api::ROUTES` lists the endpoints; the reference is generated from it.
|
||||
- `/api/v1`: status, metrics, logs, command, stop, restart, backups, restore, update, panel login.
|
||||
@@ -0,0 +1,54 @@
|
||||
# Shader API
|
||||
|
||||
Horizon has no shader packs today: the earlier implementation was removed on 2026-10-24. Two things will replace it,
|
||||
designed separately: a **Horizon shader API**, described here, and a clean-room loader for the existing pack format
|
||||
(its own spec; it is not part of this API). Both sit on the same renderer hooks, agreed between the two.
|
||||
|
||||
## Overview: what a shader author will be able to do
|
||||
|
||||
Write WGSL against documented stages of Horizon's renderer, with typed inputs, options the player can change, a
|
||||
reload as soon as a file is saved and an overlay that shows what each pass costs and draws. The renderer keeps
|
||||
everything that makes it fast (culling, batching, LOD, the mesher); a pack changes how surfaces and light look, not
|
||||
how the world is fed to the GPU.
|
||||
|
||||
## The design
|
||||
|
||||
- **A pack** is a folder or a zip with `horizon-shaders.toml` (id, name, version, the `api` line, the stages it
|
||||
uses, its options) and WGSL files. No preprocessor and no other shading language: WGSL is what wgpu validates and
|
||||
compiles for Vulkan, Metal and DirectX 12.
|
||||
- **Stages, not pipelines.** A stage is a function with a fixed signature that the renderer calls inside its own pass,
|
||||
for example a terrain material (`fn material(input: TerrainInput) -> Surface`), the lighting of the visible
|
||||
surfaces, the sky, an optional shadow pass, and a chain of full-screen post passes ending in the frame. A pack
|
||||
that leaves a stage out gets vanilla's look for it.
|
||||
- **Typed inputs.** Each stage receives structs (the frame: time, camera, sun and moon, weather, fog; the surface:
|
||||
position, normal, block and its light) whose WGSL is generated from the Rust types the renderer uploads. The
|
||||
generated reference lists every field with its unit and range, and a test fails when it drifts.
|
||||
- **Options are WGSL `override` constants.** The manifest declares each option (on/off, a number in a range, a choice)
|
||||
with its default; the game shows them on the pack's settings screen and sets them when it builds the pipeline. No
|
||||
text substitution, and every option combination is validated the same way.
|
||||
- **Hot reload.** The game watches the pack's folder. A saved file is validated with naga and the stage rebuilt; on an
|
||||
error the last good version keeps drawing and the error, with its file and line, is shown in the overlay.
|
||||
- **Debug overlay.** GPU time per stage and pass (timestamp queries), the targets each pass writes (show any of them
|
||||
full-screen), the pack's options and its compile errors.
|
||||
- **Budgets.** A pack declares the targets and passes it needs; the renderer refuses more than its limits, and the
|
||||
benchmark ([benchmark-report.md](../benchmark-report.md)) records the pack and its cost, so "fast" stays measured.
|
||||
- **Off by default.** Without a pack the renderer is vanilla's look, and no pack code runs.
|
||||
|
||||
## Guide, reference and examples
|
||||
|
||||
None yet. When the first stage lands: a guide here, a generated reference (`shaders-reference.md`) and an example pack
|
||||
in the repository that the renderer's tests load.
|
||||
|
||||
## Stability
|
||||
|
||||
Not started. The first stages will be experimental (opt-in), then preview once a reference, an example and a test
|
||||
pack exist ([stability.md](stability.md)).
|
||||
|
||||
## Not there yet
|
||||
|
||||
Everything on this page. The order: the renderer hooks shared with the format loader, then the material and post
|
||||
stages with options and hot reload, then the overlay, lighting, sky and shadow stages.
|
||||
|
||||
## Changelog
|
||||
|
||||
- 2026-10-24: the earlier shader pack code was removed; this API is designed from scratch.
|
||||
@@ -0,0 +1,103 @@
|
||||
# API stability and versioning
|
||||
|
||||
The rules every Horizon API follows ([the APIs](README.md)): how each one is versioned, what the stability levels
|
||||
promise, how something is deprecated and removed, and the tests that keep old mods, scripts and tools working.
|
||||
|
||||
## Versions
|
||||
|
||||
- **Each API has its own version**, separate from the game's release (`v0.2.14`, [versioning.md](../versioning.md))
|
||||
and from Minecraft's. A game release says which API versions it serves.
|
||||
- **Semantic versioning**, `MAJOR.MINOR.PATCH`. A **line** is what stays compatible: `0.1`, `0.2`, … before 1.0,
|
||||
then `1`, `2`, ….
|
||||
- Before 1.0: an addition makes the next patch (`0.1.0` → `0.1.1`); a breaking change starts the next line
|
||||
(`0.2.0`).
|
||||
- From 1.0: an addition makes the next minor (`1.0` → `1.1`); a breaking change starts the next major (`2.0`).
|
||||
- **Where the version lives:**
|
||||
|
||||
| API | The version | A user names the line they need |
|
||||
| --- | --- | --- |
|
||||
| Mods | the WIT package (`horizon:mods@0.1.0`) | `api = "0.1"` in `horizon-mod.toml` |
|
||||
| Agent control | the control protocol's version (planned: a `hello` reply and MCP `serverInfo`) | `horizon-ctl --api 1` (planned) |
|
||||
| Server control API | the path (`/api/v1/`) | the path |
|
||||
| `server.toml` | the file's keys; a key is never renamed in place | nothing: old files keep loading |
|
||||
| Launcher commands | the command names and their `--json` output | nothing |
|
||||
| Data formats | a `version` or `schema` field in the file | the reader rejects versions newer than it knows |
|
||||
|
||||
## What counts as a breaking change
|
||||
|
||||
Breaking: removing or renaming anything; changing a type, a default, a unit or a meaning; making something optional
|
||||
required; refusing input that was accepted; a new case in a WIT `enum` or `variant` the game sends to mods (an older
|
||||
component cannot decode it); a JSON field that changes type.
|
||||
|
||||
Not breaking: a new function, interface, capability, command, endpoint, tool or `server.toml` key; a new optional
|
||||
argument or JSON field (readers must ignore fields they don't know); a new WIT case the mod *sends* (the game decodes
|
||||
every case it ever served); faster, or fixing behaviour to what the reference already says.
|
||||
|
||||
## Stability levels
|
||||
|
||||
Every part of an API has one level, shown in its reference and its surface page.
|
||||
|
||||
| | Experimental | Preview | Stable |
|
||||
| --- | --- | --- | --- |
|
||||
| Who may use it | opt-in only (a flag or a manifest field naming it); never in a release default | anyone; marked "preview" where players see it (a mod's row on the Mods page) | anyone |
|
||||
| May change | in any release, without notice | only at a new line, after a deprecation | only at a new major, after a deprecation |
|
||||
| Deprecation window | none | at least 30 days, with one release line serving old and new | at least 180 days, with the old major served beside the new one |
|
||||
| Needs | a design note | a generated reference, a guide section, an example, compatibility tests | the same, plus one line of real use without a break |
|
||||
|
||||
- **Promotion.** Experimental → preview when it has what the table asks. Preview → stable when real users (a published
|
||||
mod, a host's script, an agent's tool) used it for a whole line and nothing broke. The maintainers' orchestrator
|
||||
proposes the promotion with the evidence (the compatibility tests, the complete docs, that line of use) and Ludovic
|
||||
approves it.
|
||||
- **Horizon-only by design.** An API is stable only for what Horizon itself does; a vanilla concept it exposes (a block
|
||||
id, a command, a `server.properties` key) changes when vanilla changes it, with a version port
|
||||
([version-ports.md](../version-ports.md)), and the changelog says so.
|
||||
|
||||
## Deprecation and removal
|
||||
|
||||
1. The pull request that deprecates marks it where it is defined (a `/// Deprecated: use X; goes in 0.3.` doc comment,
|
||||
WIT's `@deprecated`, a `deprecated` field in a tool's schema) and adds the replacement in the same release.
|
||||
2. The reference shows it as deprecated, and the surface page's changelog says what replaces it and when it goes.
|
||||
3. Using it logs one warning per mod, session or client, naming the replacement; it keeps working.
|
||||
4. It is removed only after the window, and only at the next line (preview) or major (stable).
|
||||
5. A line or major that is no longer served is refused with a clear message (`needs API 0.1; this Horizon serves 0.3
|
||||
and 0.4`), never loaded half-way.
|
||||
|
||||
## Compatibility tests
|
||||
|
||||
Every preview and stable API has tests that run old users against the current code, in CI:
|
||||
|
||||
| API | The test |
|
||||
| --- | --- |
|
||||
| Mods | a test mod per served line, built from source against that line's WIT and SDK, loaded by today's runtime with expected output (`crates/horizon-mods/tests/`); a line is served as long as its test mod passes |
|
||||
| Agent control | a transcript per protocol version: commands and the reply keys each must have |
|
||||
| Server | `api::ROUTES` against `route()` (generated reference); a `server.toml` from each release line parses to the same settings; golden replies per endpoint |
|
||||
| Launcher | the generated reference; golden `--json` output per command |
|
||||
| Data formats | a sample file of every version a reader accepts, read by today's reader |
|
||||
|
||||
The generated references are the API's own diff: a pull request that changes an API changes its reference, and the
|
||||
reviewer applies the rules above to that diff.
|
||||
|
||||
## Changelog
|
||||
|
||||
Each surface page ends with a changelog: one line per change, newest first, with the API version and the pull request.
|
||||
Deprecations and breaking changes are in bold. The release notes of the game release that ships a change link it.
|
||||
|
||||
## Today
|
||||
|
||||
| Part | Level | Version |
|
||||
| --- | --- | --- |
|
||||
| Mod API: `log`, `game`, `chat`, `hud`, `storage`, `events` | preview | 0.1.0 |
|
||||
| Content mods (`registries`: data-driven blocks and items) | preview | manifest `api = "0.2"` |
|
||||
| Server mods (events, world, server commands) | not started | manifest `api = "0.3"`, experimental first |
|
||||
| Script mods (Lua run by an interpreter mod, [mods.md](mods.md#ways-in)) | not started | |
|
||||
| `cargo horizon-mod` (`new`, `build`, `run`), `horizon-mod-sdk` | preview | 0.1.0 |
|
||||
| Shader API | not started | |
|
||||
| `horizon-ctl` commands and MCP tools | preview | none yet (unversioned) |
|
||||
| The game's own control-socket commands outside `horizon-ctl`'s table (test hooks) | experimental | |
|
||||
| `horizon-server` commands, `server.toml` | stable | `horizon-server --version` |
|
||||
| Server control API | stable | `/api/v1` |
|
||||
| `horizon-launcher` commands and MCP tools | preview | none yet (unversioned) |
|
||||
| Benchmark report | stable | `"version": 1` |
|
||||
| Telemetry batch and consent | stable | `"schema": 1`, consent `2` |
|
||||
| `horizon-graphics.txt`, `horizon-extras.txt`, `horizon-mods.txt` | preview | none |
|
||||
| `SHA256SUMS` and `SHA256SUMS.sig` | stable | |
|
||||
@@ -41,7 +41,7 @@ file selects ~103.
|
||||
| 24 | Container menus and inventory (61) | `L/menu.rs`, `L/container_screen.rs`, `L/containers.rs`, `L/creative.rs`; game.rs `fn menu_ops`, `fn click_inventory` | menu_click, container_screen, creative, lan_e2e containers clicks |
|
||||
| 25 | Workstations (60) | `L/stations.rs`, `G/stations.rs`, `L/enchant.rs`, `L/brewing.rs` | enchanting, screen_layout, lan_e2e brewing loom stonecutter grindstone anvil smithing |
|
||||
| 26 | Crafting and the recipe book (59) | `L/crafting.rs`, `L/recipe_book.rs`, `L/recipe_book_screen.rs`, `G/recipe_book.rs`, `G/machines.rs`, `G/machines/crafter.rs` | recipe, recipe_book, recipe_book_view, place_recipe, ghost_recipe, crafter |
|
||||
| 27 | Vehicles and mounts (54) | `G/boats.rs`, `G/minecarts.rs`, `G/mounts.rs`, `G/mount_menu.rs`, `G/llamas.rs`, `G/passengers.rs` | server_entities, lan_e2e boats minecarts riding mounts |
|
||||
| 27 | Vehicles and mounts (54) | `G/boats.rs`, `G/boat_passengers.rs`, `G/minecarts.rs`, `G/mounts.rs`, `G/mount_menu.rs`, `G/llamas.rs`, `G/passengers.rs` | server_entities, lan_e2e boats minecarts riding mounts |
|
||||
| 28 | Villagers, trading, raids (50) | `L/mobs/villager*.rs`, `L/merchant.rs`, `G/trading.rs`, `G/villagers.rs`, `L/raid.rs`, `G/raids.rs`, `L/gossip.rs` | trading, raid, mob_ai |
|
||||
| 29 | Title, worlds, startup (49) | `L/title.rs` + `L/title/`, `G/startup_menu.rs`, `L/title_edition.rs` | world_options; `cargo test -p horizon-client --lib title` |
|
||||
| 30 | Dedicated server, horizon-server (48) | `G/dedicated.rs`, `G/dedicated/status.rs`, `crates/horizon-server/`, `crates/horizon-server-files/` | dedicated_server, server_files, user_cache, online_mode, server_ops_feedback |
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
# How Horizon is built
|
||||
|
||||
Who writes Horizon, how changes are checked, and why it is safe to run. You can check every claim on this page in the repository, and anything not done yet is marked as not done.
|
||||
|
||||
This page is also on the website: [playhorizon.dev/docs/how-horizon-is-built](https://playhorizon.dev/docs/how-horizon-is-built). The longer version, with what is still missing, is [Security](security.md).
|
||||
|
||||
## Who builds it
|
||||
|
||||
Horizon is Ludovic Marie's project: he decides what it does and what ships. **Most of the code is written by AI agents**: Claude sessions that Ludovic runs, and contributors' own AI tools. Some contributors write their code by hand.
|
||||
|
||||
Agents say what they are. A pull request opened by one of Ludovic's agents starts with "Opened by Ludovic's AI agent (Claude), not by Ludovic himself.", its comments start with "🤖 Agent:", and its commits name the agent in a `Co-Authored-By` line.
|
||||
|
||||
## How changes are checked
|
||||
|
||||
Not every line is read by a person. Instead, every change is checked against the real game, automatically:
|
||||
|
||||
- **Harnesses.** A harness is a test that gives the same inputs to Horizon and to the real Minecraft 26.3, then compares the results. There are 326 of them (25 October 2026), from world generation to mobs, redstone and commands. The [status table](https://playhorizon.dev/#parity) shows what they cover. Passing them all does not prove that nothing else differs.
|
||||
- **Checks on every pull request.** `verify` runs on GitHub's machines for every pull request and every change to main: formatting, lints with warnings treated as errors, the tests, and the check that no Minecraft files are committed. Main takes no change without it. `parity` runs the harnesses a change can affect, on a machine that holds a copy of Minecraft. For a pull request from a fork, it runs once a maintainer has read the change.
|
||||
- **Outside contributions are checked again.** Before a contributor's pull request merges, Ludovic's agents compare what it claims with vanilla's own code, review it line by line, rewrite the weak parts, and test it in single player, on a LAN and on a dedicated server where those apply.
|
||||
- **Releases are tested first.** A release is published only after its smoke test passes (the game starts and draws a world) and while no issue is labelled `release-blocker`.
|
||||
|
||||
## Why it's safe to run
|
||||
|
||||
- **Open source.** All of the code is public on [GitHub](https://github.com/ludovic111/horizon), under the MIT licence.
|
||||
- **Built from the public code.** Releases are built by GitHub Actions, the build service of GitHub, from the public source. Linux and Windows are built on GitHub's machines, and macOS on Ludovic's Mac mini, which runs GitHub Actions jobs. Every build log is [public](https://github.com/ludovic111/horizon/actions/workflows/release.yml).
|
||||
- **Signed checksums.** Every release has a `SHA256SUMS` file, a fingerprint of each download, and `SHA256SUMS.sig`, a signature of that list made with Horizon's release key, which only release builds from main can use. The launcher and `horizon-server update` check both before they install anything, and refuse a file that does not match. The very first server install with `install.sh` checks the fingerprint but not the signature.
|
||||
- **Not yet signed by Apple or Microsoft.** The macOS app is not notarized by Apple, because it is not signed with a paid Apple developer account, so macOS asks you to confirm the first time ([Install](https://playhorizon.dev/docs/install#download-the-launcher) shows how). The Windows programs are not code-signed either, so Windows may warn you too.
|
||||
- **Mods run in a sandbox.** Horizon mods are WebAssembly programs with no access to your files, the network or other programs. A mod lists what it needs, you see that list before you turn it on, and it can do nothing else. See [Mods](mods.md).
|
||||
- **Nothing collected unless you say yes.** Data collection is off until you turn it on, with four separate switches. The one exception is an anonymous "I'm playing" ping for the launcher's player count, which holds nothing about you. See [Opt-in data collection](telemetry.md).
|
||||
|
||||
## What it doesn't contain
|
||||
|
||||
- **No Minecraft files.** Horizon contains no Minecraft code, assets or data, and never downloads them. The launcher builds the game files on your computer from your own copy of Minecraft: Java Edition 26.3. A check that runs on every pull request (`tools/check_public_tree.py`) keeps game files and decompiled code out of the repository and its history.
|
||||
- **No code from other mods.** Since 24 October 2026, Horizon's code may only be written from Minecraft 26.3 itself and public documentation, never from another mod, loader or renderer ([the rule](../CONTRIBUTING.md#only-original-code)). That day shader packs were removed ([#1561](https://github.com/ludovic111/horizon/pull/1561)), after a developer of Iris showed that our shader pack code had been written from Iris's source. They are being written again from a description of the pack format only.
|
||||
|
||||
## Check it yourself
|
||||
|
||||
- **Read the code and its checks.** [The source](https://github.com/ludovic111/horizon), [the checks on every pull request](https://github.com/ludovic111/horizon/actions/workflows/ci.yml) and [the release builds](https://github.com/ludovic111/horizon/actions/workflows/release.yml).
|
||||
- **Compare the fingerprints.** Put a release's files and its `SHA256SUMS` in one folder and run `sha256sum -c SHA256SUMS --ignore-missing` (on macOS `shasum -a 256 -c SHA256SUMS --ignore-missing`, on Windows `Get-FileHash <file>` in PowerShell). Each file should say `OK`.
|
||||
- **Check the signature.** Download a whole release into a folder, then from a clone of the repository run `cargo run -p horizon-release-sign -- verify --tag <tag> <folder>`. The public key is in `crates/horizon-release-sign/release-keys.txt`.
|
||||
- **Build it yourself.** The README explains how to [build from source](../README.md#build-from-source).
|
||||
+13
-1
@@ -16,7 +16,7 @@ folder, loads no runtime and plays exactly like vanilla 26.3.
|
||||
| SDK for mod authors | `crates/horizon-mod-sdk` | 0.1 |
|
||||
| Example mod | `crates/horizon-mod-sdk/examples/coords-hud` | coordinates, facing and time HUD, `/where`, `/coords` |
|
||||
| Runtime | `crates/horizon-mods` | wasmtime 36 LTS, component model |
|
||||
| Authoring tool | `crates/cargo-horizon-mod` | `cargo horizon-mod new / build / run` |
|
||||
| Authoring tool | `crates/cargo-horizon-mod` | `cargo horizon-mod new / build / run / check`, and the registry's CI (`registry build / review / list`) |
|
||||
| In the game | `crates/horizon-client/src/game/mods.rs`, Options > Mods | client mods |
|
||||
| Launcher mod browser (Modrinth, CurseForge with a key) | [mod-browser.md](mod-browser.md) | resource packs, modpacks |
|
||||
| Registry index (`index.json`, `.hpack`), signatures | `horizon_mods::index`, [api/mod-index.md](api/mod-index.md) | schema 1; launcher and website next |
|
||||
@@ -226,6 +226,18 @@ always on, and the game checks its file once a second: rebuild and it restarts
|
||||
with "Mods reloaded" in chat. Its in-memory state starts over; whatever it
|
||||
saved with capability `storage` survives the reload.
|
||||
|
||||
Before you submit it to the registry, run what its CI runs:
|
||||
|
||||
```sh
|
||||
cargo horizon-mod check target/horizon-mod/my_mod.hmod # --json for the report as JSON
|
||||
```
|
||||
|
||||
It reads the manifest and content, refuses imports the capabilities don't
|
||||
cover, then plays the mod in the sandbox for 40 ticks, 120 frames, a chat line
|
||||
and each of its commands: it must start and never trap or overrun. It checks a
|
||||
`.hpack` and a resource pack `.zip` too, and a signature with `--key <public
|
||||
key> --signature <file>.minisig`.
|
||||
|
||||
### Template layout
|
||||
|
||||
```
|
||||
|
||||
@@ -208,6 +208,28 @@ p50/p95/p99/max frame times), plus CPU and GPU time per frame; [the graphics
|
||||
benchmark](graphics.md#benchmark) is built on it. Frame times include waits for
|
||||
presentation, so `bench` reports what is on screen.
|
||||
|
||||
### Discord Rich Presence
|
||||
|
||||
While Discord runs on the same computer, the player's Discord profile shows
|
||||
"Playing Horizon" and what they are doing: "In the menus", "Singleplayer",
|
||||
"Multiplayer" or "Hosting a world" (with the party size, of 8), the dimension
|
||||
("In the Nether") and the time since they entered the world. It never shows a
|
||||
world's name or a server's address. Horizon Settings has the switch
|
||||
(**Discord Rich Presence**, on by default; `discordPresence` in
|
||||
`horizon-extras.txt`), and `HORIZON_NO_DISCORD=1` turns it off for one run.
|
||||
|
||||
`crates/horizon-client/src/discord_presence.rs` speaks Discord's local IPC
|
||||
itself (the `discord-ipc-N` socket or named pipe, no SDK) from a thread of its
|
||||
own: the frame only hands it a status when it changes. It retries every 15 s
|
||||
while Discord isn't running and stays within Discord's 5 updates per 20 s.
|
||||
Dedicated servers never start it, and automated runs (offscreen, benchmarks)
|
||||
only talk to a fake Discord: `lab.game_env` sets `HORIZON_NO_DISCORD=1`, and
|
||||
`tools/discord_presence_e2e.py` points games at a fake server with
|
||||
`HORIZON_DISCORD_IPC_DIR` (title, world, Nether and quit on both single-player
|
||||
paths; a LAN host and guest; the switch; a Discord started after the game).
|
||||
`DISCORD_APP_ID` is Discord's "Horizon" application, whose `horizon` image is
|
||||
the large one; there are no game-mode images yet.
|
||||
|
||||
### Play on another of your machines
|
||||
|
||||
Horizon targets Linux on x86-64 with an NVIDIA GPU (Vulkan); macOS and Windows
|
||||
|
||||
@@ -32,6 +32,10 @@ Passes are shared between worktrees. A harness's key depends only on the content
|
||||
|
||||
Every runner on the machine shares `PARITY_MACHINE_JOBS` slots (default: half the CPU threads), so several agents' runs together can't overload it. Parallel harnesses are also admitted by memory: each harness's recorded peak is reserved, within three quarters of the memory available at the start, and a harness starts only if the memory free at that moment still leaves 2 GB. `-j` caps the count here (default: `PARITY_LOCAL_JOBS`, else 3 while other machines help or a third of the CPU threads alone, within `$FLEET_LOAD_JOBS`).
|
||||
|
||||
### Harnesses that start the game
|
||||
|
||||
The game logs into `HORIZON_HOME` and falls back to the player's own game folder when it is unset, so a harness that starts the game, `horizon-ctl`, the launcher or the dedicated server builds the environment with `lab.game_env(**extra)`: no audio, and fresh scratch folders for `HORIZON_HOME`, `HORIZON_LAUNCHER_HOME`, `XDG_DATA_HOME` and `XDG_CONFIG_HOME`, removed when the harness exits (a folder you pass, or that the environment already has, is kept). The runner also gives each harness its own `HORIZON_HOME` under `.local/parity-runner/game-home/`. `tests/test_game_home.py` fails for a script in `tools/` that starts the game without it.
|
||||
|
||||
### Other machines
|
||||
|
||||
Harnesses can also run on the Mac mini and the ThinkPad (`tools/parity_hosts.json` describes them; its `default` list is empty, so pass `--hosts macmini,thinkpad` or set `PARITY_HOSTS`, after copying `shared-local/` to `~/code/horizon-parity/shared-local` on each host). The runner mirrors the worktree there with rsync (not `.git`, `.local`, `target` or ignored files) into `~/code/horizon-parity/remote/<host><path>`, whose `.local` links to the vanilla data in `~/code/horizon-parity/shared-local`, and starts `tools/parity.py --worker` over ssh. The worker builds the probes (about 80 s the first time) and runs what it is sent under the same tracer, admitting harnesses against its own free memory. One queue, longest first, feeds every machine, remote ones first: the Mac takes up to 14 harnesses, the desktop 3 and only those under 800 MB. Each pass comes back with the content hash of every file it depended on, so it is keyed on exactly what ran, and logs come back to `.local/parity-runner/logs/`; state, sharing and `gate.py` work as before. If a host can't be reached, or drops out, its harnesses run here.
|
||||
|
||||
@@ -312,6 +312,15 @@ and by hand; pushes to `launcher` and `launcher-*` branches only build.
|
||||
- Published with `--latest=false`: the repository's latest release stays a game release. Notes list the pull
|
||||
requests under New and Fixed; Kira posts launcher releases without pinging.
|
||||
|
||||
Making a launcher release GitHub's latest instead would break servers: every `horizon-server` already installed,
|
||||
`install.sh` and `install.ps1` ask for `releases/latest` and expect the game's archives there, and a server that
|
||||
can't update can't fetch the fix either. So the game release stays the latest, and it sends people to the launcher
|
||||
(#1647): its notes open with a "Want to play? Download the Horizon launcher" block (`PLAYERS` in
|
||||
`tools/release_train.py`: raw HTML, which GitHub shows and launchers' notes skip; the site's Releases page leaves
|
||||
it out too), and its archives carry labels ("Game files the
|
||||
launcher installs: Linux (…)") that GitHub shows in place of the file names. Everything that downloads matches
|
||||
the asset's name, which is unchanged.
|
||||
|
||||
Starting by hand, pausing and rolling back work as for the game (`gh workflow run launcher …`,
|
||||
`RELEASES_PAUSED`, `gh release edit launcher@X.Y.Z --draft`). Launchers older than the withdrawn release then
|
||||
see the previous one as the newest; launchers that already updated keep running.
|
||||
|
||||
+11
-5
@@ -32,11 +32,17 @@ stay in the host's dimension. That mode is the escape hatch, so it gets no multi
|
||||
|
||||
## One code path for both
|
||||
|
||||
The dedicated server and the server thread are the same code. The server thread runs a `Game` with
|
||||
`options.dedicated` set and a hub without a host player. The window joins it through memory as one
|
||||
more player. Everything above serves both, and `server_dimension_players` (vanilla clients on Horizon's
|
||||
dedicated server) and `lan_e2e --server-thread` (Horizon clients on the server thread) check it from
|
||||
the two sides.
|
||||
The dedicated server and the server thread are the same code. Each `Game` has an explicit
|
||||
`ExecutionRole`: `Client`, `IntegratedServer` or `DedicatedServer`, selected before construction in
|
||||
`Options.execution_role`. Startup, world loading and opening other dimensions use that role. Only
|
||||
clients mesh chunks and show loading progress; a client can still run its simulation in-frame.
|
||||
Connecting or disconnecting changes `remote`, independently of the execution role.
|
||||
|
||||
The server thread has a hub without a host player. The window joins it through memory as one
|
||||
more player. It still sets `options.dedicated` for gameplay checks outside the role migration's
|
||||
startup/world-loading scope. Everything above serves both servers, and `server_dimension_players`
|
||||
(vanilla clients on Horizon's dedicated server) and `lan_e2e --server-thread` (Horizon clients on the
|
||||
server thread) check it from the two sides.
|
||||
|
||||
## Cost of an extra level
|
||||
|
||||
|
||||
Reference in New Issue
Block a user