From e1788e19c11ab12033a678bbc59f482a4a9c3960 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 10 Oct 2026 20:32:18 +0200 Subject: [PATCH] Tests: the Longinus's reach bound is derived from the allocator's own push, not a widened constant; stale mixer comments and unused using UniRx removed Builds; not yet run (the run follows). --- Assets/Scripts/ServerShared/Ship.cs | 1 - .../Aetheria.Shared.Tests/EvasionTermTests.cs | 47 +++++++++++-------- .../RestoredHullsTests.cs | 12 ++--- .../ThrottleLockTests.cs | 4 +- 4 files changed, 36 insertions(+), 28 deletions(-) diff --git a/Assets/Scripts/ServerShared/Ship.cs b/Assets/Scripts/ServerShared/Ship.cs index a7339c4e1..6a3f9ea44 100644 --- a/Assets/Scripts/ServerShared/Ship.cs +++ b/Assets/Scripts/ServerShared/Ship.cs @@ -9,7 +9,6 @@ using System.Linq; using System.Reflection; using MessagePack; using Newtonsoft.Json; -using UniRx; using CultMath; using static CultMath.math; using quaternion = CultMath.quaternion; diff --git a/tests/Aetheria.Shared.Tests/EvasionTermTests.cs b/tests/Aetheria.Shared.Tests/EvasionTermTests.cs index 009c55667..bd2e6d645 100644 --- a/tests/Aetheria.Shared.Tests/EvasionTermTests.cs +++ b/tests/Aetheria.Shared.Tests/EvasionTermTests.cs @@ -262,7 +262,7 @@ public sealed partial class RunStartTests Push(float2(-1, 0), float2(-1, 0)), Push(float2(1, 0), float2(1, 0)), e.Clockwise, e.CounterClockwise); } - private static (float noseOn, float broadside) EvReach(Ship ship, float window, ManoeuvreEnvelope envelope) + private static (float noseOn, float broadside) EvReach(ManoeuvreEnvelope envelope, float window) { var heading = float2(0, 1); float Half(float2 n) => .5f * (FireControl.Reach(envelope, heading, n, window) + FireControl.Reach(envelope, heading, -n, window)); @@ -274,33 +274,42 @@ public sealed partial class RunStartTests { var (_, longinus, djinni) = EvFleet(); const float window = .5f; - var results = new List<(string name, (float noseOn, float broadside) reach, (float noseOn, float broadside) measured)>(); + var results = new List<(string name, (float noseOn, float broadside) reach, (float noseOn, float broadside) allocated, (float noseOn, float broadside) measured)>(); foreach (var (name, ship) in new[] { ("longinus", longinus), ("djinni", djinni) }) { var measured = EvMeasuredHalfWidths(ship, window); EvSettle(ship); ship.Update(EvDt); - var reach = EvReach(ship, window, ship.Envelope); - var allocated = EvReach(ship, window, EvAllocatedEnvelope(ship)); + var reach = EvReach(ship.Envelope, window); + var allocated = EvReach(EvAllocatedEnvelope(ship), window); Console.WriteLine($"ALLOC {name}: allocated nose-on {allocated.noseOn:F3} broadside {allocated.broadside:F3}"); Console.WriteLine($"REACH {name}: nose-on reach {reach.noseOn:F3} measured {measured.noseOn:F3}; broadside reach {reach.broadside:F3} measured {measured.broadside:F3}"); - results.Add((name, reach, measured)); + results.Add((name, reach, allocated, measured)); } - // The reach is the capability and the measured motion is the best of fifteen fixed control policies, so reach may - // sit above it: by up to 15% for the Longinus, whose controller shapes its turn input (a square root of the - // remaining angle) where the reach turns at full rate. - foreach (var (name, reach, measured) in results) + // The envelope's reach is the capability and the measured motion is the best of fifteen fixed control policies, so + // the reach covers it: no more than 10% below it. + // The Djinni's measured motion sits further below its reach (+38% nose-on, +26% broadside at the last measurement): + // its strafers are off-axis and the envelope, summed from what each thruster can push, does not model that. Its + // allocator holds the whole box (its allocated reach is the envelope's), so the allocated reach says nothing more + // about it. The bound still pins that the reach covers what the ship does. + // The Longinus's allocator holds the heading and pays for the drive torque out of the flank thrusters (ruling + // allocator-divergence-accepted), so the envelope's box support overstates what a controlled flight spends. Its + // measured motion is bounded by the reach of the push the allocator itself gives it on each half-axis, from the + // columns it allocates with: not below 90% of it, and above it by no more than the 15% a turning policy gains. + foreach (var (name, reach, allocated, measured) in results) { - // The Djinni's measured motion is further below its reach (+53% nose-on, +27% broadside at the last measurement): its - // strafers are off-axis and Ship.Update cancels their torque (M24), which the envelope, summed from what each thruster - // can push, does not model. Stated deviation; the bound still pins that the reach covers what the ship does. - // The Longinus's reach sits 19.5% (nose-on) and 24.9% (broadside) above what the allocator's flight measures - // (ruling allocator-divergence-accepted): the allocator holds the heading and pays for the drive torque out of - // the flank thrusters, so the envelope's box support (cut envelope-from-columns reads the allocator's columns) - // promises more than a controlled flight spends. - var ceiling = name == "djinni" ? 1.6f : 1.3f; - Assert.InRange(reach.noseOn, measured.noseOn * .9f, measured.noseOn * ceiling); - Assert.InRange(reach.broadside, measured.broadside * .9f, measured.broadside * ceiling); + if (name == "djinni") + { + Assert.InRange(reach.noseOn, measured.noseOn * .9f, measured.noseOn * 1.6f); + Assert.InRange(reach.broadside, measured.broadside * .9f, measured.broadside * 1.6f); + } + else + { + Assert.InRange(reach.noseOn, measured.noseOn * .9f, float.MaxValue); + Assert.InRange(reach.broadside, measured.broadside * .9f, float.MaxValue); + Assert.InRange(measured.noseOn, allocated.noseOn * .9f, allocated.noseOn * 1.15f); + Assert.InRange(measured.broadside, allocated.broadside * .9f, allocated.broadside * 1.15f); + } } } diff --git a/tests/Aetheria.Shared.Tests/RestoredHullsTests.cs b/tests/Aetheria.Shared.Tests/RestoredHullsTests.cs index 0dba1a567..b0235e840 100644 --- a/tests/Aetheria.Shared.Tests/RestoredHullsTests.cs +++ b/tests/Aetheria.Shared.Tests/RestoredHullsTests.cs @@ -19,14 +19,14 @@ using Random = CultMath.Random; // content restore-hulls landed, against the real shipped catalog, read-only: the hulls exist with the expected // thruster hardpoint counts, every thruster hardpoint accepts a catalog thruster design through TryEquip at its // own position, and the ship then moves and turns for a few ticks under MovementDirection/Turn on the -// pre-Cut-3 mixer -- proof of the restored content, not of a controller this cut does not touch. +// thrust allocator -- proof of the restored content, not of a controller this cut does not touch. public sealed class RestoredHullsTests { // Soul's finding #1 (this cut's fix batch 3): a hand-set GameplaySettings fixture left thermal radiation and // conduction at their bare-class defaults (1/1/1) against the shipped 3 / 1e-8 / 0.01 // (Assets/Resources/Settings.asset), so equipped parts froze toward 0 K, performance collapsed to 0 from // cold, and TorqueMultiplier defaulting to 0 on top of that made every thruster's yaw contribution silently - // zero (Ship.cs's mixer applies Torque*Thrust*TorqueMultiplier/Mass) -- velocity moved but Direction never + // zero (Thruster.Column applies Torque*Thrust*TorqueMultiplier/Mass) -- velocity moved but Direction never // turned, which looks exactly like a content defect instead of a fixture gap. AuthoredSettings // (tools/AetherDb/AuthoredSettings.cs) is the same headless YAML reader tools/AetherDb already uses to // inspect Settings.asset outside Unity; this loads the real GameplaySettings the same way instead of @@ -324,7 +324,7 @@ public sealed class RestoredHullsTests // "The ship then moves and turns... for a few ticks" (docs/locomotion-cut.md verification list). Equips // every thruster hardpoint with a fitting design, then drives MovementDirection/Turn the same way // ActionGameManager's player-input path does (docs' own consumer audit) and checks Entity.Velocity and - // Entity.Direction both move over a few ticks on the current (pre-Cut-3) mixer. + // Entity.Direction both move over a few ticks under the thrust allocator. [Theory] [InlineData("Longinus")] [InlineData("Djinni")] @@ -338,7 +338,7 @@ public sealed class RestoredHullsTests var startDirection = ship.Direction; ship.MovementDirection = float2(0, 1); // full forward, same axis ActionGameManager.Input.Player.Move drives - ship.Turn = 1; // a turn command, so the mixer's yaw thrusters have work to do + ship.Turn = 1; // a turn command, so the allocator's yaw thrusters have work to do for (var i = 0; i < 10; i++) zone.Update(1f / 60f); Assert.NotEqual(startVelocity, ship.Velocity); @@ -587,8 +587,8 @@ public sealed class RestoredHullsTests // flying: a real, unforced Longinus holds thrust (and the hull's own VelocityLimit) running well past the // window this test drives. // - // Real settings also retired the old +-10 tolerance's premise. On real physics the mixer's own tick order - // (Ship.cs: a tick's thrust-driven velocity is checked against VelocityLimit's cap on the FOLLOWING tick) + // Real settings also retired the old +-10 tolerance's premise. On real physics the tick order + // (Entity: a tick's thrust-driven velocity is checked against VelocityLimit's cap on the FOLLOWING tick) // settles into a steady state at the cap plus one tick's own forward acceleration, not at the literal cap -- // measured here at ~103.3 for this seed's generated loadout, not the ~110 an unconstrained +-10 tolerance // would also accept. +4 keeps that real headroom on the ceiling side. The floor is tighter (-3): a diff --git a/tests/Aetheria.Shared.Tests/ThrottleLockTests.cs b/tests/Aetheria.Shared.Tests/ThrottleLockTests.cs index 23b02fe17..38c883a6c 100644 --- a/tests/Aetheria.Shared.Tests/ThrottleLockTests.cs +++ b/tests/Aetheria.Shared.Tests/ThrottleLockTests.cs @@ -57,8 +57,8 @@ public sealed class ThrottleLockTests : IDisposable } // One thruster per intent direction, plus two reverse thrusters either side of the centre line, one of - // which has clockwise torque (the one Turn reaches). Thrusters are found by their item's rotation, as Ship - // sorts them. + // which has clockwise torque (the one Turn reaches). Thrusters are found by their item's rotation, as the + // allocator's columns carry them. // With `drivePair`, the forward drive on the centre line is replaced by a strong drive and a weak one either side of // it (their torques differ), so a hard turn has a drive to idle; the front strafe thrusters give way to them. private Fixture Build(float lockDuration, bool drivePair = false)