Cap a fresh install at vanilla's 120 frames per second (#271)

Without an options.txt the game ran unlimited (260), while an options.txt
without maxFps, like vanilla, gives 120. With VSync off (or rendering
offscreen) that kept a core busy drawing frames nobody sees.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Ludovic Marie
2026-10-15 14:34:36 +02:00
parent 337ee470b5
commit 1573e4e553
+13 -2
View File
@@ -194,8 +194,9 @@ impl Default for Settings {
gui_scale: 0,
view_bobbing: true,
gamma: 0.5,
// Vanilla defaults to 120; Horizon runs unlimited unless capped.
max_fps: 260,
// Vanilla's default, as for an options.txt without the key: a
// capped frame rate leaves the cores idle when VSync is off.
max_fps: 120,
vsync: true,
fullscreen: false,
smooth_lighting: true,
@@ -608,6 +609,16 @@ mod tests {
assert_eq!(again.keys.get("key.jump"), "key.keyboard.j");
}
#[test]
fn no_options_txt_paces_frames_like_an_empty_one() {
let (fresh, empty) = (Settings::default(), Settings::parse(""));
assert_eq!(fresh.max_fps, 120);
assert_eq!(fresh.max_fps, empty.max_fps);
assert_eq!(fresh.vsync, empty.vsync);
assert_eq!(fresh.inactivity_fps_limit, empty.inactivity_fps_limit);
assert_eq!(fresh.render_distance, empty.render_distance);
assert_eq!(fresh.simulation_distance, empty.simulation_distance);
}
#[test]
fn subtitle_options() {
let s = Settings::parse("showSubtitles:true\nnotificationDisplayTime:2.5\n");
assert!(s.show_subtitles);