Restore Goddard leveling and Scooter positional pitch processing

This commit is contained in:
UnixNight committed 2026-11-04 18:27:56 -05:00
1 parent 74be19eb15
commit fccc0b9d1b
24 files changed
+967 -8

No files matched your search

@@ -6,5 +6,6 @@
<Compile Include="../../src/GamePort/Application/PlayerGadgetMaterial.cs"/>
<Compile Include="../../src/GamePort/Application/ScooterVisuals.cs"/>
<None Include="original-motion-reference.json" CopyToOutputDirectory="PreserveNewest"/>
<None Include="original-leveling-reference.json" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup>
</Project>
+31
View File
@@ -15,6 +15,8 @@ var tests=new(string,Action)[]{("copied-original drive/input/facing/terrain obse
("actual tutorial RETURN accepts the passenger and cleans vehicle",Return),
("original vehicle/wheel/rider geometry stays unit scale",Visuals),
("outside companion follows, freezes while summoned, and returns near Jimmy",Companion),
("tilted dismount preserves handoff then Goddard gradually levels",DismountTilt),
("copied-original Goddard leveling rates and seams",GoddardOriginal),
};
foreach(var(name,test)in tests){test();Console.WriteLine("PASS "+name);}Console.WriteLine($"Scooter integration: {tests.Length} groups passed.");
static void Original()
@@ -132,6 +134,35 @@ static void Companion()
NearV(dog.Position,jimmy.Position+RocketOrientation.Rotate(new(0,0,-800),jimmy.Rotation),"far follow warp");
f.D.EnsureCompanion(jimmy.Position,Vector3.Zero);NearV(dog.Position,jimmy.Position,"explicit reset placement updates existing actor");
}
static void DismountTilt()
{
using var f=new Fixture("VR05");var dog=f.D.FindActor("C3DGODDARD")!;
var patrol=new ActorPatrol(dog,f.D.FindActor,(b,_)=>b){FollowPlayer=true};
f.Summon();f.Mount();
for(int i=0;i<20;i++)f.Frame(new(true,false,true,false,false));
var rotation=f.S.Rotation;Check(Math.Abs(rotation.Z)>10,"actual steering produces vehicle lean");
f.I.Inventory.SelectGadget(-1);NearV(dog.Rotation,rotation,"cleanup copies full source Euler");
static float Tilt(float degrees)=>MathF.Abs((degrees+540)%360-180);
float before=Tilt(dog.Rotation.Z);patrol.Step(.1f);
Check(Tilt(dog.Rotation.Z)<before&&Tilt(dog.Rotation.Z)>before*.9f,"leveling is gradual in next AI phase");
for(int i=0;i<300;i++)patrol.Step(FixedStepClock.Step);
Check(Tilt(dog.Rotation.Z)<before*.25f,"companion does not retain scooter lean");
dog.MovementEnabled=false;rotation=dog.Rotation;patrol.Step(.1f);Check(dog.Rotation==rotation,"disabled companion does not update facing");
}
static void GoddardOriginal()
{
using var document=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-leveling-reference.json")));
int compared=0;
foreach(var c in document.RootElement.GetProperty("cases").EnumerateArray())
{
var p=c.GetProperty("input").EnumerateArray().Select(v=>v.GetSingle()).ToArray();
if(p[6]==0||p[7]==0)continue; //Native gate observations are guarded separately.
var o=c.GetProperty("observed").EnumerateArray().Select(v=>v.GetSingle()).ToArray();
var rotation=new Vector3(p[0],p[1],p[2]);for(int i=0;i<(int)p[5];i++)rotation=ActorPatrol.GoddardFacing(rotation,p[3],p[4]);
NearV(rotation,new(o[0],o[1],o[2]),c.GetProperty("name").GetString()!);compared++;
}
Check(compared==9,"nine active native leveling observations");
}
static void Check(bool ok,string name){if(!ok)throw new Exception(name);}
static void Near(float a,float b,string name)=>Check(float.IsFinite(a)&&Math.Abs(a-b)<.02f,$"{name}: {a} != {b}");
static void NearV(Vector3 a,Vector3 b,string name)=>Check(Vector3.Distance(a,b)<.04f,$"{name}: {a} != {b}");
@@ -0,0 +1,237 @@
{
"source_sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
"ranges": [
{
"va": "0x4096e0",
"file_offset": "0x96e0",
"length": 429,
"sha256": "16008268af9cb0e2a04891d3743cb9c9fa36b42e55f67f807c0f97df716cec1d"
},
{
"va": "0x4093bd",
"file_offset": "0x93bd",
"length": 27,
"sha256": "66249ec334f140cd090fe7e25c6476ebfbff6be31a7346c234d10d1ff1e496ee"
},
{
"va": "0x41c8db",
"file_offset": "0x1c8db",
"length": 49,
"sha256": "d30bf58fc7fc8d9b51c6fe88b9135fb33856f5bb53f2ded2a23d7c2000606639"
},
{
"va": "0x472480",
"file_offset": "0x72480",
"length": 240,
"sha256": "406c3904538abe07d88ca440e39ca56c00765d0871943991ba7b792da4803c16"
}
],
"scope": "Copied4096E0 plus472480, Goddard factors, synthetic enabled/dirty actor; no original AI/body/game entrypoint.",
"files": {
"tools/binary/goddard_leveling.py": "ea082906a5b2cb799238f1c4f4d04ac23e5a672f3665cbcf8c4de11ffd4c22ae",
"tools/binary/goddard_leveling_probe.c": "5fb6ce399234fbaaa54f64365f899384c16876fb3722cd90561aeb43786061c5",
"tools/binary/grappler_scalar_probe.c": "c51cc1ecefaf7a90e69a40624fd0e8cd7e01500359c4e67aee6213bb36f4a810",
"artifacts/scooter-dismount-followup/goddard_leveling_probe.exe": "51bdc2b13fda9865b5ad67184195e057396fd339f3bca16f37975c42e01e2270",
"artifacts/scooter-dismount-followup/probe-ready/wine.log": "dac3580123ff07f7c5d97a2d66f3a314b660cbc2ab434bed984f5e910c985584"
},
"cases": [
{
"name": "tilted",
"input": [
20.0,
90.0,
30.0,
90.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
19.3999996,
90.0,
29.1000004
]
},
{
"name": "opposite",
"input": [
340.0,
90.0,
330.0,
90.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
340.600006,
90.0,
330.899994
]
},
{
"name": "seam",
"input": [
350.0,
359.0,
350.0,
1.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
350.299988,
359.640015,
350.299988
]
},
{
"name": "negative",
"input": [
-20.0,
-10.0,
-30.0,
20.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
341.0,
360.0,
331.0
]
},
{
"name": "equal180",
"input": [
180.0,
180.0,
180.0,
0.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
174.600006,
122.399994,
174.600006
]
},
{
"name": "over180",
"input": [
181.0,
181.0,
181.0,
0.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
186.369995,
238.279999,
186.369995
]
},
{
"name": "tick",
"input": [
20.0,
90.0,
30.0,
90.0,
0.0166666675,
1.0,
1.0,
1.0
],
"observed": [
19.8999996,
90.0,
29.8500004
]
},
{
"name": "five_seconds",
"input": [
20.0,
90.0,
30.0,
90.0,
0.0166666675,
300.0,
1.0,
1.0
],
"observed": [
4.44584179,
90.0,
6.6687665
]
},
{
"name": "upright",
"input": [
0.0,
90.0,
0.0,
90.0,
0.100000001,
1.0,
1.0,
1.0
],
"observed": [
0.0,
90.0,
0.0
]
},
{
"name": "disabled",
"input": [
20.0,
90.0,
30.0,
90.0,
0.100000001,
1.0,
0.0,
1.0
],
"observed": [
20.0,
90.0,
30.0
]
},
{
"name": "clean",
"input": [
20.0,
90.0,
30.0,
90.0,
0.100000001,
1.0,
1.0,
0.0
],
"observed": [
20.0,
90.0,
30.0
]
}
]
}