Merge pull request #1274 from ludovic111/feat/site-releases-bench
🤖 Agent: merged after verify passed; Ludovic approved the site design. The Releases and Benchmarks pages go live with this.
This commit is contained in:
@@ -0,0 +1,134 @@
|
||||
// The Benchmarks page's tables, from the summary (public/benchmarks.json, or the telemetry server's
|
||||
// GET /v1/benchmarks/summary in the same shape). Shared by build.mjs (baked) and benchmarks-page.js (live).
|
||||
import { escape } from "./markdown.js";
|
||||
|
||||
export const METRICS = [
|
||||
{ key: "avg_fps", label: "Average FPS", kind: "fps", better: "high" },
|
||||
{ key: "low_1pct_fps", label: "1% low FPS", kind: "fps", better: "high", hint: "the slowest 1% of frames, as FPS" },
|
||||
{ key: "p95_ms", label: "Frame time, 95th percentile", kind: "ms", better: "low" },
|
||||
{ key: "world_ms", label: "Start to in-world", kind: "ms", better: "low", hint: "process start to the spawn area loaded and drawn" },
|
||||
{ key: "chunk_load_ms", label: "Chunk load after a teleport", kind: "ms", better: "low", hint: "the four scenes' average" },
|
||||
{ key: "rss_steady_mb", label: "Memory while playing", kind: "mb", better: "low" },
|
||||
{ key: "rss_peak_mb", label: "Memory, peak", kind: "mb", better: "low" },
|
||||
];
|
||||
|
||||
export function format(kind, x) {
|
||||
if (x == null || !Number.isFinite(x)) return "–";
|
||||
if (kind === "fps") return x >= 100 ? Math.round(x).toLocaleString("en") : x.toFixed(x >= 10 ? 0 : 1);
|
||||
if (kind === "ms") return x >= 1000 ? `${(x / 1000).toFixed(x >= 10000 ? 0 : 1)} s` : `${x < 10 ? x.toFixed(1) : Math.round(x)} ms`;
|
||||
if (kind === "mb") return x >= 1000 ? `${(x / 1024).toFixed(1)} GB` : `${Math.round(x)} MB`;
|
||||
return String(x);
|
||||
}
|
||||
|
||||
// "2.4x faster", "1.3x slower", "2.0x less" (memory), from Horizon's side.
|
||||
export function compare(metric, horizon, java) {
|
||||
if (horizon == null || java == null || !horizon || !java) return null;
|
||||
const ratio = metric.better === "high" ? horizon / java : java / horizon;
|
||||
if (Math.abs(ratio - 1) < 0.05) return { text: "about the same", wins: "tie" };
|
||||
const word = metric.kind === "mb" ? (ratio > 1 ? "less" : "more") : ratio > 1 ? "faster" : "slower";
|
||||
const r = ratio > 1 ? ratio : 1 / ratio;
|
||||
return { text: `${r.toFixed(r >= 10 ? 0 : 1)}x ${word}`, wins: ratio > 1 ? "horizon" : "java" };
|
||||
}
|
||||
|
||||
// The game's average frame rate sat at a display cap (`capped_fps`): the real one is at least that.
|
||||
export const capped = (row) => Boolean(row?.capped_fps && row.medians?.avg_fps >= row.capped_fps * 0.97);
|
||||
|
||||
// compare() between two rows, saying "at least" where Horizon's average sat at a cap.
|
||||
export function compareRows(metric, h, j) {
|
||||
const c = compare(metric, h?.medians?.[metric.key], j?.medians?.[metric.key]);
|
||||
if (!c || metric.key !== "avg_fps" || !capped(h)) return c;
|
||||
return c.wins === "horizon" ? { ...c, text: `at least ${c.text}` } : { text: "capped, can't tell", wins: "none" };
|
||||
}
|
||||
|
||||
export const cell = (metric, row) => {
|
||||
const v = format(metric.kind, row?.medians?.[metric.key]);
|
||||
return metric.key === "avg_fps" && capped(row) ? `${v} <span class="capped" title="Held to the display's ${row.capped_fps} Hz: the real figure is at least this">(cap)</span>` : v;
|
||||
};
|
||||
|
||||
const machines = (groups) => {
|
||||
const by = new Map();
|
||||
for (const g of groups.filter((g) => g.source === "us")) {
|
||||
if (!by.has(g.machine)) by.set(g.machine, []);
|
||||
by.get(g.machine).push(g);
|
||||
}
|
||||
return by;
|
||||
};
|
||||
|
||||
const pick = (rows, game, rd) => rows.find((r) => r.game === game && r.render_distance === rd);
|
||||
|
||||
// One machine we measured: Horizon and Java side by side at each render distance.
|
||||
export function machineHtml(name, rows) {
|
||||
const first = rows[0];
|
||||
const distances = [...new Set(rows.map((r) => r.render_distance))].sort((a, b) => a - b);
|
||||
const horizon = rows.find((r) => r.game === "horizon");
|
||||
const java = rows.find((r) => r.game === "vanilla");
|
||||
const head = distances.map((rd) => `<th scope="colgroup" colspan="3">Render distance ${rd}</th>`).join("");
|
||||
const sub = distances.map(() => `<th scope="col">Horizon</th><th scope="col">Java</th><th scope="col"><span class="sr-only">Horizon against Java</span></th>`).join("");
|
||||
const body = METRICS.map((m) => {
|
||||
const cells = distances
|
||||
.map((rd) => {
|
||||
const h = pick(rows, "horizon", rd);
|
||||
const j = pick(rows, "vanilla", rd);
|
||||
const c = compareRows(m, h, j);
|
||||
return `<td class="num${c?.wins === "horizon" ? " wins" : ""}">${cell(m, h)}</td><td class="num${c?.wins === "java" ? " wins" : ""}">${cell(m, j)}</td><td class="vs vs-${c?.wins || "none"}">${c ? escape(c.text) : ""}</td>`;
|
||||
})
|
||||
.join("");
|
||||
return `<tr><th scope="row">${escape(m.label)}${m.hint ? `<span class="metric-hint">${escape(m.hint)}</span>` : ""}</th>${cells}</tr>`;
|
||||
}).join("");
|
||||
const javaWins = METRICS.flatMap((m) =>
|
||||
distances.filter((rd) => compareRows(m, pick(rows, "horizon", rd), pick(rows, "vanilla", rd))?.wins === "java").map((rd) => `${m.label.toLowerCase()} at ${rd}`),
|
||||
);
|
||||
// Per scene too: an average that Horizon wins can hide a scene where Java is faster.
|
||||
const sceneName = { village: "the village", forest: "the forest", ocean: "the ocean", mountain: "the mountain" };
|
||||
for (const rd of distances) {
|
||||
const h = pick(rows, "horizon", rd);
|
||||
const j = pick(rows, "vanilla", rd);
|
||||
for (const [scene, js] of Object.entries(j?.scenes || {})) {
|
||||
const hs = h?.scenes?.[scene];
|
||||
if (!hs?.avg_fps || !js?.avg_fps || (h.capped_fps && hs.avg_fps >= h.capped_fps * 0.97)) continue;
|
||||
if (js.avg_fps > hs.avg_fps * 1.05) javaWins.push(`average FPS over ${sceneName[scene] || scene} at ${rd} (${format("fps", js.avg_fps)} against ${format("fps", hs.avg_fps)})`);
|
||||
}
|
||||
}
|
||||
const facts = [
|
||||
["CPU", first.cpu],
|
||||
["GPU", first.gpu],
|
||||
["Horizon", horizon ? `${horizon.version} · ${horizon.backend || "?"}` : "not measured"],
|
||||
["Java", java ? `${java.version} (vanilla) · ${java.backend || "?"}` : "not measured"],
|
||||
["Measured", `${first.measured}${first.repeats ? ` · ${first.repeats} runs of each` : ""}${first.window ? ` · ${first.window.join("x")} window` : ""}`],
|
||||
];
|
||||
return `<article class="machine" id="machine-${escape(name.toLowerCase().replace(/[^a-z0-9]+/g, "-"))}">
|
||||
<header class="machine-head">
|
||||
<p class="eyebrow"><span class="badge badge-us">Measured by us</span></p>
|
||||
<h3 class="machine-name">${escape(name)}</h3>
|
||||
<dl class="machine-facts">${facts.map(([k, v]) => `<div><dt>${k}</dt><dd>${escape(String(v))}</dd></div>`).join("")}</dl>
|
||||
${rows.find((r) => r.note) ? `<p class="machine-note">${escape(rows.find((r) => r.note).note)}</p>` : ""}
|
||||
</header>
|
||||
<div class="table-wrap"><table class="bench-table">
|
||||
<thead><tr><td></td>${head}</tr><tr><td></td>${sub}</tr></thead>
|
||||
<tbody>${body}</tbody>
|
||||
</table></div>
|
||||
${javaWins.length ? `<p class="java-wins"><strong>Where Java is ahead:</strong> ${escape(javaWins.join("; "))}.</p>` : `<p class="java-wins">Horizon is ahead on every figure here.</p>`}
|
||||
</article>`;
|
||||
}
|
||||
|
||||
export function machinesHtml(summary) {
|
||||
const by = machines(summary?.groups || []);
|
||||
if (!by.size) return `<p class="lede">No measurements are published yet.</p>`;
|
||||
return [...by].map(([name, rows]) => machineHtml(name, rows)).join("\n");
|
||||
}
|
||||
|
||||
// Players' groups: one row each, at least `min_installs` installs.
|
||||
export function playersHtml(summary) {
|
||||
const groups = (summary?.groups || []).filter((g) => g.source === "players");
|
||||
if (!groups.length)
|
||||
return `<p class="empty">No player results yet. A GPU and CPU pair shows here once at least ${summary?.min_installs || 3} different installs have shared a benchmark with it.</p>`;
|
||||
const rows = groups
|
||||
.map(
|
||||
(g) => `<tr><th scope="row">${escape(g.gpu)}<span class="metric-hint">${escape(g.cpu)}</span></th><td class="num">${g.render_distance}</td><td>${g.game === "vanilla" ? "Java" : "Horizon"}</td>${["avg_fps", "low_1pct_fps", "p95_ms", "world_ms", "rss_steady_mb"].map((k) => `<td class="num">${format(METRICS.find((m) => m.key === k).kind, g.medians?.[k])}</td>`).join("")}<td><span class="badge badge-players">From ${g.installs} players</span></td></tr>`,
|
||||
)
|
||||
.join("");
|
||||
return `<div class="table-wrap"><table class="bench-table players-table">
|
||||
<thead><tr><th scope="col">GPU and CPU</th><th scope="col">Render distance</th><th scope="col">Game</th><th scope="col">Average FPS</th><th scope="col">1% low</th><th scope="col">p95</th><th scope="col">To in-world</th><th scope="col">Memory</th><th scope="col">Source</th></tr></thead>
|
||||
<tbody>${rows}</tbody>
|
||||
</table></div>`;
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
// The Benchmarks page: players' results from the telemetry server (the baked summary when it doesn't answer)
|
||||
// and the hardware picker (a measurement when there is one, else an estimate from src/estimate.js).
|
||||
import { escape } from "./markdown.js";
|
||||
import { METRICS, cell, compareRows, format, playersHtml } from "./bench.js";
|
||||
import { estimate, measured } from "./estimate.js";
|
||||
import { findCpu, findGpu } from "./hardware.js";
|
||||
import { setUpMenu, setUpTheme } from "./chrome.js";
|
||||
|
||||
const TELEMETRY = "https://telemetry.playhorizon.dev";
|
||||
const baked = JSON.parse(document.getElementById("bench-data").textContent);
|
||||
let groups = baked.groups || [];
|
||||
|
||||
async function live() {
|
||||
try {
|
||||
const res = await fetch(`${TELEMETRY}/v1/benchmarks/summary`, { signal: AbortSignal.timeout(3000) });
|
||||
if (!res.ok) throw new Error(String(res.status));
|
||||
const summary = await res.json();
|
||||
if (summary.format !== "horizon-benchmark-summary" || summary.version !== 1 || !Array.isArray(summary.groups)) throw new Error("format");
|
||||
// Our own rows stay the baked ones; players' come from the server.
|
||||
const players = summary.groups.filter((g) => g.source === "players" && g.installs >= (summary.min_installs || 3));
|
||||
groups = [...groups.filter((g) => g.source === "us"), ...players];
|
||||
document.getElementById("players-table").innerHTML = playersHtml({ ...summary, groups: players });
|
||||
document.querySelector("[data-players-source]").textContent = `Live from the telemetry server, aggregated ${summary.generated.slice(0, 16).replace("T", " ")} UTC.`;
|
||||
render();
|
||||
} catch {
|
||||
// The baked results stay; the line under the heading already says when they were made.
|
||||
}
|
||||
}
|
||||
|
||||
const picker = document.getElementById("picker");
|
||||
const out = document.getElementById("pick-result");
|
||||
|
||||
const range = (kind, e) => {
|
||||
if (!e) return "–";
|
||||
if (e.atLeast) return `at least ${format(kind, e.low)}`;
|
||||
return e.low != null ? `${format(kind, e.low)} to ${format(kind, e.high)}` : format(kind, e.value);
|
||||
};
|
||||
|
||||
function sourceBadge(row) {
|
||||
return row.source === "us" ? `<span class="badge badge-us">Measured by us · ${escape(row.machine)}</span>` : `<span class="badge badge-players">From ${row.installs} players</span>`;
|
||||
}
|
||||
|
||||
function measuredTable(h, j) {
|
||||
return `<table class="bench-table pick-table"><thead><tr><td></td><th scope="col">Horizon</th><th scope="col">Java</th><th scope="col"><span class="sr-only">Horizon against Java</span></th></tr></thead><tbody>${METRICS.map((m) => {
|
||||
const c = compareRows(m, h, j);
|
||||
return `<tr><th scope="row">${escape(m.label)}</th><td class="num${c?.wins === "horizon" ? " wins" : ""}">${cell(m, h)}</td><td class="num${c?.wins === "java" ? " wins" : ""}">${cell(m, j)}</td><td class="vs vs-${c?.wins || "none"}">${c ? escape(c.text) : ""}</td></tr>`;
|
||||
}).join("")}</tbody></table>`;
|
||||
}
|
||||
|
||||
function estimateTable(h, j) {
|
||||
return `<table class="bench-table pick-table"><thead><tr><td></td><th scope="col">Horizon (estimate)</th><th scope="col">Java (estimate)</th></tr></thead><tbody>${METRICS.map(
|
||||
(m) => `<tr><th scope="row">${escape(m.label)}</th><td class="num">${range(m.kind, h?.[m.key])}</td><td class="num">${range(m.kind, j?.[m.key])}</td></tr>`,
|
||||
).join("")}</tbody></table>`;
|
||||
}
|
||||
|
||||
function render() {
|
||||
const gpu = findGpu(picker.gpu.value);
|
||||
const cpu = findCpu(picker.cpu.value);
|
||||
const rd = Number(picker.rd.value);
|
||||
if (!gpu || !cpu) return;
|
||||
const mh = measured(groups, gpu, cpu, rd, "horizon");
|
||||
const mj = measured(groups, gpu, cpu, rd, "vanilla");
|
||||
if (mh.length || mj.length) {
|
||||
const h = mh[0];
|
||||
const j = mj[0];
|
||||
out.innerHTML = `<p class="pick-head">${[h, j].filter(Boolean).map(sourceBadge).join(" ")}</p>${measuredTable(h, j)}${
|
||||
h && h.source === "us" && h.measured ? `<p class="meta">Measured ${escape(h.measured)} with Horizon ${escape(h.version)}. The full table is under <a href="#measured">Measured by us</a>.</p>` : ""
|
||||
}`;
|
||||
return;
|
||||
}
|
||||
const h = estimate(groups, gpu, cpu, rd, "horizon");
|
||||
const j = estimate(groups, gpu, cpu, rd, "vanilla");
|
||||
if (!h && !j) {
|
||||
out.innerHTML = `<p class="empty">Nothing measured at render distance ${rd} to estimate from yet.</p>`;
|
||||
return;
|
||||
}
|
||||
const base = (h || j).base;
|
||||
const f = (h || j).factors;
|
||||
const times = (x) => `${x >= 1 ? x.toFixed(x >= 10 ? 0 : 1) : x.toFixed(2)}x`;
|
||||
out.innerHTML = `<p class="pick-head"><span class="badge badge-estimate">Estimate</span> From ${escape(base.source === "us" ? base.machine : `${base.gpu} with ${base.cpu}`)} (${escape(base.gpu)}, ${escape(base.cpu)}): GPU factor ${times(f.gpu)}, CPU factor ${times(f.cpu)}. <a href="#method">How</a></p>${estimateTable(h, j)}<p class="meta">Ranges, not measurements: the real figure depends on drivers, the graphics API and cooling too. Memory is the measured machine's.</p>`;
|
||||
}
|
||||
|
||||
setUpTheme();
|
||||
setUpMenu();
|
||||
picker.addEventListener("change", render);
|
||||
render();
|
||||
live();
|
||||
@@ -0,0 +1,99 @@
|
||||
<!doctype html>
|
||||
<html lang="en" class="no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<title>Benchmarks: Horizon against Java Edition · Horizon</title>
|
||||
<meta name="description" content="Horizon and vanilla Minecraft: Java Edition 26.3 measured on the same machines, world and camera path: frame rate, 1% lows, frame times, load times and memory. Pick a GPU and a CPU to see what to expect.">
|
||||
<meta name="theme-color" content="#ece7f7" media="(prefers-color-scheme: light)">
|
||||
<meta name="theme-color" content="#0f0d17" media="(prefers-color-scheme: dark)">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<link rel="canonical" href="https://playhorizon.dev/benchmarks">
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="/favicon-32.png" sizes="32x32" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:site_name" content="Horizon">
|
||||
<meta property="og:title" content="Benchmarks · Horizon">
|
||||
<meta property="og:description" content="Horizon against vanilla Java Edition 26.3, measured on the same machines.">
|
||||
<meta property="og:url" content="https://playhorizon.dev/benchmarks">
|
||||
<meta property="og:image" content="https://playhorizon.dev/og.png">
|
||||
<style>{{STYLE}}</style>
|
||||
<script>document.documentElement.classList.replace("no-js", "js"); try { const t = localStorage.getItem("theme"); if (t === "light" || t === "dark") document.documentElement.dataset.theme = t } catch {}</script>
|
||||
<script type="module" src="{{BENCH_JS}}"></script>
|
||||
</head>
|
||||
<body class="subpage">
|
||||
<a class="skip" href="#main">Skip to the content</a>
|
||||
{{SITE_NAV}}
|
||||
<main id="main" class="section page-main">
|
||||
<div class="container">
|
||||
<p class="kicker"><span>Benchmarks</span>Horizon against Java Edition 26.3</p>
|
||||
<h1 class="display page-title">Same machine, same world, same flight.</h1>
|
||||
<p class="lede">We run Horizon and vanilla Minecraft: Java Edition 26.3 one after the other on the same computer: a fresh world from the same seed, the same settings, and the same four flights over a village, a forest, the ocean and a mountain. Every figure comes from the same code for both games. Where Java does better, the tables say so.</p>
|
||||
|
||||
<section class="bench-section" id="measured" aria-labelledby="measured-title">
|
||||
<h2 class="title" id="measured-title">Measured by us</h2>
|
||||
<p class="lede">The project's own machines, at render distance 12 (vanilla's default) and 32. VSync off, no frame cap, a 1280x720 window, simulation distance 12, everything else at vanilla's defaults. Each figure is the median over the runs; the frame figures are averaged over the four flights.</p>
|
||||
<div class="machines">
|
||||
{{MACHINES}}
|
||||
</div>
|
||||
<div class="older-runs prose">
|
||||
<p><strong>Not yet measured against Java: the desktop (RTX 4080, Core i7-13700KF).</strong> It is in daily use; the comparison runs on it once it is free. The last figures from it are Horizon alone, from an older build (2026-10-13, offscreen, <code>tools/graphics_bench.py</code>): over the village, 2,409 FPS at render distance 8, 1,041 at 16 and 48 at 32, where that build still stuttered while loading. They are not comparable with the tables above; the picker estimates the RTX 4080 from the measured machines instead.</p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="bench-section" id="your-hardware" aria-labelledby="pick-title">
|
||||
<h2 class="title" id="pick-title">Your hardware</h2>
|
||||
<p class="lede">Pick a graphics card and a processor. If we or at least three players have measured that pair, you see what was measured; otherwise an estimate from the nearest measured machine, as a range.</p>
|
||||
<form class="picker" id="picker" aria-describedby="pick-title">
|
||||
<label><span>Graphics card</span><select name="gpu" id="pick-gpu">{{GPU_OPTIONS}}</select></label>
|
||||
<label><span>Processor</span><select name="cpu" id="pick-cpu">{{CPU_OPTIONS}}</select></label>
|
||||
<fieldset class="picker-rd"><legend>Render distance</legend>
|
||||
<label><input type="radio" name="rd" value="12" checked> 12</label>
|
||||
<label><input type="radio" name="rd" value="32"> 32</label>
|
||||
</fieldset>
|
||||
</form>
|
||||
<div class="pick-result" id="pick-result" aria-live="polite"><p class="empty">The picker needs JavaScript; the tables above and the method below work without it.</p></div>
|
||||
</section>
|
||||
|
||||
<section class="bench-section" id="players" aria-labelledby="players-title">
|
||||
<h2 class="title" id="players-title">From players</h2>
|
||||
<p class="lede">Players who allow benchmark uploads in the launcher's data collection settings share the report of <code>horizon-client --benchmark standard</code>. Results are grouped by graphics card, processor and render distance, and a group shows only once <strong>at least 3 different installs</strong> are in it, so no one can be picked out. Only medians are published: no install ID, date, driver, memory size or screen.</p>
|
||||
<p class="meta" data-players-source>{{PLAYERS_SOURCE}}</p>
|
||||
<div id="players-table">
|
||||
{{PLAYERS}}
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="bench-section prose-section" id="method" aria-labelledby="method-title">
|
||||
<h2 class="title" id="method-title">How the estimates work</h2>
|
||||
<div class="prose">
|
||||
<p>An estimate starts from the measured machine closest to the one you picked, then scales its figures with a small table of specifications we wrote ourselves (no benchmark database):</p>
|
||||
<ul>
|
||||
<li><strong>GPU factor</strong>: the geometric mean of the two graphics cards' ratio of FP32 shader throughput (TFLOPS) and of memory bandwidth (GB/s), as their makers state them.</li>
|
||||
<li><strong>CPU factor</strong>: the ratio of the two processors' single-thread scores: top boost clock times a rough factor per chip generation (Zen 4 = 1).</li>
|
||||
<li><strong>Frame rate</strong>: when the measured run split each frame into CPU and GPU time, the slower side is scaled by its factor; otherwise by the geometric mean of both. Whatever the split, the real figure lies between the measured one scaled by the smaller and by the larger factor; we widen that by 15% for the roughness of the table, and show it as the range.</li>
|
||||
<li><strong>Load times</strong> are CPU work (generating, lighting and meshing chunks), scaled by the CPU factor. <strong>Memory</strong> is not scaled: it follows the world and the settings, not the speed.</li>
|
||||
</ul>
|
||||
<p>Estimates ignore drivers, the graphics API, thermal limits and the operating system, which can matter as much as the chip. Treat them as a rough idea, and run <code>horizon-client --benchmark standard</code> on your own machine for the real figure.</p>
|
||||
</div>
|
||||
<details class="spec-table">
|
||||
<summary>The specification table</summary>
|
||||
<div class="table-wrap">{{SPEC_TABLE}}</div>
|
||||
</details>
|
||||
</section>
|
||||
|
||||
<section class="bench-section prose-section" id="how" aria-labelledby="how-title">
|
||||
<h2 class="title" id="how-title">How we measure</h2>
|
||||
<div class="prose">
|
||||
<p><code>tools/perf_bench.py</code> starts each game from a fresh world (seed 1234, creative), waits until every chunk around the spawn is loaded and drawn, then for each scene teleports, waits for the chunks, holds for 2 seconds and flies a straight 192-block path in 12 seconds. Every frame is recorded. Vanilla runs as players get it (your own client, the official launcher's Java options, Java 25), driven by a small development-only mod that only calls the game's own code; nothing of Minecraft is shipped. The full method and its caveats are in <a href="https://github.com/ludovic111/horizon/blob/main/docs/benchmark.md">docs/benchmark.md</a>, and every raw report is in the repository.</p>
|
||||
<p>Measure your own computer with <code>horizon-client --benchmark standard --render-distance 12</code>: it writes a report to the <code>benchmarks</code> folder of the game folder.</p>
|
||||
</div>
|
||||
</section>
|
||||
<p class="disclaimer">Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.</p>
|
||||
</div>
|
||||
</main>
|
||||
{{SITE_FOOTER}}
|
||||
<script type="application/json" id="bench-data">{{BENCH_DATA}}</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,90 @@
|
||||
// What every page with the site's top bar shares: the light and dark switch and the phone menu.
|
||||
// Used by main.js (the home page) and page.js (Releases, Benchmarks).
|
||||
const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
|
||||
// The page follows the system; the toggle picks the other appearance and remembers it.
|
||||
export function setUpTheme() {
|
||||
const root = document.documentElement;
|
||||
const button = document.querySelector(".theme-toggle");
|
||||
if (!button) return;
|
||||
const label = button.querySelector("[data-theme-label]");
|
||||
const system = matchMedia("(prefers-color-scheme: dark)");
|
||||
const dark = () => (root.dataset.theme ? root.dataset.theme === "dark" : system.matches);
|
||||
const show = () => (label.textContent = dark() ? "Light" : "Dark");
|
||||
button.addEventListener("click", () => {
|
||||
root.dataset.theme = dark() ? "light" : "dark";
|
||||
try {
|
||||
localStorage.setItem("theme", root.dataset.theme);
|
||||
} catch {}
|
||||
show();
|
||||
});
|
||||
system.addEventListener("change", show);
|
||||
show();
|
||||
}
|
||||
|
||||
// The phone menu: a full-screen sheet; the page behind it is inert while it is open.
|
||||
export function setUpMenu() {
|
||||
const bar = document.querySelector(".nav");
|
||||
const button = document.querySelector(".menu-button");
|
||||
const menu = document.getElementById("menu");
|
||||
const main = document.getElementById("main");
|
||||
if (!bar || !button || !menu) return;
|
||||
const label = button.querySelector(".menu-label");
|
||||
const items = [...menu.querySelectorAll("nav a")];
|
||||
items.forEach((a, i) => a.style.setProperty("transition-delay", `${60 + i * 35}ms`));
|
||||
let closing;
|
||||
const setOpen = (open) => {
|
||||
clearTimeout(closing);
|
||||
button.setAttribute("aria-expanded", String(open));
|
||||
label.textContent = open ? "Close" : "Menu";
|
||||
bar.classList.toggle("is-menu", open);
|
||||
main.inert = open;
|
||||
document.body.style.overflow = open ? "hidden" : "";
|
||||
if (open) {
|
||||
menu.hidden = false;
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => menu.classList.add("is-open")));
|
||||
items[0].focus({ preventScroll: true });
|
||||
} else {
|
||||
menu.classList.remove("is-open");
|
||||
closing = setTimeout(() => (menu.hidden = true), reducedMotion ? 0 : 320);
|
||||
}
|
||||
};
|
||||
button.addEventListener("click", () => setOpen(button.getAttribute("aria-expanded") !== "true"));
|
||||
items.forEach((a) => a.addEventListener("click", () => setOpen(false)));
|
||||
addEventListener("keydown", (e) => {
|
||||
if (e.key === "Escape" && button.getAttribute("aria-expanded") === "true") {
|
||||
setOpen(false);
|
||||
button.focus();
|
||||
}
|
||||
});
|
||||
matchMedia("(min-width: 1120px)").addEventListener("change", (e) => e.matches && setOpen(false));
|
||||
}
|
||||
|
||||
// GitHub answers, cached for ten minutes in the tab.
|
||||
export async function cached(key, load) {
|
||||
try {
|
||||
const hit = JSON.parse(sessionStorage.getItem(key) || "null");
|
||||
if (hit && Date.now() - hit.at < 10 * 60 * 1000) return hit.value;
|
||||
} catch {}
|
||||
const value = await load();
|
||||
try {
|
||||
sessionStorage.setItem(key, JSON.stringify({ at: Date.now(), value }));
|
||||
} catch {}
|
||||
return value;
|
||||
}
|
||||
|
||||
export async function get(url, as = "json") {
|
||||
const res = await fetch(url, { headers: as === "json" ? { Accept: "application/vnd.github+json" } : {} });
|
||||
if (!res.ok) throw new Error(`${res.status}`);
|
||||
return as === "json" ? res.json() : res.text();
|
||||
}
|
||||
|
||||
export const slim = (r) => ({
|
||||
tag_name: r.tag_name,
|
||||
name: r.name,
|
||||
published_at: r.published_at,
|
||||
html_url: r.html_url,
|
||||
prerelease: r.prerelease,
|
||||
body: r.body || "",
|
||||
assets: (r.assets || []).map((a) => ({ name: a.name, browser_download_url: a.browser_download_url, size: a.size })),
|
||||
});
|
||||
@@ -0,0 +1,77 @@
|
||||
// Estimates for hardware nobody has measured yet, from the nearest measured machine and the spec table
|
||||
// (src/hardware.js). The method, which the Benchmarks page explains:
|
||||
//
|
||||
// - GPU factor: the geometric mean of the two GPUs' FP32 throughput ratio and memory bandwidth ratio.
|
||||
// - CPU factor: the ratio of the two CPUs' single-thread scores (boost clock x generation factor).
|
||||
// - Frames: when the measured run split each frame into CPU and GPU time, the slower of the two is scaled by its
|
||||
// own factor; otherwise the frame rate is scaled by the geometric mean of both factors. Whatever the split, the
|
||||
// true figure lies between the measured one scaled by the smaller and by the larger factor, widened by 15% for
|
||||
// the roughness of the table: that is the range shown.
|
||||
// - World and chunk load times are CPU work (generation, lighting, meshing): scaled by the CPU factor.
|
||||
// - Memory is not scaled: it depends on the world and settings, not on speed.
|
||||
import { findCpu, findGpu, singleThread } from "./hardware.js";
|
||||
|
||||
const MARGIN = 0.15;
|
||||
|
||||
export function factors(fromGpu, fromCpu, toGpu, toCpu) {
|
||||
const gpu = Math.sqrt((toGpu.tflops / fromGpu.tflops) * (toGpu.gbps / fromGpu.gbps));
|
||||
const cpu = singleThread(toCpu) / singleThread(fromCpu);
|
||||
return { gpu, cpu };
|
||||
}
|
||||
|
||||
const distance = (f) => Math.abs(Math.log(f.gpu)) + Math.abs(Math.log(f.cpu));
|
||||
|
||||
// The rows (benchmarks.json groups) usable as a base: a known GPU and CPU.
|
||||
function known(rows) {
|
||||
return rows.map((row) => ({ row, gpu: findGpu(row.gpu), cpu: findCpu(row.cpu) })).filter((r) => r.gpu && r.cpu);
|
||||
}
|
||||
|
||||
// The measured row for exactly this GPU and CPU, players' first when there are some (more installs), or null.
|
||||
export function measured(rows, gpu, cpu, rd, game) {
|
||||
const hits = known(rows).filter((r) => r.gpu === gpu && r.cpu === cpu && r.row.render_distance === rd && r.row.game === game);
|
||||
hits.sort((a, b) => (b.row.installs || 0) - (a.row.installs || 0));
|
||||
return hits.map((r) => r.row);
|
||||
}
|
||||
|
||||
// The nearest measured machine for a target GPU and CPU, for one game and render distance.
|
||||
export function nearest(rows, gpu, cpu, rd, game) {
|
||||
let best = null;
|
||||
for (const r of known(rows)) {
|
||||
if (r.row.render_distance !== rd || r.row.game !== game) continue;
|
||||
const f = factors(r.gpu, r.cpu, gpu, cpu);
|
||||
const d = distance(f);
|
||||
if (!best || d < best.d) best = { ...r, f, d };
|
||||
}
|
||||
return best;
|
||||
}
|
||||
|
||||
export function estimate(rows, gpu, cpu, rd, game) {
|
||||
const base = nearest(rows, gpu, cpu, rd, game);
|
||||
if (!base) return null;
|
||||
const m = base.row.medians;
|
||||
const { gpu: g, cpu: c } = base.f;
|
||||
const lo = Math.min(g, c) * (1 - MARGIN);
|
||||
const hi = Math.max(g, c) * (1 + MARGIN);
|
||||
let scale = Math.sqrt(g * c);
|
||||
if (m.cpu_p50_ms && m.gpu_p50_ms) {
|
||||
const worst = Math.max(m.cpu_p50_ms, m.gpu_p50_ms);
|
||||
scale = worst / Math.max(m.cpu_p50_ms / c, m.gpu_p50_ms / g);
|
||||
}
|
||||
scale = Math.min(hi, Math.max(lo, scale));
|
||||
const fps = (x) => (x == null ? null : { value: x * scale, low: x * lo, high: x * hi });
|
||||
// A base held to its display's refresh rate gives only a floor for the average.
|
||||
const avg = fps(m.avg_fps);
|
||||
if (avg && base.row.capped_fps && m.avg_fps >= base.row.capped_fps * 0.97) Object.assign(avg, { value: null, high: null, atLeast: true });
|
||||
const time = (x, f) => (x == null ? null : { value: x / f, low: x / (f * (1 + MARGIN)), high: x / (f * (1 - MARGIN)) });
|
||||
return {
|
||||
base: base.row,
|
||||
factors: base.f,
|
||||
avg_fps: avg,
|
||||
low_1pct_fps: fps(m.low_1pct_fps),
|
||||
p95_ms: m.p95_ms == null ? null : { value: m.p95_ms / scale, low: m.p95_ms / hi, high: m.p95_ms / lo },
|
||||
world_ms: time(m.world_ms, c),
|
||||
chunk_load_ms: time(m.chunk_load_ms, c),
|
||||
rss_steady_mb: m.rss_steady_mb == null ? null : { value: m.rss_steady_mb },
|
||||
rss_peak_mb: m.rss_peak_mb == null ? null : { value: m.rss_peak_mb },
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// node --test website/src/ (npm test in website/)
|
||||
import { test } from "node:test";
|
||||
import assert from "node:assert/strict";
|
||||
import { estimate, factors, measured, nearest } from "./estimate.js";
|
||||
import { CPUS, GPUS, findCpu, findGpu } from "./hardware.js";
|
||||
|
||||
const row = (gpu, cpu, medians, extra = {}) => ({ gpu, cpu, render_distance: 12, game: "horizon", source: "us", medians, ...extra });
|
||||
const mac = row("Apple M4 Pro", "Apple M4 Pro", { avg_fps: 500, low_1pct_fps: 100, p95_ms: 3, world_ms: 4000, chunk_load_ms: 1000, rss_peak_mb: 1500, rss_steady_mb: 1200 });
|
||||
const laptop = row("Mesa Intel HD Graphics 620 (KBL GT2)", "Intel Core i7-7500U CPU @ 2.70GHz", { avg_fps: 100, low_1pct_fps: 20, p95_ms: 15, world_ms: 12000, chunk_load_ms: 5000, rss_peak_mb: 1400, rss_steady_mb: 1100, cpu_p50_ms: 4, gpu_p50_ms: 9 });
|
||||
|
||||
test("every reported name of our machines is in the table", () => {
|
||||
assert.equal(findGpu("Apple M4 Pro").name, "Apple M4 Pro (20-core GPU)");
|
||||
assert.equal(findGpu("Mesa Intel HD Graphics 620 (KBL GT2)").name, "Intel HD Graphics 620");
|
||||
assert.equal(findGpu("NVIDIA GeForce RTX 4080").name, "NVIDIA GeForce RTX 4080");
|
||||
assert.equal(findGpu("NVIDIA GeForce RTX 4080 SUPER"), null);
|
||||
assert.equal(findCpu("13th Gen Intel Core i7-13700KF").name, "Intel Core i7-13700K / KF");
|
||||
assert.equal(findCpu("Intel Core i7-7500U CPU @ 2.70GHz").name, "Intel Core i7-7500U");
|
||||
for (const g of GPUS) assert.equal(findGpu(g.name), g, g.name);
|
||||
for (const c of CPUS) assert.equal(findCpu(c.name), c, c.name);
|
||||
});
|
||||
|
||||
test("an exact match is a measurement, not an estimate", () => {
|
||||
assert.deepEqual(measured([mac, laptop], findGpu("Apple M4 Pro"), findCpu("Apple M4 Pro"), 12, "horizon"), [mac]);
|
||||
assert.deepEqual(measured([mac], findGpu("Apple M4 Pro"), findCpu("Apple M4 Pro"), 32, "horizon"), []);
|
||||
});
|
||||
|
||||
test("the nearest machine is the base, and the range holds the estimate", () => {
|
||||
const gpu = findGpu("Intel Iris Xe Graphics (96 EU)");
|
||||
const cpu = findCpu("Intel Core i5-1135G7");
|
||||
assert.equal(nearest([mac, laptop], gpu, cpu, 12, "horizon").row, laptop);
|
||||
const e = estimate([mac, laptop], gpu, cpu, 12, "horizon");
|
||||
const f = factors(findGpu(laptop.gpu), findCpu(laptop.cpu), gpu, cpu);
|
||||
assert.ok(f.gpu > 1 && f.cpu > 1);
|
||||
for (const key of ["avg_fps", "low_1pct_fps", "p95_ms", "world_ms", "chunk_load_ms"]) {
|
||||
const { value, low, high } = e[key];
|
||||
assert.ok(low <= value && value <= high, key);
|
||||
}
|
||||
// GPU-bound frames (9 ms GPU, 4 ms CPU) follow the GPU factor.
|
||||
assert.ok(Math.abs(e.avg_fps.value - 100 * Math.min(f.gpu, 9 / (4 / f.cpu))) < 1e-9);
|
||||
assert.ok(Math.abs(e.world_ms.value - 12000 / f.cpu) < 1e-9);
|
||||
assert.equal(e.rss_steady_mb.value, 1100);
|
||||
});
|
||||
|
||||
test("no base, no estimate", () => {
|
||||
assert.equal(estimate([mac], findGpu("Apple M4"), findCpu("Apple M4"), 32, "horizon"), null);
|
||||
assert.equal(estimate([mac], findGpu("Apple M4"), findCpu("Apple M4"), 12, "vanilla"), null);
|
||||
});
|
||||
|
||||
test("a base held to its display's refresh rate gives only a floor for the average", () => {
|
||||
const held = { ...mac, capped_fps: 144, medians: { ...mac.medians, avg_fps: 144 } };
|
||||
const e = estimate([held], findGpu("NVIDIA GeForce RTX 4060"), findCpu("AMD Ryzen 5 5600X"), 12, "horizon");
|
||||
assert.equal(e.avg_fps.atLeast, true);
|
||||
assert.equal(e.avg_fps.high, null);
|
||||
assert.ok(e.avg_fps.low > 0);
|
||||
// The lows sit under the cap: still a range.
|
||||
assert.ok(e.low_1pct_fps.high > e.low_1pct_fps.low);
|
||||
});
|
||||
|
||||
test("a release title of issue numbers falls back to its notes", async () => {
|
||||
const { parts } = await import("./releases.js");
|
||||
const r = { tag_name: "v2026.10.22.07", name: "Horizon 2026.10.22.07: #1255, mob pushes, fix, #1222", body: "### Fixed\n- Fix #1222: single player runs in the frame again (#1257, fixes #1222)\n- Mob pushes: one list per mob (#1205)\n" };
|
||||
assert.equal(parts(r).line, "Single player runs in the frame again and 1 more");
|
||||
assert.equal(parts({ ...r, name: "Horizon 2026.10.22.05: Hoppers, mob tick, server tick" }).line, "Hoppers, mob tick, server tick");
|
||||
});
|
||||
@@ -0,0 +1,73 @@
|
||||
// The hardware the Benchmarks page can estimate for, from specifications only (our own table, no benchmark
|
||||
// database): each GPU's FP32 shader throughput in TFLOPS and its memory bandwidth in GB/s as its maker states them,
|
||||
// and each CPU's single-thread score = its top boost clock (GHz) x our rough per-generation factor (instructions per
|
||||
// clock, Zen 4 = 1). The factors are round numbers, so estimates are ranges, and the page says so.
|
||||
// `match` finds a reported name (the GPU and CPU strings in benchmark reports) in this table.
|
||||
|
||||
export const GPUS = [
|
||||
{ name: "NVIDIA GeForce RTX 4090", tflops: 82.6, gbps: 1008, match: /RTX 4090/i },
|
||||
{ name: "NVIDIA GeForce RTX 4080", tflops: 48.7, gbps: 717, match: /RTX 4080(?! SUPER)/i },
|
||||
{ name: "NVIDIA GeForce RTX 4070 Ti", tflops: 40.1, gbps: 504, match: /RTX 4070 Ti/i },
|
||||
{ name: "NVIDIA GeForce RTX 4070", tflops: 29.1, gbps: 504, match: /RTX 4070(?! Ti)/i },
|
||||
{ name: "NVIDIA GeForce RTX 4060 Ti", tflops: 22.1, gbps: 288, match: /RTX 4060 Ti/i },
|
||||
{ name: "NVIDIA GeForce RTX 4060", tflops: 15.1, gbps: 272, match: /RTX 4060(?! Ti)/i },
|
||||
{ name: "NVIDIA GeForce RTX 3080", tflops: 29.8, gbps: 760, match: /RTX 3080(?! Ti)/i },
|
||||
{ name: "NVIDIA GeForce RTX 3070", tflops: 20.3, gbps: 448, match: /RTX 3070(?! Ti)/i },
|
||||
{ name: "NVIDIA GeForce RTX 3060", tflops: 12.7, gbps: 360, match: /RTX 3060(?! Ti)/i },
|
||||
{ name: "NVIDIA GeForce RTX 3050", tflops: 9.1, gbps: 224, match: /RTX 3050/i },
|
||||
{ name: "NVIDIA GeForce RTX 2060", tflops: 6.5, gbps: 336, match: /RTX 2060(?! SUPER)/i },
|
||||
{ name: "NVIDIA GeForce GTX 1660 SUPER", tflops: 5.0, gbps: 336, match: /GTX 1660 SUPER/i },
|
||||
{ name: "NVIDIA GeForce GTX 1060 6GB", tflops: 4.4, gbps: 192, match: /GTX 1060/i },
|
||||
{ name: "NVIDIA GeForce GTX 1050 Ti", tflops: 2.1, gbps: 112, match: /GTX 1050 Ti/i },
|
||||
{ name: "AMD Radeon RX 7900 XTX", tflops: 61.4, gbps: 960, match: /RX 7900 XTX/i },
|
||||
{ name: "AMD Radeon RX 7800 XT", tflops: 37.3, gbps: 624, match: /RX 7800 XT/i },
|
||||
{ name: "AMD Radeon RX 7600", tflops: 21.8, gbps: 288, match: /RX 7600(?! XT)/i },
|
||||
{ name: "AMD Radeon RX 6700 XT", tflops: 13.2, gbps: 384, match: /RX 6700 XT/i },
|
||||
{ name: "AMD Radeon RX 6600", tflops: 8.9, gbps: 224, match: /RX 6600(?! XT)/i },
|
||||
{ name: "AMD Radeon RX 580", tflops: 6.2, gbps: 256, match: /RX 580/i },
|
||||
{ name: "AMD Radeon 780M (integrated)", tflops: 8.6, gbps: 89, match: /780M/i },
|
||||
{ name: "Steam Deck (AMD Van Gogh)", tflops: 1.6, gbps: 88, match: /VanGogh|Van Gogh|Custom GPU 0405/i },
|
||||
{ name: "Intel Arc A770", tflops: 19.7, gbps: 560, match: /Arc.*A770/i },
|
||||
{ name: "Intel Iris Xe Graphics (96 EU)", tflops: 2.1, gbps: 68, match: /Iris\(?R?\)? Xe/i },
|
||||
{ name: "Intel HD Graphics 620", tflops: 0.4, gbps: 34, match: /\bU?HD Graphics 620\b/i },
|
||||
{ name: "Apple M1", tflops: 2.6, gbps: 68, match: /^Apple M1$/i },
|
||||
{ name: "Apple M2", tflops: 3.6, gbps: 100, match: /^Apple M2$/i },
|
||||
{ name: "Apple M3", tflops: 4.1, gbps: 100, match: /^Apple M3$/i },
|
||||
{ name: "Apple M4", tflops: 4.3, gbps: 120, match: /^Apple M4$/i },
|
||||
{ name: "Apple M1 Pro (16-core GPU)", tflops: 5.2, gbps: 200, match: /^Apple M1 Pro$/i },
|
||||
{ name: "Apple M4 Pro (20-core GPU)", tflops: 8.5, gbps: 273, match: /^Apple M4 Pro$/i },
|
||||
{ name: "Apple M4 Max (40-core GPU)", tflops: 17.0, gbps: 546, match: /^Apple M4 Max$/i },
|
||||
];
|
||||
|
||||
// ghz: top single-core boost clock; ipc: our per-generation factor (Zen 4 = 1).
|
||||
export const CPUS = [
|
||||
{ name: "Intel Core i7-7500U", ghz: 3.5, ipc: 0.62, match: /i7-7500U/i },
|
||||
{ name: "Intel Core i5-7200U", ghz: 3.1, ipc: 0.62, match: /i5-7200U/i },
|
||||
{ name: "Intel Core i5-8250U", ghz: 3.4, ipc: 0.62, match: /i5-8250U/i },
|
||||
{ name: "Intel Core i5-9400F", ghz: 4.1, ipc: 0.62, match: /i5-9400/i },
|
||||
{ name: "Intel Core i7-9700K", ghz: 4.9, ipc: 0.62, match: /i7-9700K/i },
|
||||
{ name: "Intel Core i5-10400", ghz: 4.3, ipc: 0.62, match: /i5-10400/i },
|
||||
{ name: "Intel Core i5-1135G7", ghz: 4.2, ipc: 0.78, match: /i5-1135G7/i },
|
||||
{ name: "Intel Core i5-12400", ghz: 4.4, ipc: 0.95, match: /i5-12400/i },
|
||||
{ name: "Intel Core i5-13600K", ghz: 5.1, ipc: 0.95, match: /i5-13600K/i },
|
||||
{ name: "Intel Core i7-13700K / KF", ghz: 5.4, ipc: 0.95, match: /i7-13700K/i },
|
||||
{ name: "Intel Core i9-14900K", ghz: 6.0, ipc: 0.95, match: /i9-14900K/i },
|
||||
{ name: "AMD Ryzen 5 3600", ghz: 4.2, ipc: 0.72, match: /Ryzen 5 3600/i },
|
||||
{ name: "AMD Ryzen 5 5600X", ghz: 4.6, ipc: 0.88, match: /Ryzen 5 5600X?\b/i },
|
||||
{ name: "AMD Ryzen 7 5800X3D", ghz: 4.5, ipc: 0.88, match: /5800X3D/i },
|
||||
{ name: "AMD Ryzen 5 7600X", ghz: 5.3, ipc: 1.0, match: /Ryzen 5 7600/i },
|
||||
{ name: "AMD Ryzen 7 7800X3D", ghz: 5.0, ipc: 1.0, match: /7800X3D/i },
|
||||
{ name: "AMD Ryzen 9 7950X", ghz: 5.7, ipc: 1.0, match: /Ryzen 9 7950X(?!3D)/i },
|
||||
{ name: "AMD Ryzen 7 9700X", ghz: 5.5, ipc: 1.12, match: /Ryzen 7 9700X/i },
|
||||
{ name: "AMD Ryzen 7 7840U / HS", ghz: 5.1, ipc: 1.0, match: /7840(U|HS)/i },
|
||||
{ name: "Steam Deck (AMD Zen 2, 4 cores)", ghz: 3.5, ipc: 0.72, match: /AMD Custom APU 0405|Van ?Gogh/i },
|
||||
{ name: "Apple M1", ghz: 3.2, ipc: 1.25, match: /^Apple M1$/i },
|
||||
{ name: "Apple M2", ghz: 3.5, ipc: 1.28, match: /^Apple M2$/i },
|
||||
{ name: "Apple M3", ghz: 4.05, ipc: 1.38, match: /^Apple M3$/i },
|
||||
{ name: "Apple M4", ghz: 4.4, ipc: 1.5, match: /^Apple M4$/i },
|
||||
{ name: "Apple M4 Pro", ghz: 4.5, ipc: 1.5, match: /^Apple M4 Pro$/i },
|
||||
];
|
||||
|
||||
export const singleThread = (cpu) => cpu.ghz * cpu.ipc;
|
||||
export const findGpu = (name) => GPUS.find((g) => g.name === name || g.match.test(name || "")) || null;
|
||||
export const findCpu = (name) => CPUS.find((c) => c.name === name || c.match.test(name || "")) || null;
|
||||
+14
-10
@@ -43,9 +43,10 @@
|
||||
<a href="#screenshots">In game</a>
|
||||
<a href="#parity">Parity</a>
|
||||
<a href="#launcher">Launcher</a>
|
||||
<a href="#patch-notes">Notes</a>
|
||||
<a href="#recent">New</a>
|
||||
<a href="#community">Community</a>
|
||||
<a href="#contributors" data-contributors{{CONTRIBUTORS_HIDDEN}}>Contributors</a>
|
||||
<a href="/releases">Releases</a>
|
||||
<a href="/benchmarks">Benchmarks</a>
|
||||
<a href="/docs/">Docs</a>
|
||||
</nav>
|
||||
<div class="nav-end">
|
||||
@@ -63,9 +64,11 @@
|
||||
<a href="#screenshots">In game</a>
|
||||
<a href="#parity">Parity</a>
|
||||
<a href="#launcher">Launcher</a>
|
||||
<a href="#patch-notes">Patch notes</a>
|
||||
<a href="#recent">Recently added</a>
|
||||
<a href="#community">Community</a>
|
||||
<a href="#contributors" data-contributors{{CONTRIBUTORS_HIDDEN}}>Contributors</a>
|
||||
<a href="/releases">Releases</a>
|
||||
<a href="/benchmarks">Benchmarks</a>
|
||||
<a href="/docs/">Documentation</a>
|
||||
</nav>
|
||||
<div class="menu-foot">
|
||||
@@ -92,7 +95,7 @@
|
||||
<li class="row reveal"><a href="#parity"><span class="row-index">01</span><span class="row-name">Matches vanilla</span><span class="row-meta">{{PERCENT}}</span></a></li>
|
||||
<li class="row reveal"><a href="#parity"><span class="row-index">02</span><span class="row-name">Differential harnesses</span><span class="row-meta">{{HARNESSES}}</span></a></li>
|
||||
<li class="row reveal"><a href="#screenshots"><span class="row-index">03</span><span class="row-name">Drawn by Horizon</span><span class="row-meta">5 shots</span></a></li>
|
||||
<li class="row reveal"><a href="#patch-notes"><span class="row-index">04</span><span class="row-name">What changed</span><span class="row-meta">Notes</span></a></li>
|
||||
<li class="row reveal"><a href="#recent"><span class="row-index">04</span><span class="row-name">Recently added</span><span class="row-meta">Releases</span></a></li>
|
||||
</ol>
|
||||
<p class="disclaimer reveal">Unofficial. Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.</p>
|
||||
</div>
|
||||
@@ -193,14 +196,15 @@
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section id="patch-notes" class="section notes" aria-labelledby="notes-title">
|
||||
<section id="recent" class="section notes" aria-labelledby="recent-title">
|
||||
<div class="container">
|
||||
<div class="section-head">
|
||||
<p class="kicker reveal"><span>05</span>Patch notes</p>
|
||||
<h2 id="notes-title" class="title reveal">What changed</h2>
|
||||
<p class="kicker reveal"><span>05</span>Releases</p>
|
||||
<h2 id="recent-title" class="title reveal">Recently added</h2>
|
||||
<p class="lede reveal">Alpha builds come out many times a day, as changes land; about once a day the tested ones become Stable, the launcher's default. The newest, and what they added:</p>
|
||||
</div>
|
||||
<div class="releases reveal" id="releases" aria-live="polite">
|
||||
{{NOTES}}
|
||||
<div class="recent reveal" id="recent-releases" aria-live="polite">
|
||||
{{RECENT}}
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
@@ -233,7 +237,7 @@
|
||||
</div>
|
||||
<div class="footer-bar">
|
||||
<span class="footer-mark">Made in the open, in Rust.</span>
|
||||
<nav class="footer-links" aria-label="Elsewhere"><a href="https://github.com/ludovic111/horizon">GitHub</a><a href="https://github.com/ludovic111/horizon/releases">Releases</a><a href="https://github.com/ludovic111/horizon/blob/main/LICENSE">Licence</a><a href="/docs/">Docs</a><a href="/docs/hosting">Host a server</a><a href="/LEGAL.md">Assets</a><a href="/privacy">Privacy</a></nav>
|
||||
<nav class="footer-links" aria-label="Elsewhere"><a href="https://github.com/ludovic111/horizon">GitHub</a><a href="/releases">Releases</a><a href="/benchmarks">Benchmarks</a><a href="https://github.com/ludovic111/horizon/blob/main/LICENSE">Licence</a><a href="/docs/">Docs</a><a href="/docs/hosting">Host a server</a><a href="/LEGAL.md">Assets</a><a href="/privacy">Privacy</a></nav>
|
||||
</div>
|
||||
</div>
|
||||
<p class="footer-word" aria-hidden="true">horizon</p>
|
||||
|
||||
+9
-88
@@ -2,9 +2,10 @@
|
||||
// links and contributors, the navigation, the menus' tabs, the lightbox and the motion.
|
||||
// Everything degrades to the baked-in content when GitHub can't be reached.
|
||||
import { escape } from "./markdown.js";
|
||||
import { releasesHtml } from "./releases.js";
|
||||
import { recentHtml } from "./releases.js";
|
||||
import { contributorsFrom, contributorsHtml } from "./contributors.js";
|
||||
import { isGame, isLauncher as isLauncherTag, launcherVersion, newestFirst } from "./versions.js";
|
||||
import { cached, get, setUpMenu, setUpTheme, slim } from "./chrome.js";
|
||||
|
||||
const REPO = "ludovic111/horizon";
|
||||
const RELEASES_PAGE = `https://github.com/${REPO}/releases?q=launcher&expanded=true`;
|
||||
@@ -13,33 +14,6 @@ const reducedMotion = matchMedia("(prefers-reduced-motion: reduce)").matches;
|
||||
|
||||
// --- GitHub --------------------------------------------------------------------------
|
||||
|
||||
async function cached(key, load) {
|
||||
try {
|
||||
const hit = JSON.parse(sessionStorage.getItem(key) || "null");
|
||||
if (hit && Date.now() - hit.at < 10 * 60 * 1000) return hit.value;
|
||||
} catch {}
|
||||
const value = await load();
|
||||
try {
|
||||
sessionStorage.setItem(key, JSON.stringify({ at: Date.now(), value }));
|
||||
} catch {}
|
||||
return value;
|
||||
}
|
||||
|
||||
async function get(url, as = "json") {
|
||||
const res = await fetch(url, { headers: as === "json" ? { Accept: "application/vnd.github+json" } : {} });
|
||||
if (!res.ok) throw new Error(`${res.status}`);
|
||||
return as === "json" ? res.json() : res.text();
|
||||
}
|
||||
|
||||
const slim = (r) => ({
|
||||
tag_name: r.tag_name,
|
||||
name: r.name,
|
||||
published_at: r.published_at,
|
||||
html_url: r.html_url,
|
||||
prerelease: r.prerelease,
|
||||
body: r.body || "",
|
||||
assets: r.assets.map((a) => ({ name: a.name, browser_download_url: a.browser_download_url, size: a.size })),
|
||||
});
|
||||
const isLauncher = (r) => isLauncherTag(r.tag_name) && !r.prerelease;
|
||||
|
||||
// The newest 100 releases (GitHub's most per page). Game betas come out several times a day, so the stable game
|
||||
@@ -106,11 +80,12 @@ async function setUpDownload() {
|
||||
document.querySelectorAll("[data-download-meta]").forEach((p) => (p.innerHTML = meta));
|
||||
}
|
||||
|
||||
// --- Patch notes and the links from main ---------------------------------
|
||||
// --- Recently added and the links from main ---------------------------------
|
||||
|
||||
async function setUpNotes() {
|
||||
const list = (await releases).filter((r) => isGame(r.tag_name) && !r.prerelease).sort((a, b) => newestFirst(a.tag_name, b.tag_name));
|
||||
if (list.length) document.getElementById("releases").innerHTML = releasesHtml(list.slice(0, 3));
|
||||
// "Recently added": the newest game releases, Alpha and Stable.
|
||||
async function setUpRecent() {
|
||||
const html = recentHtml((await releases).filter((r) => isGame(r.tag_name)));
|
||||
if (html) document.getElementById("recent-releases").innerHTML = html;
|
||||
}
|
||||
|
||||
async function setUpLinks() {
|
||||
@@ -151,40 +126,6 @@ function setUpNav() {
|
||||
};
|
||||
onScroll(update);
|
||||
update();
|
||||
|
||||
// The phone menu: a full-screen sheet; the page behind it is inert while it is open.
|
||||
const button = document.querySelector(".menu-button");
|
||||
const menu = document.getElementById("menu");
|
||||
const main = document.getElementById("main");
|
||||
const label = button.querySelector(".menu-label");
|
||||
const items = [...menu.querySelectorAll("nav a")];
|
||||
items.forEach((a, i) => a.style.setProperty("transition-delay", `${60 + i * 35}ms`));
|
||||
let closing;
|
||||
const setOpen = (open) => {
|
||||
clearTimeout(closing);
|
||||
button.setAttribute("aria-expanded", String(open));
|
||||
label.textContent = open ? "Close" : "Menu";
|
||||
bar.classList.toggle("is-menu", open);
|
||||
main.inert = open;
|
||||
document.body.style.overflow = open ? "hidden" : "";
|
||||
if (open) {
|
||||
menu.hidden = false;
|
||||
requestAnimationFrame(() => requestAnimationFrame(() => menu.classList.add("is-open")));
|
||||
items[0].focus({ preventScroll: true });
|
||||
} else {
|
||||
menu.classList.remove("is-open");
|
||||
closing = setTimeout(() => (menu.hidden = true), reducedMotion ? 0 : 320);
|
||||
}
|
||||
};
|
||||
button.addEventListener("click", () => setOpen(button.getAttribute("aria-expanded") !== "true"));
|
||||
items.forEach((a) => a.addEventListener("click", () => setOpen(false)));
|
||||
addEventListener("keydown", (e) => {
|
||||
if (e.key === "Escape" && button.getAttribute("aria-expanded") === "true") {
|
||||
setOpen(false);
|
||||
button.focus();
|
||||
}
|
||||
});
|
||||
matchMedia("(min-width: 1120px)").addEventListener("change", (e) => e.matches && setOpen(false));
|
||||
}
|
||||
|
||||
// One rAF-throttled scroll listener for everything that follows the scroll.
|
||||
@@ -254,27 +195,6 @@ function setUpLightbox() {
|
||||
});
|
||||
}
|
||||
|
||||
// --- Light and dark ------------------------------------------------------------------
|
||||
|
||||
// The page follows the system; the toggle picks the other appearance and remembers it.
|
||||
function setUpTheme() {
|
||||
const root = document.documentElement;
|
||||
const button = document.querySelector(".theme-toggle");
|
||||
const label = button.querySelector("[data-theme-label]");
|
||||
const system = matchMedia("(prefers-color-scheme: dark)");
|
||||
const dark = () => (root.dataset.theme ? root.dataset.theme === "dark" : system.matches);
|
||||
const show = () => (label.textContent = dark() ? "Light" : "Dark");
|
||||
button.addEventListener("click", () => {
|
||||
root.dataset.theme = dark() ? "light" : "dark";
|
||||
try {
|
||||
localStorage.setItem("theme", root.dataset.theme);
|
||||
} catch {}
|
||||
show();
|
||||
});
|
||||
system.addEventListener("change", show);
|
||||
show();
|
||||
}
|
||||
|
||||
// --- Motion ---------------------------------------------------------------------------
|
||||
|
||||
function setUpReveal() {
|
||||
@@ -308,9 +228,10 @@ function setUpReveal() {
|
||||
setUpReveal();
|
||||
setUpTheme();
|
||||
setUpNav();
|
||||
setUpMenu();
|
||||
setUpTabs();
|
||||
setUpLightbox();
|
||||
setUpDownload();
|
||||
setUpNotes();
|
||||
setUpRecent();
|
||||
setUpLinks();
|
||||
setUpContributors();
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
// The Releases page: the list baked at build time, refreshed from GitHub when a newer release is out, and the
|
||||
// channel filter. Without JavaScript the baked list reads as it is.
|
||||
import { releasesPageHtml } from "./releases.js";
|
||||
import { isGame, isLauncher, newestFirst } from "./versions.js";
|
||||
import { cached, get, setUpMenu, setUpTheme, slim } from "./chrome.js";
|
||||
|
||||
const REPO = "ludovic111/horizon";
|
||||
const list = document.getElementById("release-list");
|
||||
const counter = document.querySelector("[data-release-count]");
|
||||
const buttons = [...document.querySelectorAll("[data-filter]")];
|
||||
let filter = "all";
|
||||
|
||||
const ours = (r) => !r.draft && (isGame(r.tag_name) || isLauncher(r.tag_name));
|
||||
|
||||
// Every release, a page of 100 at a time (GitHub's most), up to 500.
|
||||
async function loadAll() {
|
||||
const all = [];
|
||||
for (let page = 1; page <= 5; page++) {
|
||||
const batch = await get(`https://api.github.com/repos/${REPO}/releases?per_page=100&page=${page}`);
|
||||
all.push(...batch.filter(ours).map(slim));
|
||||
if (batch.length < 100) break;
|
||||
}
|
||||
return all;
|
||||
}
|
||||
|
||||
function apply() {
|
||||
const entries = [...list.querySelectorAll(".release-entry")];
|
||||
let shown = 0;
|
||||
for (const el of entries) {
|
||||
const on = filter === "all" || el.dataset.channel === filter;
|
||||
el.hidden = !on;
|
||||
if (on) shown++;
|
||||
}
|
||||
counter.textContent = `${shown} release${shown === 1 ? "" : "s"}`;
|
||||
buttons.forEach((b) => b.setAttribute("aria-pressed", String(b.dataset.filter === filter)));
|
||||
}
|
||||
|
||||
async function refresh() {
|
||||
// One small request first: the full list only when GitHub has something newer than the page.
|
||||
const newest = await cached("horizon:releases-newest", () => get(`https://api.github.com/repos/${REPO}/releases?per_page=5`)).catch(() => null);
|
||||
if (!newest) return;
|
||||
const top = newest.filter(ours).map((r) => r.tag_name).sort(newestFirst)[0];
|
||||
if (!top || top === list.dataset.newest) return;
|
||||
const all = await cached("horizon:releases-all", loadAll).catch(() => null);
|
||||
if (!all || !all.length) return;
|
||||
const open = new Set([...list.querySelectorAll(".release-entry[open]")].map((el) => el.id));
|
||||
list.innerHTML = releasesPageHtml(all);
|
||||
list.dataset.newest = top;
|
||||
// Keep what the reader opened open.
|
||||
open.forEach((id) => document.getElementById(id)?.setAttribute("open", ""));
|
||||
apply();
|
||||
}
|
||||
|
||||
// A link to one release (/releases#release-v0.2.1) opens it.
|
||||
function openTarget() {
|
||||
const el = location.hash && document.getElementById(location.hash.slice(1));
|
||||
if (el && el.classList.contains("release-entry")) {
|
||||
if (el.hidden) {
|
||||
filter = "all";
|
||||
apply();
|
||||
}
|
||||
el.open = true;
|
||||
el.scrollIntoView();
|
||||
}
|
||||
}
|
||||
|
||||
buttons.forEach((b) =>
|
||||
b.addEventListener("click", () => {
|
||||
filter = b.dataset.filter;
|
||||
apply();
|
||||
}),
|
||||
);
|
||||
addEventListener("hashchange", openTarget);
|
||||
setUpTheme();
|
||||
setUpMenu();
|
||||
apply();
|
||||
openTarget();
|
||||
refresh().then(openTarget);
|
||||
@@ -0,0 +1,50 @@
|
||||
<!doctype html>
|
||||
<html lang="en" class="no-js">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">
|
||||
<title>Releases · Horizon</title>
|
||||
<meta name="description" content="Every Horizon release, newest first: what each one adds and fixes, its full notes and its downloads. Alpha builds and Stable releases.">
|
||||
<meta name="theme-color" content="#ece7f7" media="(prefers-color-scheme: light)">
|
||||
<meta name="theme-color" content="#0f0d17" media="(prefers-color-scheme: dark)">
|
||||
<meta name="color-scheme" content="light dark">
|
||||
<link rel="canonical" href="https://playhorizon.dev/releases">
|
||||
<link rel="icon" href="/favicon.svg" type="image/svg+xml">
|
||||
<link rel="icon" href="/favicon-32.png" sizes="32x32" type="image/png">
|
||||
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:site_name" content="Horizon">
|
||||
<meta property="og:title" content="Releases · Horizon">
|
||||
<meta property="og:description" content="Every Horizon release, newest first, with what it adds and fixes.">
|
||||
<meta property="og:url" content="https://playhorizon.dev/releases">
|
||||
<meta property="og:image" content="https://playhorizon.dev/og.png">
|
||||
<link rel="preconnect" href="https://api.github.com" crossorigin>
|
||||
<style>{{STYLE}}</style>
|
||||
<script>document.documentElement.classList.replace("no-js", "js"); try { const t = localStorage.getItem("theme"); if (t === "light" || t === "dark") document.documentElement.dataset.theme = t } catch {}</script>
|
||||
<script type="module" src="{{RELEASES_JS}}"></script>
|
||||
</head>
|
||||
<body class="subpage">
|
||||
<a class="skip" href="#main">Skip to the content</a>
|
||||
{{SITE_NAV}}
|
||||
<main id="main" class="section page-main">
|
||||
<div class="container">
|
||||
<p class="kicker"><span>Releases</span>Every version, newest first</p>
|
||||
<h1 class="display page-title">What's new in Horizon</h1>
|
||||
<p class="lede">Each release lists what it adds and fixes, then its full notes and its downloads. <strong>Alpha</strong> builds come out many times a day as changes land and can break; about once a day the tested ones become <strong>Stable</strong>, what the launcher installs unless you pick Alpha in its Settings. The launcher has its own releases.</p>
|
||||
<div class="release-filter" role="group" aria-label="Show">
|
||||
<button type="button" class="button secondary small" data-filter="all" aria-pressed="true">All</button>
|
||||
<button type="button" class="button secondary small" data-filter="stable" aria-pressed="false">Stable</button>
|
||||
<button type="button" class="button secondary small" data-filter="alpha" aria-pressed="false">Alpha</button>
|
||||
<button type="button" class="button secondary small" data-filter="launcher" aria-pressed="false">Launcher</button>
|
||||
</div>
|
||||
<p class="meta release-count" data-release-count>{{RELEASE_COUNT}}</p>
|
||||
<div class="release-list" id="release-list" data-newest="{{NEWEST_TAG}}" aria-live="polite">
|
||||
{{RELEASE_LIST}}
|
||||
</div>
|
||||
<p class="release-more"><a class="link-arrow" href="https://github.com/ludovic111/horizon/releases">The releases on GitHub<span aria-hidden="true">→</span></a></p>
|
||||
<p class="disclaimer">Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.</p>
|
||||
</div>
|
||||
</main>
|
||||
{{SITE_FOOTER}}
|
||||
</body>
|
||||
</html>
|
||||
+141
-31
@@ -1,42 +1,152 @@
|
||||
// The patch notes: the latest game release in full, the ones before it folded. Shared by
|
||||
// build.mjs (baked into the page) and main.js (refreshed from GitHub).
|
||||
import { markdown, escape } from "./markdown.js";
|
||||
// The release notes on the site: the home page's "Recently added" block and the Releases page (every release,
|
||||
// newest first). Shared by build.mjs (baked into the pages) and the pages' scripts (refreshed from GitHub).
|
||||
// Tags: the game's vX.Y.Z and the launcher's launcher@X.Y.Z from 0.2, vYYYY.MM.DD[.N] and launcher-vX.Y.Z before
|
||||
// (src/versions.js). Alpha is a game pre-release, Stable a game release (docs/release-flow.md, "Channels").
|
||||
import { markdown, inline, escape } from "./markdown.js";
|
||||
import { isLauncher, launcherVersion, newestFirst } from "./versions.js";
|
||||
|
||||
const REPO = "ludovic111/horizon";
|
||||
|
||||
export const channel = (r) => (isLauncher(r.tag_name) ? "Launcher" : r.prerelease ? "Alpha" : "Stable");
|
||||
const anchor = (r) => `release-${r.tag_name.replace(/[^\w.-]/g, "-")}`;
|
||||
|
||||
// "Horizon 0.2.3: Cave culling, weather" (before 0.2, "Horizon 2026.10.13: …") reads as the version and its line.
|
||||
function parts(r) {
|
||||
const version = r.tag_name.replace(/^v/, "");
|
||||
const name = r.name || "";
|
||||
const line = name.includes(": ") ? name.slice(name.indexOf(": ") + 2) : name.replace(/^Horizon\s*/, "").replace(version, "").trim();
|
||||
export function parts(r) {
|
||||
const version = launcherVersion(r.tag_name) ?? r.tag_name.replace(/^v/, "");
|
||||
const name = (r.name || "").trim();
|
||||
let line = name.includes(": ") ? name.slice(name.indexOf(": ") + 2) : name.replace(/^Horizon( launcher)?\s*/i, "").replace(version, "").trim();
|
||||
if (junk(line)) line = fromNotes(r.body) || line;
|
||||
return { version, line: line.charAt(0).toUpperCase() + line.slice(1), date: (r.published_at || "").slice(0, 10) };
|
||||
}
|
||||
|
||||
export function releasesHtml(list) {
|
||||
if (!list.length) return "";
|
||||
const [latest, ...older] = list;
|
||||
const l = parts(latest);
|
||||
const head = `<article class="release-latest">
|
||||
<header class="release-head">
|
||||
<p class="eyebrow">Latest release<span aria-hidden="true"> · </span><time datetime="${l.date}">${l.date}</time></p>
|
||||
<h3 class="release-version">${escape(l.version)}</h3>
|
||||
${l.line ? `<p class="release-line">${escape(l.line)}</p>` : ""}
|
||||
<a class="link-arrow" href="${escape(latest.html_url)}">Downloads and full notes<span aria-hidden="true">→</span></a>
|
||||
</header>
|
||||
<div class="prose release-body">${markdown(latest.body || "")}</div>
|
||||
</article>`;
|
||||
const rest = older
|
||||
// A title made of issue numbers and "fix" ("#1255, mob pushes, fix, #1222") says nothing.
|
||||
const junk = (line) => {
|
||||
const bits = line.split(",").map((b) => b.trim()).filter(Boolean);
|
||||
return bits.length > 1 && bits.filter((b) => /^(#\d+|fix(es)?|fixed)$/i.test(b)).length * 2 >= bits.length;
|
||||
};
|
||||
|
||||
// The first item that isn't a bare "Fix #123:" prefix, as the line: "Mob pushes: one list per mob… and 3 more fixes".
|
||||
function fromNotes(body) {
|
||||
const s = sections(body);
|
||||
const items = [...s.filter((x) => /^new|what's new/i.test(x.title)), ...s.filter((x) => /^fixed/i.test(x.title))].flatMap((x) => x.items).map(plainItem);
|
||||
const clean = items.map((i) => i.replace(/^(fix|fixes)\s+#\d+:\s*/i, "").replace(/^\w+\([^)]*\):\s*/, "")).filter(Boolean);
|
||||
if (!clean.length) return "";
|
||||
const first = clean[0].replace(/[.]$/, "");
|
||||
return clean.length > 1 ? `${first} and ${clean.length - 1} more` : first;
|
||||
}
|
||||
|
||||
// The notes' "### Heading" sections and their top-level items, in order.
|
||||
export function sections(body) {
|
||||
const out = [];
|
||||
let current = null;
|
||||
for (const raw of (body || "").replace(/\r\n?/g, "\n").split("\n")) {
|
||||
const heading = raw.match(/^#{2,3}\s+(.+?)\s*$/);
|
||||
if (heading) out.push((current = { title: heading[1], items: [] }));
|
||||
else if (current && /^[-*]\s+/.test(raw)) current.items.push(raw.replace(/^[-*]\s+/, "").trim());
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
// An item without its pull request references: "Riptide (#123, fixes #45)" -> "Riptide".
|
||||
export const plainItem = (item) => item.replace(/\s*\((?:#\d+|fixes #\d+|[^()]*#\d+[^()]*)\)\s*/g, " ").replace(/\s+/g, " ").trim();
|
||||
|
||||
// The notes' first sentence, for a release with no title line and no sections ("Rebuilt from the latest main.").
|
||||
const firstLine = (body) => ((body || "").split(/\r?\n/).find((l) => l.trim() && !/^#/.test(l)) || "").trim().replace(/[.:]$/, "");
|
||||
|
||||
const count = (n, one, many) => `${n} ${n === 1 ? one : many}`;
|
||||
|
||||
// What a release changes, in a line: "12 new, 30 fixed, 2 known issues".
|
||||
export function overview(r) {
|
||||
const s = sections(r.body);
|
||||
const by = (re) => s.filter((x) => re.test(x.title)).reduce((n, x) => n + x.items.length, 0);
|
||||
const added = by(/^new|what's new/i);
|
||||
const fixed = by(/^fixed/i);
|
||||
const known = by(/^known/i);
|
||||
const bits = [];
|
||||
if (added) bits.push(count(added, "new feature", "new features"));
|
||||
if (fixed) bits.push(count(fixed, "fix", "fixes"));
|
||||
if (known) bits.push(count(known, "known issue", "known issues"));
|
||||
return { added, fixed, known, text: bits.join(", ") };
|
||||
}
|
||||
|
||||
export function highlights(r, n = 3) {
|
||||
const added = sections(r.body).filter((x) => /^new|what's new/i.test(x.title)).flatMap((x) => x.items);
|
||||
return added.slice(0, n).map(plainItem);
|
||||
}
|
||||
|
||||
const byTag = (a, b) => newestFirst(a.tag_name, b.tag_name);
|
||||
const badge = (r) => `<span class="badge badge-${channel(r).toLowerCase()}">${channel(r)}</span>`;
|
||||
|
||||
// The home page: the newest releases on a line each, and what the newest ones added.
|
||||
export function recentHtml(list, { rows = 5, picks = 3 } = {}) {
|
||||
const sorted = [...list].sort(byTag);
|
||||
const game = sorted.filter((r) => !isLauncher(r.tag_name));
|
||||
if (!game.length) return "";
|
||||
const lines = game
|
||||
.slice(0, rows)
|
||||
.map((r) => {
|
||||
const o = parts(r);
|
||||
return `<details class="release">
|
||||
<summary><span class="release-tag">${escape(o.version)}</span><span class="release-sub">${escape(o.line)}</span><time datetime="${o.date}">${o.date}</time></summary>
|
||||
<div class="prose">${markdown(r.body || "")}<p><a href="${escape(r.html_url)}">Downloads and full notes on GitHub</a></p></div>
|
||||
</details>`;
|
||||
const p = parts(r);
|
||||
return `<li class="row recent-row"><a href="/releases#${anchor(r)}"><span class="row-index"><time datetime="${p.date}">${p.date}</time></span><span class="row-name">${escape(p.version)}</span><span class="recent-line">${escape(p.line || overview(r).text || firstLine(r.body) || "Release notes")}</span><span class="row-meta">${badge(r)}</span></a></li>`;
|
||||
})
|
||||
.join("");
|
||||
return `${head}
|
||||
<div class="release-older">
|
||||
${rest ? `<p class="release-older-title">Earlier releases</p>${rest}` : ""}
|
||||
<p class="release-more"><a class="link-arrow" href="https://github.com/${REPO}/releases">Every release on GitHub<span aria-hidden="true">→</span></a></p>
|
||||
</div>`;
|
||||
// What landed last: the "New" items of the newest releases with the highest pull request numbers (a release's
|
||||
// notes list everything since the last Stable, oldest first).
|
||||
const pr = (item) => Math.max(0, ...[...item.matchAll(/#(\d+)/g)].map((m) => Number(m[1])));
|
||||
const seen = new Set();
|
||||
const picked = game
|
||||
.slice(0, rows)
|
||||
.flatMap((r) => sections(r.body).filter((x) => /^new|what's new/i.test(x.title)).flatMap((x) => x.items).map((raw) => ({ raw, item: plainItem(raw), r })))
|
||||
.filter(({ item }) => !seen.has(item) && seen.add(item))
|
||||
.sort((a, b) => pr(b.raw) - pr(a.raw))
|
||||
.slice(0, picks);
|
||||
const picks_ = picked
|
||||
.map(({ item, r }) => `<li class="highlight"><p>${inline(item)}</p><a class="highlight-from" href="/releases#${anchor(r)}">${escape(parts(r).version)}</a></li>`)
|
||||
.join("");
|
||||
return `<ol class="index recent-list" aria-label="The newest releases">${lines}</ol>
|
||||
${picks_ ? `<div class="recent-picks"><p class="eyebrow">New lately</p><ul class="highlights">${picks_}</ul></div>` : ""}
|
||||
<p class="release-more"><a class="link-arrow" href="/releases">Every release, with its full notes<span aria-hidden="true">→</span></a></p>`;
|
||||
}
|
||||
|
||||
const ASSET_LABELS = [
|
||||
[/linux-x86_64/, "Linux x86-64"],
|
||||
[/macos-arm64/, "macOS, Apple Silicon"],
|
||||
[/macos-x86_64/, "macOS, Intel"],
|
||||
[/windows-x64/, "Windows x64"],
|
||||
];
|
||||
function assetLabel(name) {
|
||||
if (/^SHA256SUMS/.test(name)) return name.endsWith(".sig") ? "Checksums signature" : "Checksums";
|
||||
const os = ASSET_LABELS.find(([re]) => re.test(name));
|
||||
const what = /server/.test(name) ? "Server" : /launcher/.test(name) ? "Launcher" : /smoke-test/.test(name) ? "Smoke test" : "Game";
|
||||
return os ? `${what}, ${os[1]}` : name;
|
||||
}
|
||||
const size = (bytes) => (bytes >= 1e6 ? `${(bytes / 1e6).toFixed(0)} MB` : bytes >= 1e3 ? `${(bytes / 1e3).toFixed(0)} kB` : `${bytes} B`);
|
||||
|
||||
function releaseHtml(r, open) {
|
||||
const p = parts(r);
|
||||
const o = overview(r);
|
||||
const top = highlights(r, 4);
|
||||
const downloads = (r.assets || [])
|
||||
.map((a) => `<li><a href="${escape(a.browser_download_url)}">${escape(assetLabel(a.name))}</a><span>${escape(a.name)} · ${size(a.size || 0)}</span></li>`)
|
||||
.join("");
|
||||
return `<details class="release release-entry" id="${anchor(r)}" data-channel="${channel(r).toLowerCase()}"${open ? " open" : ""}>
|
||||
<summary><span class="release-tag">${escape(p.version)}</span><span class="release-sub">${badge(r)}${escape(p.line)}</span><time datetime="${p.date}">${p.date}</time></summary>
|
||||
<div class="release-detail">
|
||||
${o.text || top.length ? `<div class="release-overview">
|
||||
${o.text ? `<p class="release-counts">${escape(o.text)}</p>` : ""}
|
||||
${top.length ? `<ul>${top.map((t) => `<li>${inline(t)}</li>`).join("")}</ul>` : ""}
|
||||
</div>` : ""}
|
||||
<div class="prose">${markdown(r.body || "") || "<p>No notes for this release.</p>"}</div>
|
||||
${downloads ? `<div class="release-downloads"><p class="eyebrow">Downloads</p><ul>${downloads}</ul></div>` : ""}
|
||||
<p class="release-github"><a href="${escape(r.html_url)}">This release on GitHub</a></p>
|
||||
</div>
|
||||
</details>`;
|
||||
}
|
||||
|
||||
// The Releases page: every release, newest first; the newest few open.
|
||||
export function releasesPageHtml(list, { open = 3 } = {}) {
|
||||
const sorted = [...list].sort(byTag);
|
||||
if (!sorted.length) return "";
|
||||
return sorted.map((r, i) => releaseHtml(r, i < open)).join("\n");
|
||||
}
|
||||
|
||||
export const releasesUrl = `https://github.com/${REPO}/releases`;
|
||||
|
||||
+125
-11
@@ -300,12 +300,7 @@ figcaption span { font-family: var(--mono); font-size: var(--text-micro); letter
|
||||
.screen-caption { margin-top: 12px; font-size: var(--text-caption); color: var(--muted); }
|
||||
|
||||
/* Patch notes. */
|
||||
.release-latest { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; padding-top: 32px; border-top: 1px solid var(--rule); }
|
||||
.release-head { position: sticky; top: calc(var(--nav) + 24px); align-self: start; display: flex; flex-direction: column; gap: 12px; }
|
||||
.eyebrow { text-transform: uppercase; }
|
||||
.release-version { font-size: var(--text-display); line-height: var(--text-display-line); letter-spacing: var(--text-display-tracking); font-weight: 500; }
|
||||
.release-line { color: var(--muted); max-width: 36ch; }
|
||||
.release-body { font-size: var(--text-ui); }
|
||||
.prose h2, .prose h3, .prose h4 { font-size: var(--text-heading); line-height: var(--text-heading-line); color: var(--ink); margin-top: 28px; }
|
||||
.prose ul, .prose ol { padding-left: 18px; list-style: disc; }
|
||||
.prose li + li { margin-top: 6px; }
|
||||
@@ -313,8 +308,6 @@ figcaption span { font-family: var(--mono); font-size: var(--text-micro); letter
|
||||
.prose strong { color: var(--ink); font-weight: 500; }
|
||||
.prose pre { padding: 16px; border-radius: var(--radius-plate); background: var(--plate-soft); overflow-x: auto; }
|
||||
.prose pre code { background: none; padding: 0; }
|
||||
.release-older { margin-top: 64px; }
|
||||
.release-older-title { font: var(--text-micro) / var(--text-micro-line) var(--mono); letter-spacing: var(--text-micro-tracking); color: var(--muted); text-transform: uppercase; margin-bottom: 12px; }
|
||||
.release { border-top: 1px solid var(--rule); }
|
||||
.release:last-of-type { border-bottom: 1px solid var(--rule); }
|
||||
.release summary {
|
||||
@@ -404,9 +397,9 @@ figcaption span { font-family: var(--mono); font-size: var(--text-micro); letter
|
||||
/* --- Narrow screens ------------------------------------------------------------------------ */
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.section-head, .parity-hero, .launcher-grid, .release-latest { grid-template-columns: minmax(0, 1fr); }
|
||||
.section-head, .parity-hero, .launcher-grid { grid-template-columns: minmax(0, 1fr); }
|
||||
.section-head { gap: 16px; }
|
||||
.screens, .release-head { position: static; }
|
||||
.screens { position: static; }
|
||||
.fact { grid-template-columns: var(--index) minmax(0, 1fr); row-gap: 6px; }
|
||||
.fact p { grid-column: 2; }
|
||||
.mosaic { grid-template-columns: minmax(0, 1fr); }
|
||||
@@ -529,7 +522,7 @@ body::before {
|
||||
}
|
||||
|
||||
/* Pixel type for what names and what you act on; paragraphs stay in Geist. */
|
||||
.display, .title, .statement, .row-name, .card-title, .release-version, .release-tag, .count,
|
||||
.display, .title, .statement, .row-name, .card-title, .release-tag, .count,
|
||||
.fact h3, .features h3, .system h3, .contributors-title, .footer-disclaimer, .footer-word,
|
||||
.nav-mark, .docs-prose h2, .docs-prose h3, .prose h2, .prose h3, .prose h4, .menu nav a {
|
||||
font-family: var(--pixel); font-weight: 600; letter-spacing: 0;
|
||||
@@ -581,7 +574,6 @@ code { border-radius: 0; background: var(--well); box-shadow: 0 0 0 1px var(--ou
|
||||
.contributor { padding: 12px 14px; }
|
||||
.contributors-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
|
||||
.contributor-avatar { border-radius: 0; box-shadow: 0 0 0 2px var(--outline); image-rendering: pixelated; }
|
||||
.release-latest { border-top: 0; padding: 28px; background: var(--panel); border: var(--block-outline) solid var(--outline); box-shadow: var(--panel-edges); }
|
||||
.system.is-full .system-state { color: var(--success); }
|
||||
|
||||
/* Screenshots and the launcher's screens: square, outlined. */
|
||||
@@ -627,3 +619,125 @@ code { border-radius: 0; background: var(--well); box-shadow: 0 0 0 1px var(--ou
|
||||
.footer-word { color: var(--raised); letter-spacing: 0.02em; }
|
||||
:root[data-theme="dark"] .footer-word { color: var(--panel); }
|
||||
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .footer-word { color: var(--panel); } }
|
||||
|
||||
/* --- Releases and Benchmarks pages, and the home page's "Recently added" ------------------ */
|
||||
|
||||
/* Pixelify Sans' "fi" ligature draws as "A" ("8 Axes"): no common ligatures anywhere. */
|
||||
:root { font-variant-ligatures: no-common-ligatures; }
|
||||
|
||||
.page-main { padding-top: calc(var(--nav) + clamp(40px, 6vw, 80px)); }
|
||||
.page-title { max-width: 18ch; margin-bottom: 20px; }
|
||||
.page-main > .container > .lede { font-size: var(--text-body); }
|
||||
.page-main .disclaimer { margin-top: 48px; }
|
||||
|
||||
/* Channel and source badges: small square tags. */
|
||||
.badge {
|
||||
display: inline-flex; align-items: center; height: 22px; padding: 0 8px; margin-right: 10px; vertical-align: 2px;
|
||||
font: 500 12px / 1 var(--pixel); letter-spacing: 0.02em; text-transform: uppercase; white-space: nowrap;
|
||||
border: var(--block-outline) solid var(--outline); background: var(--well); color: var(--ink-soft);
|
||||
}
|
||||
.badge-stable { background: color-mix(in srgb, var(--success) 22%, var(--panel)); color: var(--ink); }
|
||||
.badge-alpha { background: color-mix(in srgb, var(--warn) 24%, var(--panel)); color: var(--ink); }
|
||||
.badge-launcher { background: color-mix(in srgb, var(--accent) 20%, var(--panel)); color: var(--ink); }
|
||||
.badge-us { background: color-mix(in srgb, var(--accent) 20%, var(--panel)); color: var(--ink); }
|
||||
.badge-players { background: color-mix(in srgb, var(--success) 22%, var(--panel)); color: var(--ink); }
|
||||
.badge-estimate { background: color-mix(in srgb, var(--warn) 24%, var(--panel)); color: var(--ink); }
|
||||
|
||||
/* Home: the newest releases on a line each, then what they added. */
|
||||
.recent-list .row > a { grid-template-columns: 8.5rem minmax(0, 13rem) minmax(0, 1fr) auto; align-items: baseline; }
|
||||
.recent-line { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.recent-list .row-name { font-size: clamp(18px, 1.8vw, 22px); }
|
||||
.recent-list .badge { margin-right: 0; }
|
||||
.recent-picks { margin-top: 32px; }
|
||||
.recent-picks .eyebrow { margin-bottom: 12px; }
|
||||
.highlights { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
|
||||
.highlight {
|
||||
display: flex; flex-direction: column; justify-content: space-between; gap: 16px; padding: 18px 20px;
|
||||
background: var(--panel); border: var(--block-outline) solid var(--outline); box-shadow: var(--panel-edges);
|
||||
}
|
||||
.highlight p { color: var(--ink); }
|
||||
.highlight-from { font: var(--text-micro) / 1 var(--mono); letter-spacing: var(--text-micro-tracking); color: var(--muted); }
|
||||
.highlight-from:hover { color: var(--accent); }
|
||||
|
||||
/* Releases: a filter, then every release as a panel that opens. */
|
||||
.release-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
|
||||
.release-filter .button[aria-pressed="true"] { background: var(--face); color: var(--on-face); box-shadow: inset 0 var(--block-bevel) 0 var(--face-bevel), inset 0 calc(-1 * var(--block-lip)) 0 var(--face-lip); }
|
||||
.release-count { margin: 16px 0 12px; }
|
||||
.release-list { display: grid; gap: 8px; }
|
||||
.release-list .release + .release { margin-top: 0; }
|
||||
.release-entry summary { grid-template-columns: minmax(0, 11rem) minmax(0, 1fr) auto; }
|
||||
.release-entry .release-sub { display: flex; align-items: baseline; flex-wrap: wrap; row-gap: 4px; }
|
||||
.release-detail { padding: 0 0 24px 11rem; margin-left: 16px; display: grid; gap: 20px; max-width: calc(11rem + 16px + var(--measure) + 120px); }
|
||||
.release-detail .prose { padding: 0; margin: 0; font-size: var(--text-ui); max-width: none; }
|
||||
.release-overview { padding: 16px 18px; background: var(--well); box-shadow: 0 0 0 var(--block-outline) var(--outline); }
|
||||
.release-counts { font-family: var(--pixel); font-weight: 600; color: var(--ink); margin-bottom: 8px; }
|
||||
.release-overview ul { list-style: square; padding-left: 18px; color: var(--ink-soft); font-size: var(--text-ui); }
|
||||
.release-overview li + li { margin-top: 4px; }
|
||||
.release-downloads ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-top: 8px; }
|
||||
.release-downloads li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--button); box-shadow: 0 0 0 var(--block-outline) var(--outline); }
|
||||
.release-downloads li a { font-weight: 500; }
|
||||
.release-downloads li span { font: var(--text-micro) / 1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
|
||||
.release-github { font-size: var(--text-caption); }
|
||||
.release-entry:target { box-shadow: var(--panel-edges), 0 0 0 3px var(--accent); }
|
||||
|
||||
/* Benchmarks. */
|
||||
.bench-section { margin-top: clamp(64px, 8vw, 112px); }
|
||||
.bench-section > .title { margin-bottom: 16px; }
|
||||
.bench-section > .lede { margin-bottom: 32px; }
|
||||
.machines { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; }
|
||||
.machine { min-width: 0; padding: 24px; background: var(--panel); border: var(--block-outline) solid var(--outline); box-shadow: var(--panel-edges); }
|
||||
.machine-head { display: grid; gap: 10px; margin-bottom: 20px; }
|
||||
.machine-name { font-family: var(--pixel); font-weight: 600; font-size: var(--text-title); line-height: var(--text-title-line); }
|
||||
.machine-facts { display: flex; flex-wrap: wrap; gap: 6px 28px; margin: 0; }
|
||||
.machine-facts div { display: flex; gap: 8px; min-width: 0; }
|
||||
.machine-facts dt { font: var(--text-micro) / 1.6 var(--mono); letter-spacing: var(--text-micro-tracking); text-transform: uppercase; color: var(--muted); }
|
||||
.machine-facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-size: var(--text-caption); color: var(--ink-soft); }
|
||||
.machine-note { font-size: var(--text-caption); color: var(--muted); max-width: 90ch; }
|
||||
/* relative: the screen-reader-only labels inside are absolute and would escape the scroll box otherwise. */
|
||||
.table-wrap { position: relative; overflow-x: auto; }
|
||||
.bench-table { width: 100%; border-collapse: collapse; font-size: var(--text-ui); }
|
||||
.bench-table th, .bench-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
|
||||
.bench-table thead th { font: var(--text-micro) / 1.4 var(--mono); letter-spacing: var(--text-micro-tracking); text-transform: uppercase; color: var(--muted); font-weight: 400; }
|
||||
.bench-table thead tr:first-child th { color: var(--ink); }
|
||||
.bench-table tbody th { font-weight: 500; color: var(--ink); }
|
||||
.bench-table td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
|
||||
.bench-table td.wins { color: var(--ink); font-weight: 600; }
|
||||
.bench-table td.vs { font-size: var(--text-caption); white-space: nowrap; }
|
||||
.vs-horizon { color: var(--success); }
|
||||
.vs-java { color: var(--danger); }
|
||||
.vs-tie, .vs-none { color: var(--muted); }
|
||||
.capped { font: var(--text-micro) / 1 var(--mono); color: var(--warn); cursor: help; }
|
||||
.metric-hint { display: block; font: var(--text-micro) / 1.4 var(--mono); color: var(--muted); font-weight: 400; }
|
||||
.java-wins { margin-top: 16px; font-size: var(--text-caption); color: var(--ink-soft); }
|
||||
.picker { display: flex; flex-wrap: wrap; gap: 16px 24px; align-items: end; padding: 20px; background: var(--panel); border: var(--block-outline) solid var(--outline); box-shadow: var(--panel-edges); }
|
||||
.picker label { display: grid; gap: 6px; }
|
||||
.picker label > span, .picker legend { font: var(--text-micro) / 1.4 var(--mono); letter-spacing: var(--text-micro-tracking); text-transform: uppercase; color: var(--muted); }
|
||||
.picker select {
|
||||
min-width: min(320px, 80vw); height: var(--control); padding: 0 10px; font: inherit; font-size: var(--text-ui); color: var(--ink);
|
||||
background: var(--well); border: var(--block-outline) solid var(--outline); border-radius: 0;
|
||||
}
|
||||
.picker-rd { display: flex; gap: 16px; align-items: center; border: 0; padding: 0; margin: 0; }
|
||||
.picker-rd legend { margin-bottom: 6px; }
|
||||
.picker-rd label { display: inline-flex; align-items: center; gap: 6px; font-family: var(--pixel); font-weight: 500; height: var(--control); }
|
||||
.picker-rd input { accent-color: var(--accent); width: 18px; height: 18px; }
|
||||
.pick-result { margin-top: 16px; padding: 20px; background: var(--panel); border: var(--block-outline) solid var(--outline); box-shadow: var(--panel-edges); }
|
||||
.pick-head { margin-bottom: 12px; font-size: var(--text-caption); color: var(--ink-soft); line-height: 1.8; }
|
||||
.pick-result .meta { margin-top: 12px; }
|
||||
.empty { color: var(--muted); }
|
||||
.prose-section .prose { max-width: 80ch; }
|
||||
.spec-table { margin-top: 24px; }
|
||||
.spec-table summary { cursor: pointer; font-family: var(--pixel); font-weight: 600; }
|
||||
.spec-table .bench-table { margin-top: 16px; max-width: 760px; }
|
||||
|
||||
@media (max-width: 900px) {
|
||||
.recent-list .row > a { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; }
|
||||
.recent-list .row-index { grid-column: 1; grid-row: 1; }
|
||||
.recent-list .row-name { grid-column: 1; grid-row: 2; }
|
||||
.recent-line { grid-column: 1 / -1; grid-row: 3; white-space: normal; }
|
||||
.recent-list .row-meta { grid-column: 2; grid-row: 1; }
|
||||
.highlights { grid-template-columns: minmax(0, 1fr); }
|
||||
.release-entry summary { grid-template-columns: minmax(0, 1fr) auto; }
|
||||
.release-detail { padding-left: 0; margin-left: 0; }
|
||||
.machine { padding: 16px; }
|
||||
}
|
||||
.older-runs { margin-top: 16px; max-width: 90ch; padding: 16px 20px; background: var(--well); box-shadow: 0 0 0 var(--block-outline) var(--outline); font-size: var(--text-caption); }
|
||||
|
||||
Reference in New Issue
Block a user