[PR #2587] [MERGED] Launcher: instances, each with its own game folder #4450

Closed
opened 2026-11-03 04:17:15 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/2587
Author: @ludovic111
Created: 10/27/2026
Status: ✅ Merged
Merged: 10/27/2026
Merged by: @ludovic111

Base: main ← Head: feat/launcher-instances


📝 Commits (1)

  • 1d0d827 Launcher: instances, each with its own game folder

📊 Changes

11 files changed (+823 additions, -12 deletions)

View changed files

📝 docs/launcher-commands.md (+63 -0)
📝 launcher/README.md (+13 -1)
📝 launcher/src/backend.rs (+7 -3)
📝 launcher/src/browser/horizon/pack.rs (+1 -1)
📝 launcher/src/cli.rs (+97 -0)
➕ launcher/src/instances.rs (+414 -0)
➕ launcher/src/instances/tests.rs (+203 -0)
📝 launcher/src/lib.rs (+1 -0)
📝 launcher/src/main.rs (+12 -6)
📝 launcher/src/mcp.rs (+7 -0)
📝 launcher/src/modpacks.rs (+5 -1)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

Clean room: designed from the feature list in briefs/launcher-features-1.md; no other launcher's code, docs or assets were read.

What

Launcher feature 1 of 20, first half: instances, separate game folders each with its own worlds, options and packs. This PR is the core, the CLI and MCP; the sidebar (groups, create / duplicate / rename / icon in the window) is the next PR, on top of this one.

  • launcher/src/instances.rs: list, create (empty or a copy), rename, icon, group, select, and apply (turns the game's command into an instance).
  • horizon-launcher instance [list|create|rename|icon|group|select] and play --instance <name>; the MCP tools instance_* come from the CLI as every other tool, and MCP play takes instance.
  • The window's Play starts the selected instance (Settings.instance; unset = Horizon). A pack's own Play button still plays that pack.
  • Crash reports are read from the run's own game folder, so a crash in an instance or a modpack shows its report (before, the Play page looked only in the default folder).

Migration: what moves where

Nothing moves. No file of an existing player is renamed, moved, rewritten or deleted:

What the player has Becomes Where it stays
The game's folder (~/Library/Application Support/horizon, ~/.local/share/horizon, %APPDATA%\horizon, or HORIZON_HOME): saves/, options.txt, packs instance horizon, shown as "Horizon", the default the same folder
Imported modpacks, ports/<pack>/home/ instance port:<pack> the same folder
Registry modpacks, horizon-packs/<id>/home/ instance pack:<id> the same folder

New instances get instances/<slug>/ inside the game's folder. What the player chooses (name, icon, group) goes to a new file, instances.json in the launcher's data folder, so renaming never moves a folder. settings.json gets one optional key, instance; older launchers ignore it.

A new empty instance starts with copies of options.txt and horizon-player.txt (keys, video settings, and the same offline name, so the player stays the same player). A copy takes the other instance's whole folder except instances/, ports/, horizon-packs/, logs/, crash-reports/, sessions/ (sign-in tokens never leave their folder), telemetry/, mod-browser/ and .horizon-cache. Copying a modpack instance is refused (its mods come from the pack). At each start an instance follows the launcher's data-collection answer (telemetry/consent.json) and No AI.

Test: instances::tests::existing_worlds_stay_where_they_are_and_every_folder_becomes_an_instance builds a player's folder (two worlds, options, offline name, a resource pack, logs, a session, consent, an imported and a registry modpack with their worlds), lists the instances, creates an empty one and a copy, renames and regroups, then checks that every file that was there is byte-identical, and what each new instance holds.

How tested

launcher$ cargo fmt --check                                                    ok
launcher$ cargo clippy --all-targets --locked --features gpui/runtime_shaders -- -D warnings   ok
launcher$ cargo test --locked --features gpui/runtime_shaders --lib            141 passed
launcher$ cargo test --locked --features gpui/runtime_shaders --bin horizon-launcher   35 passed (launcher-commands.md regenerated)

Run on the Mac mini with fresh mktemp -d homes (HORIZON_HOME, HORIZON_LAUNCHER_HOME, XDG_*, HORIZON_LAUNCHER_NO_SELF_UPDATE=1) and a stand-in game binary that records its folder and arguments:

  • instance create Skyblock, play --instance skyblock --world Sky → the game ran in <home>/instances/skyblock with HORIZON_HOME set there and --world Sky; the instance got horizon-player.txt, telemetry/consent.json and noAi:true (No AI was on).
  • play without --instance → the game's folder, as before.
  • create / copy / icon / group / select / rename and --json instance list (one array).

Not run on Linux or Windows: nothing here is platform-specific beyond paths; CI builds both.

Needs Ludovic

Nothing.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/2587 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 10/27/2026 **Status:** ✅ Merged **Merged:** 10/27/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `feat/launcher-instances` --- ### 📝 Commits (1) - [`1d0d827`](https://github.com/horizon-rust/horizon/commit/1d0d827f3aa2ce9199c17c8872122abf48ebdfd9) Launcher: instances, each with its own game folder ### 📊 Changes **11 files changed** (+823 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `docs/launcher-commands.md` (+63 -0) 📝 `launcher/README.md` (+13 -1) 📝 `launcher/src/backend.rs` (+7 -3) 📝 `launcher/src/browser/horizon/pack.rs` (+1 -1) 📝 `launcher/src/cli.rs` (+97 -0) ➕ `launcher/src/instances.rs` (+414 -0) ➕ `launcher/src/instances/tests.rs` (+203 -0) 📝 `launcher/src/lib.rs` (+1 -0) 📝 `launcher/src/main.rs` (+12 -6) 📝 `launcher/src/mcp.rs` (+7 -0) 📝 `launcher/src/modpacks.rs` (+5 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Clean room: designed from the feature list in briefs/launcher-features-1.md; no other launcher's code, docs or assets were read. ## What Launcher feature 1 of 20, first half: **instances**, separate game folders each with its own worlds, options and packs. This PR is the core, the CLI and MCP; the sidebar (groups, create / duplicate / rename / icon in the window) is the next PR, on top of this one. - `launcher/src/instances.rs`: list, create (empty or a copy), rename, icon, group, select, and `apply` (turns the game's command into an instance). - `horizon-launcher instance [list|create|rename|icon|group|select]` and `play --instance <name>`; the MCP tools `instance_*` come from the CLI as every other tool, and MCP `play` takes `instance`. - The window's Play starts the selected instance (`Settings.instance`; unset = Horizon). A pack's own Play button still plays that pack. - Crash reports are read from the run's own game folder, so a crash in an instance or a modpack shows its report (before, the Play page looked only in the default folder). ## Migration: what moves where **Nothing moves.** No file of an existing player is renamed, moved, rewritten or deleted: | What the player has | Becomes | Where it stays | |---|---|---| | The game's folder (`~/Library/Application Support/horizon`, `~/.local/share/horizon`, `%APPDATA%\horizon`, or `HORIZON_HOME`): `saves/`, `options.txt`, packs | instance `horizon`, shown as "Horizon", the default | the same folder | | Imported modpacks, `ports/<pack>/home/` | instance `port:<pack>` | the same folder | | Registry modpacks, `horizon-packs/<id>/home/` | instance `pack:<id>` | the same folder | New instances get `instances/<slug>/` inside the game's folder. What the player chooses (name, icon, group) goes to a new file, `instances.json` in the launcher's data folder, so renaming never moves a folder. `settings.json` gets one optional key, `instance`; older launchers ignore it. A new empty instance starts with copies of `options.txt` and `horizon-player.txt` (keys, video settings, and the same offline name, so the player stays the same player). A copy takes the other instance's whole folder except `instances/`, `ports/`, `horizon-packs/`, `logs/`, `crash-reports/`, `sessions/` (sign-in tokens never leave their folder), `telemetry/`, `mod-browser/` and `.horizon-cache`. Copying a modpack instance is refused (its mods come from the pack). At each start an instance follows the launcher's data-collection answer (`telemetry/consent.json`) and No AI. Test: `instances::tests::existing_worlds_stay_where_they_are_and_every_folder_becomes_an_instance` builds a player's folder (two worlds, options, offline name, a resource pack, logs, a session, consent, an imported and a registry modpack with their worlds), lists the instances, creates an empty one and a copy, renames and regroups, then checks that every file that was there is byte-identical, and what each new instance holds. ## How tested ``` launcher$ cargo fmt --check ok launcher$ cargo clippy --all-targets --locked --features gpui/runtime_shaders -- -D warnings ok launcher$ cargo test --locked --features gpui/runtime_shaders --lib 141 passed launcher$ cargo test --locked --features gpui/runtime_shaders --bin horizon-launcher 35 passed (launcher-commands.md regenerated) ``` Run on the Mac mini with fresh `mktemp -d` homes (`HORIZON_HOME`, `HORIZON_LAUNCHER_HOME`, `XDG_*`, `HORIZON_LAUNCHER_NO_SELF_UPDATE=1`) and a stand-in game binary that records its folder and arguments: - `instance create Skyblock`, `play --instance skyblock --world Sky` → the game ran in `<home>/instances/skyblock` with `HORIZON_HOME` set there and `--world Sky`; the instance got `horizon-player.txt`, `telemetry/consent.json` and `noAi:true` (No AI was on). - `play` without `--instance` → the game's folder, as before. - create / copy / icon / group / select / rename and `--json instance list` (one array). Not run on Linux or Windows: nothing here is platform-specific beyond paths; CI builds both. ## Needs Ludovic Nothing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:17:15 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#4450
No description provided.