diff --git a/Aetheria.State.Daemon.Smoke/Program.cs b/Aetheria.State.Daemon.Smoke/Program.cs index 0f878278c..491d6c7e1 100644 --- a/Aetheria.State.Daemon.Smoke/Program.cs +++ b/Aetheria.State.Daemon.Smoke/Program.cs @@ -3,7 +3,12 @@ using GameCult.Aetheria.State.Verse; using System.Globalization; var checks = new AetheriaDaemonYmirSmokeChecks(); -if (args.Contains("--loadout", StringComparer.Ordinal)) +if (args.Contains("--gravity", StringComparer.Ordinal)) +{ + checks.RunGravity(); + Console.WriteLine("Daemon Ymir gravity-sign smoke passed."); +} +else if (args.Contains("--loadout", StringComparer.Ordinal)) { checks.RunLoadout(); Console.WriteLine("Daemon loadout hardpoint smoke passed."); @@ -21,6 +26,8 @@ else internal sealed class AetheriaDaemonYmirSmokeChecks { + public void RunGravity() => PositiveGravityDepthAttractsAndProjectsAsAWell(); + public void RunLoadout() => DaemonLoadoutsRespectFactionAvailabilityAndHullRoles(); public void RunPickup() @@ -31,6 +38,7 @@ internal sealed class AetheriaDaemonYmirSmokeChecks public void Run() { + PositiveGravityDepthAttractsAndProjectsAsAWell(); YmirMovesProjectileAndReportsStableContact(); InstantWeaponRequestSurvivesLockAcquisition(); ConstantWeaponRunsOnDaemonThroughYmirBeamContact(); @@ -79,6 +87,37 @@ internal sealed class AetheriaDaemonYmirSmokeChecks AgentTowsStationIntoPersistentOrbit(); } + private static void PositiveGravityDepthAttractsAndProjectsAsAWell() + { + var body = new AetheriaRuntimeBodySnapshotCommit + { + BodyKey = "gravity-owner", + GravityInfluenceCenterX = 0, + GravityInfluenceCenterZ = 0, + GravityInfluenceRadius = 100, + GravityWellDepth = 20 + }; + var actor = Entity(0, 10, "player"); + actor.PositionZ = 0; + actor.VelocityX = 0; + actor.VelocityY = 0; + var zone = new AetheriaRuntimeZoneSnapshotCommit + { + ZoneIndex = 0, + Bodies = [body], + Entities = [actor], + GravityTerrainRadius = 100, + GravityTerrainDepth = 5 + }; + + var step = new AetheriaYmirWorldPhysics().Step(zone, zone.Entities, 0.1); + var steppedActor = step.Bodies.Single(value => value.EntityIndex == actor.EntityIndex); + Require(steppedActor.VelocityX < 0, + "positive authored gravity depth must accelerate a body toward the well center through Ymir"); + Require(AetheriaRuntimeDaemonRenderQueries.EvaluateGravityTerrainHeight(zone, 10, 0, 0) < 0, + "the same positive gravity-depth magnitude must project as a negative terrain well"); + } + private static void ConstantWeaponRunsOnDaemonThroughYmirBeamContact() { var source = Entity(0, 0, "player"); diff --git a/Aetheria.State.Daemon/AetheriaDaemonZoneGenerator.cs b/Aetheria.State.Daemon/AetheriaDaemonZoneGenerator.cs index ac509657e..db92be6e0 100644 --- a/Aetheria.State.Daemon/AetheriaDaemonZoneGenerator.cs +++ b/Aetheria.State.Daemon/AetheriaDaemonZoneGenerator.cs @@ -86,7 +86,7 @@ internal static class AetheriaDaemonZoneGenerator Orbits = GenerateOrbits(), Bodies = GenerateBodies(), GravityTerrainRadius = 1900, - GravityTerrainDepth = -7, + GravityTerrainDepth = 7, GravityTerrainDepthExponent = 1.18, GravityTerrainBoundaryFog = 0.25, GravityTerrainWaveFrequency = 0.55, @@ -161,18 +161,18 @@ internal static class AetheriaDaemonZoneGenerator { return [ - Body("local.sun", "", "sun", "Terminus", 0, 0, 1600, 2.8, 980, -92, 3.0, 480, 11, 1.8), - Body("local.inner", "local.sun", "planet", "Cairn", 250, 0.45, 110, 0.78, 230, -20, 2.2, 92, 3, 1.0), - Body("local.blue", "local.sun", "planet", "Blueglass", 440, 2.45, 260, 1.18, 360, -36, 2.55, 150, 5, 1.1), - Body("local.blue.moon", "local.blue", "moon", "Latch", 520, 2.78, 70, 0.58, 170, -15, 2.8, 70, 2.2, 1.7), - Body("local.ember", "local.sun", "planet", "Emberhook", 640, 3.78, 220, 1.05, 330, -31, 2.25, 128, 4.2, 1.3), - Body("local.ember.moon", "local.ember", "moon", "Ashwake", 735, 3.45, 86, 0.62, 185, -16, 2.7, 72, 2.4, 1.45), - Body("local.belt", "local.sun", "asteroid_belt", "Cinder Belt", 760, -0.28, 140, 1.0, 310, -24, 2.0, 122, 4, 0.8), - Body("local.green", "local.sun", "planet", "Marrow", 930, 1.28, 180, 0.96, 300, -26, 2.35, 112, 3.6, 1.0), - Body("local.outer", "local.sun", "gas_giant", "Vesper", 1120, 0.58, 420, 1.55, 500, -48, 2.4, 230, 7, 0.72), - Body("local.outer.moon.a", "local.outer", "moon", "Iris", 1240, 0.88, 92, 0.66, 195, -17, 2.75, 78, 2.5, 1.2), - Body("local.outer.moon.b", "local.outer", "moon", "Hush", 1025, 0.28, 76, 0.55, 180, -15, 2.9, 70, 2.1, 1.5), - Body("local.deep", "local.sun", "gas_giant", "Nacre", 1420, 5.72, 340, 1.36, 440, -41, 2.55, 200, 5.8, 0.95) + Body("local.sun", "", "sun", "Terminus", 0, 0, 1600, 2.8, 980, 92, 3.0, 480, 11, 1.8), + Body("local.inner", "local.sun", "planet", "Cairn", 250, 0.45, 110, 0.78, 230, 20, 2.2, 92, 3, 1.0), + Body("local.blue", "local.sun", "planet", "Blueglass", 440, 2.45, 260, 1.18, 360, 36, 2.55, 150, 5, 1.1), + Body("local.blue.moon", "local.blue", "moon", "Latch", 520, 2.78, 70, 0.58, 170, 15, 2.8, 70, 2.2, 1.7), + Body("local.ember", "local.sun", "planet", "Emberhook", 640, 3.78, 220, 1.05, 330, 31, 2.25, 128, 4.2, 1.3), + Body("local.ember.moon", "local.ember", "moon", "Ashwake", 735, 3.45, 86, 0.62, 185, 16, 2.7, 72, 2.4, 1.45), + Body("local.belt", "local.sun", "asteroid_belt", "Cinder Belt", 760, -0.28, 140, 1.0, 310, 24, 2.0, 122, 4, 0.8), + Body("local.green", "local.sun", "planet", "Marrow", 930, 1.28, 180, 0.96, 300, 26, 2.35, 112, 3.6, 1.0), + Body("local.outer", "local.sun", "gas_giant", "Vesper", 1120, 0.58, 420, 1.55, 500, 48, 2.4, 230, 7, 0.72), + Body("local.outer.moon.a", "local.outer", "moon", "Iris", 1240, 0.88, 92, 0.66, 195, 17, 2.75, 78, 2.5, 1.2), + Body("local.outer.moon.b", "local.outer", "moon", "Hush", 1025, 0.28, 76, 0.55, 180, 15, 2.9, 70, 2.1, 1.5), + Body("local.deep", "local.sun", "gas_giant", "Nacre", 1420, 5.72, 340, 1.36, 440, 41, 2.55, 200, 5.8, 0.95) ]; } @@ -192,6 +192,9 @@ internal static class AetheriaDaemonZoneGenerator double waveDepth, double waveSpeed) { + if (gravityDepth <= 0) + throw new ArgumentOutOfRangeException(nameof(gravityDepth), "Gravity depth is an unsigned well magnitude; Ymir positive radial strength attracts."); + return new BodyPlan( key, parentKey, diff --git a/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs b/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs index de7cedb55..50b84678c 100644 --- a/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs +++ b/Aetheria.State/Documents/AetheriaRuntimeStateDocuments.cs @@ -277,6 +277,7 @@ public sealed class AetheriaZoneState public double GravityTerrainRadius { get; set; } [Key(10)] + // Positive magnitude. Terrain projection subtracts it to form a well. public double GravityTerrainDepth { get; set; } [Key(11)] @@ -382,6 +383,7 @@ public sealed class AetheriaBodySnapshot public double GravityInfluenceRadius { get; set; } [Key(16)] + // Positive magnitude. Ymir radial fields interpret positive strength as attraction. public double GravityWellDepth { get; set; } [Key(17)] diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeMainMenuSurfaceBuilder.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeMainMenuSurfaceBuilder.cs index 50403f62f..ff6b0e939 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeMainMenuSurfaceBuilder.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeMainMenuSurfaceBuilder.cs @@ -728,7 +728,7 @@ namespace GameCult.Aetheria.State.Verse return new AetheriaMainMenuGravityField( Math.Max(900, AutoViewRadius(currentZone, bodies, objects)), currentZone.GravityTerrainRadius > 0 ? currentZone.GravityTerrainRadius : 1200, - currentZone.GravityTerrainDepth == 0 ? -8 : currentZone.GravityTerrainDepth, + currentZone.GravityTerrainDepth == 0 ? 8 : currentZone.GravityTerrainDepth, currentZone.GravityTerrainDepthExponent <= 0 ? 1.0 : currentZone.GravityTerrainDepthExponent, currentZone.GravityTerrainWaveFrequency, currentZone.SimulationTimeSeconds, diff --git a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeSnapshotDocuments.cs b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeSnapshotDocuments.cs index dabdce254..ef674c56e 100644 --- a/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeSnapshotDocuments.cs +++ b/Packages/org.gamecult.aetheria.state/Runtime/AetheriaRuntimeSnapshotDocuments.cs @@ -571,6 +571,7 @@ namespace GameCult.Aetheria.State.Verse public double GravityTerrainRadius { get; set; } [Key(12)] + // Positive magnitude. Terrain projection subtracts it to form a well. public double GravityTerrainDepth { get; set; } [Key(13)] @@ -773,6 +774,7 @@ namespace GameCult.Aetheria.State.Verse public double GravityInfluenceRadius { get; set; } [Key(18)] + // Positive magnitude. Ymir radial fields interpret positive strength as attraction. public double GravityWellDepth { get; set; } [Key(19)]