From 8a966b9584006ce75aeb8bbf87e55f15017cf251 Mon Sep 17 00:00:00 2001 From: francy51 Date: Sun, 7 Jun 2026 22:19:46 -0400 Subject: [PATCH] Slow orbital periods for readability at galaxy-inspection scale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Introduce ORBITAL_PERIOD_SCALE = 4.0 multiplier so planets/stations/ gas clouds/anomalies all orbit visibly slower. At inspection-scale zoom the un-scaled periods (≈2.5s per unit of radius) made bodies spin like tops; tuned for a calm browsing pace. - Default Orbit angular_velocity 0.5 → 0.15 (≈40s per revolution). - Update orbital_period unit tests for the new scale factor. --- apps/game/src/gameplay/galaxy/contents.rs | 18 +++++++++++++----- apps/game/src/gameplay/movement/orbit.rs | 4 +++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/apps/game/src/gameplay/galaxy/contents.rs b/apps/game/src/gameplay/galaxy/contents.rs index 5a4c287..6ab96ad 100644 --- a/apps/game/src/gameplay/galaxy/contents.rs +++ b/apps/game/src/gameplay/galaxy/contents.rs @@ -295,9 +295,15 @@ const ASTEROID_COLOR_COUNT: usize = 5; /// asteroid rocks. Stargates are intentionally excluded — they stay /// stationary as navigational aids. Periods are floored at /// [`MIN_ORBITAL_PERIOD`] so very tight orbits don't become a blur. +/// +/// [`ORBITAL_PERIOD_SCALE`] then multiplies the raw period so all bodies +/// orbit visibly slower — at galaxy-inspection scale the un-scaled periods +/// (≈2.5 s per unit of radius) made planets spin like tops. Tuned for +/// readable motion when the player is browsing the galaxy map. const MIN_ORBITAL_PERIOD: f32 = 2.0; +const ORBITAL_PERIOD_SCALE: f32 = 4.0; fn orbital_period(orbit: f32, jitter: f32) -> f32 { - (orbit * 2.5 + jitter).max(MIN_ORBITAL_PERIOD) + ((orbit * 2.5 + jitter) * ORBITAL_PERIOD_SCALE).max(MIN_ORBITAL_PERIOD) } // ─── Generation ───────────────────────────────────────────────────────────── @@ -1239,10 +1245,11 @@ mod tests { #[test] fn orbital_period_grows_linearly_with_radius() { - // No jitter → period = 2.5 × orbit. + // No jitter → period = 2.5 × orbit × scale. + let scale = ORBITAL_PERIOD_SCALE; assert!((orbital_period(0.0, 0.0) - MIN_ORBITAL_PERIOD).abs() < 1e-6); - assert!((orbital_period(2.0, 0.0) - 5.0).abs() < 1e-6); - assert!((orbital_period(8.0, 0.0) - 20.0).abs() < 1e-6); + assert!((orbital_period(2.0, 0.0) - 5.0 * scale).abs() < 1e-5); + assert!((orbital_period(8.0, 0.0) - 20.0 * scale).abs() < 1e-5); } #[test] @@ -1254,9 +1261,10 @@ mod tests { #[test] fn orbital_period_applies_jitter_additively() { + // Jitter is added before the scale, so the delta is jitter × scale. let base = orbital_period(5.0, 0.0); let jittered = orbital_period(5.0, 2.0); - assert!((jittered - base - 2.0).abs() < 1e-6); + assert!((jittered - base - 2.0 * ORBITAL_PERIOD_SCALE).abs() < 1e-5); } #[test] diff --git a/apps/game/src/gameplay/movement/orbit.rs b/apps/game/src/gameplay/movement/orbit.rs index fddde54..584ef84 100644 --- a/apps/game/src/gameplay/movement/orbit.rs +++ b/apps/game/src/gameplay/movement/orbit.rs @@ -24,7 +24,9 @@ impl Default for Orbit { fn default() -> Self { Self { angle: 0.0, - angular_velocity: 0.5, + // ~1 full revolution every 40 seconds — calm enough to read at + // inspection-scale zoom levels. Callers can override per-instance. + angular_velocity: 0.15, radius: 10.0, plane: OrbitPlane::Horizontal, }