Mod API: render.set-far-terrain, and the official Far View mod

A mod can now turn on the game's distant terrain (LOD) with
render.set-far-terrain: a distance of 64 to 1024 chunks and Far Detail's
Reduced. The game builds and draws the tiles as it does for the LOD
Distance setting, which wins while it is on. One far terrain shows at a
time, the first loaded mod's. API level 4.

mods/official/far-view is the official mod on it: Distance (256 chunks by
default) and Far detail on its settings page, kept in its storage.
This commit is contained in:
Kacpherek
2026-10-26 20:34:08 +01:00
parent 159f2bf890
commit ae3737b1c2
17 changed files with 261 additions and 26 deletions
+6 -1
View File
@@ -38,7 +38,7 @@ don't import it); faster, or fixing behaviour to what the reference already says
A new WIT function doesn't break older mods, but a mod that calls it can't run on a Horizon from before it. So every
function the game offers mods has an **API level**, the one it arrived at (`crates/horizon-mods/src/api_level.rs`):
level 0 is the contract of Horizon 0.2.67 to 0.2.69, level 1 adds `render.set-minimap` and server mods' `players`, level 2 `game.raycast`, level 3 `command.run-quiet`. A mod needs the level of
level 0 is the contract of Horizon 0.2.67 to 0.2.69, level 1 adds `render.set-minimap` and server mods' `players`, level 2 `game.raycast`, level 3 `command.run-quiet`, level 4 `render.set-far-terrain`. A mod needs the level of
the newest function it imports (a component imports only the functions it calls). The level is read from the file,
never declared:
@@ -134,3 +134,8 @@ Deprecations and breaking changes are in bold. The release notes of the game rel
for a map image costs too much through hook calls, so the game keeps the tiles (vanilla's map colours) and the mod
picks the corner, side, scale and shape. One map shows at a time, the first loaded mod's. It is a new function and a
new type, so mods built before it keep loading.
- **`render.set-far-terrain`** turns on the game's own distant terrain, not one a mod builds: sampling the generator
and meshing thousands of far tiles runs on the game's workers within its frame and upload budgets, which no hook
call could match. The mod picks the distance (64 to 1024 chunks, capped lower on integrated graphics as LOD Distance
is) and Far Detail's Reduced. The player's own LOD Distance, when on, wins; one far terrain shows at a time, the
first loaded mod's.