Integrate source airborne tilt and logical-root rendering

This commit is contained in:
UnixNight committed 2026-11-05 10:19:12 -05:00
1 parent a61f1b0284
commit 27be8ed630
36 files changed
+1953 -62

No files matched your search

+4
View File
@@ -151,6 +151,10 @@ foreach (var kind in new[] { "3CAM", "3MCA", "3AIT" })
var bag = new SceneInventory(new int[19]); bag.SetState(0, 3, 1); bag.SelectGadget(3);
using var binding = new PlayerSceneBinding(scene, body, bag, "JIM1");
for (var tick = 0; tick < 5; tick++) binding.Step(new(true, false, false, false, false));
//Full Euler sync now reflects the ground input's leveling. Seed the authored
//tilt immediately before the command to isolate preparation ownership.
body.ApplyAuthoredTransform(body.ActorRoot,new Vector3(12,body.Yaw,0));
scene.SyncActor("JIM1",body.ActorRoot,body.Rotation);
var callbacks = new List<ScriptPreparation>();
scene.ActorPreparing += (actor, action) =>
{
@@ -37,5 +37,6 @@
<Compile Include="../../src/GamePort/Game/JimmyGroundMotion.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyAirMotion.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyOrientation.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyRenderTransform.cs"/>
</ItemGroup>
</Project>
@@ -2,5 +2,6 @@
<PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><EnableDefaultCompileItems>false</EnableDefaultCompileItems></PropertyGroup>
<ItemGroup><Compile Include="Program.cs"/><Compile Include="../../src/GamePort/Assets/*.cs"/><Compile Include="../../src/GamePort/Game/*.cs"/>
<None Include="original-air-reference.json" CopyToOutputDirectory="PreserveNewest"/>
<None Include="original-air-targets-reference.json" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup>
</Project>
+13
View File
@@ -21,6 +21,19 @@ foreach(var c in doc.RootElement.GetProperty("cases").EnumerateArray())
Check(inputs==22&&applies==13,"complete original observations");
Console.WriteLine("PASS22 copied-original airborne keyboard-input observations, including supported mode1, coast boundary and latch");
Console.WriteLine("PASS13 copied-original air velocity/Euler observations, including zero velocity, pitch, seam and original vertical preservation");
using var targets=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-air-targets-reference.json")));
int writes=0;
foreach(var c in targets.RootElement.GetProperty("cases").EnumerateArray())
{
var p=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
var input=new PlayerInput(p[0]!=0,p[1]!=0,p[2]!=0,p[3]!=0,false);
var steering=JimmyAirMotion.Input(new(p[4],0,false),input,p[5]!=0,1f/60);
NearV(JimmyAirMotion.Destination(input,45,steering.TurnRate,p[6],p[7]),new(o[0],o[1],o[2]),"original destination write");
Check(o[3]==1,"source wrote exactly once");writes++;
}
Check(writes==12,"complete destination observations");
Console.WriteLine("PASS12 copied-original air destination-Euler observations, including retained pitch seeds and Up precedence");
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)<.005f,$"{name}: {a} != {b}");
static void NearV(Vector3 a,Vector3 b,string name)=>Check(float.IsFinite(a.X+a.Y+a.Z)&&Vector3.Distance(a,b)<.04f,$"{name}: {a} != {b}");
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup><OutputType>Exe</OutputType><TargetFramework>net10.0</TargetFramework><ImplicitUsings>enable</ImplicitUsings><Nullable>enable</Nullable><EnableDefaultCompileItems>false</EnableDefaultCompileItems></PropertyGroup>
<ItemGroup>
<Compile Include="Program.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyRenderTransform.cs"/>
<Compile Include="../../src/GamePort/Game/RocketOrientation.cs"/>
<None Include="original-render-reference.json" CopyToOutputDirectory="PreserveNewest"/>
</ItemGroup>
</Project>
@@ -0,0 +1,54 @@
using System.Numerics;
using System.Text.Json;
using GamePort.Game;
using var doc=JsonDocument.Parse(File.ReadAllText(Path.Combine(AppContext.BaseDirectory,"original-render-reference.json")));
int angles=0,transforms=0;float largestRenderDeviation=0;
foreach(var c in doc.RootElement.GetProperty("angles").EnumerateArray())
{
var p=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetInt32()).ToArray();
for(int i=0;i<3;i++)Check(JimmyRenderTransform.AngleUnits(p[i])==o[i],$"degree cache {c.GetProperty("name")}, axis{i}");
angles++;
}
foreach(var c in doc.RootElement.GetProperty("models").EnumerateArray())
{
var p=c.GetProperty("input").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
var o=c.GetProperty("observed").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
var render=c.GetProperty("render").EnumerateArray().Select(x=>x.GetSingle()).ToArray();
var root=new Vector3(p[3],p[4],p[5]);var euler=new Vector3(p[0],p[1],p[2])*(360f/16384);
var m=JimmyRenderTransform.Source(root,euler);var a=Values(m);
for(int i=0;i<15;i++)Near(a[i],o[i],.000001f,$"original hxform {c.GetProperty("name")}, value{i}");
//The source's render consumer decomposes and re-quantizes the basis. The
//hierarchical model bridge intentionally defers that final precision step.
for(int i=0;i<16;i++)largestRenderDeviation=Math.Max(largestRenderDeviation,Math.Abs(a[i]-render[i]));
Check(new Vector3(m.M41,m.M42,m.M43)==root,"Euler must not rotate root translation");
Near(m.GetDeterminant(),1,.000001f,"unit-scale proper rotation");transforms++;
}
Check(angles==12&&transforms==14,"complete original transform fixture");
Console.WriteLine("PASS12 copied-original degree/short cache and14 OMT hierarchical transform observations");
Near(largestRenderDeviation,.007286334f,.000002f,"recorded final render consumer deviation remains an explicit precision gate");
Console.WriteLine($"RECOVERED14 final render matrices: hierarchical bridge max deviation={largestRenderDeviation:G9}; final decomposition remains separate");
const float minimum=-64.6165f,height=75.9f;float correction=-minimum-height;
var actorRoot=new Vector3(123,height,456);
var upright=JimmyRenderTransform.Aligned(actorRoot,Vector3.Zero,correction);
Near(Vector3.Transform(new(0,minimum,0),upright).Y,0,.00002f,"upright baseline sole placement");
foreach(var euler in new[]{new Vector3(-40,45,-15),new Vector3(10,220,15),new Vector3(0,0,90)})
{
var model=JimmyRenderTransform.Aligned(actorRoot,euler,correction);
Check(Vector3.Distance(Vector3.Transform(new(0,-correction,0),model),actorRoot)<.00004f,
"compatibility correction is local: the logical pivot remains fixed under combined tilt");
}
Console.WriteLine("PASS modern local sole correction preserves upright placement and the logical tilt pivot");
foreach(var bad in new[]{float.NaN,float.PositiveInfinity,float.NegativeInfinity})
{
Throws(()=>JimmyRenderTransform.AngleUnits(bad));
Throws(()=>JimmyRenderTransform.Source(new(bad,0,0),Vector3.Zero));
Throws(()=>JimmyRenderTransform.Source(Vector3.Zero,new(0,bad,0)));
Throws(()=>JimmyRenderTransform.Aligned(Vector3.Zero,Vector3.Zero,bad));
}
Console.WriteLine("PASS nonfinite transform inputs rejected");
static float[] Values(Matrix4x4 m)=>[m.M11,m.M12,m.M13,m.M14,m.M21,m.M22,m.M23,m.M24,m.M31,m.M32,m.M33,m.M34,m.M41,m.M42,m.M43,m.M44];
static void Check(bool value,string message){if(!value)throw new Exception(message);}
static void Near(float value,float expected,float tolerance,string message)=>Check(float.IsFinite(value)&&Math.Abs(value-expected)<=tolerance,$"{message}: {value} != {expected}");
static void Throws(Action action){try{action();}catch(ArgumentOutOfRangeException){return;}throw new Exception("nonfinite input accepted");}
@@ -0,0 +1,925 @@
{
"exe": {
"sha256": "f5281076e1a2492f2d61f87aae3f4544b6d0f535ebe33f9fbb6f78710fe1aea8",
"ranges": [
{
"va": "0x4624b0",
"file_offset": "0x624b0",
"length": 64,
"sha256": "be80b2bde09dde5d668389d64d330c3b996e8a3cbd50cda5eb1394bb9be99515"
},
{
"va": "0x462500",
"file_offset": "0x62500",
"length": 30,
"sha256": "71f83f2a073bd2458d3c7b31e6398fb9af5f92a6139ee6364b4339c68d60458d"
},
{
"va": "0x473540",
"file_offset": "0x73540",
"length": 154,
"sha256": "145007991bf3514edba29d8df8c94eae069cf2d0d21034dea24d69eb611e9ab0"
},
{
"va": "0x4723f0",
"file_offset": "0x723f0",
"length": 48,
"sha256": "ae10074b5ae2ff3d2d2ce8c16358476acdba2f2a166be8ad5c9f05e3f55ffc23"
},
{
"va": "0x47f940",
"file_offset": "0x7f940",
"length": 39,
"sha256": "d0a2aca68648a0ae9d5cbfae1b276d4a64d4f797fc0c60f28b64096cdfa3148c"
},
{
"va": "0x4802ca",
"file_offset": "0x802ca",
"length": 40,
"sha256": "a0dc90a444c3cd46550d18d44ab2a72c8569644044248528c9979457e88ffd3e"
}
]
},
"dll": {
"sha256": "3ec41ead011adf56387a6dbd4580e5b5a9721b5f8020c8a56420f42824354943",
"ranges": [
{
"va": "0x1003fa60",
"file_offset": "0x3fa60",
"length": 400,
"sha256": "3032a99d8c5781eca782d91ea4aa06c2e30531aca01f869f6986d01eeb972e6d"
},
{
"va": "0x1003fc00",
"file_offset": "0x3fc00",
"length": 868,
"sha256": "cbec74de9d7e4fc064a3100d450e28147e29cceddab5c9a5d5d01caf7897a624"
},
{
"va": "0x10041d50",
"file_offset": "0x41d50",
"length": 512,
"sha256": "127a0e34d2ca6d9769fa9609b7ac22a58b743a0b2ac0564164f68240796f4696"
}
]
},
"bindings": [
{
"table": "0x4a373c",
"slot": "0x310",
"target": "0x472300"
},
{
"table": "0x4a373c",
"slot": "0x328",
"target": "0x4723f0"
},
{
"table": "0x4a373c",
"slot": "0x3dc",
"target": "0x4624b0"
},
{
"table": "0x4a373c",
"slot": "0x3e0",
"target": "0x4624f0"
},
{
"table": "0x4a373c",
"slot": "0x3e4",
"target": "0x462500"
}
],
"degree_constants": {
"0x4d6408": 45.51111111111111,
"0x4d6410": 360.0
},
"models": [
{
"name": "upright",
"input": [
0.0,
0.0,
0.0,
100.0,
75.9000015,
-200.0
],
"observed": [
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
100.0,
75.9000015,
-200.0
],
"render": [
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
100.0,
75.9000015,
-200.0,
1.0,
6.0
]
},
{
"name": "pitch90",
"input": [
4096.0,
0.0,
0.0,
100.0,
75.9000015,
-200.0
],
"observed": [
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
-1.0,
0.0,
0.0,
1.0,
0.0,
0.0,
100.0,
75.9000015,
-200.0
],
"render": [
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
-1.0,
0.0,
0.0,
1.0,
0.0,
0.0,
100.0,
75.9000015,
-200.0,
1.0,
6.0
]
},
{
"name": "yaw90",
"input": [
0.0,
4096.0,
0.0,
100.0,
75.9000015,
-200.0
],
"observed": [
0.0,
0.0,
1.0,
0.0,
0.0,
1.0,
0.0,
0.0,
-1.0,
0.0,
0.0,
0.0,
100.0,
75.9000015,
-200.0
],
"render": [
0.0,
0.0,
1.0,
0.0,
0.0,
1.0,
0.0,
0.0,
-1.0,
0.0,
0.0,
0.0,
100.0,
75.9000015,
-200.0,
1.0,
6.0
]
},
{
"name": "roll90",
"input": [
0.0,
0.0,
4096.0,
100.0,
75.9000015,
-200.0
],
"observed": [
0.0,
-1.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
100.0,
75.9000015,
-200.0
],
"render": [
0.0,
-1.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
100.0,
75.9000015,
-200.0,
1.0,
6.0
]
},
{
"name": "air_forward",
"input": [
14564.0,
2048.0,
15702.0,
100.0,
500.0,
-200.0
],
"observed": [
0.565557301,
0.198106021,
0.800561607,
0.0,
-0.621811032,
0.740098596,
0.256134927,
0.0,
-0.541752696,
-0.642657042,
0.541752696,
0.0,
100.0,
500.0,
-200.0
],
"render": [
0.565611005,
0.198169738,
0.800507903,
0.0,
-0.621610343,
0.740336657,
0.255934209,
0.0,
-0.54192692,
-0.642363191,
0.54192692,
0.0,
100.0,
500.0,
-200.0,
1.0,
6.0
]
},
{
"name": "air_brake",
"input": [
455.0,
2048.0,
682.0,
100.0,
500.0,
-200.0
],
"observed": [
0.651317656,
-0.254645705,
0.714801311,
0.0,
0.301421434,
0.951323569,
0.0642546937,
0.0,
-0.696369469,
0.173606217,
0.696369469,
0.0,
100.0,
500.0,
-200.0
],
"render": [
0.651386678,
-0.254662871,
0.71473223,
0.0,
0.301163465,
0.951387763,
0.06451267,
0.0,
-0.696416497,
0.173228532,
0.696416497,
0.0,
100.0,
500.0,
-200.0,
1.0,
6.0
]
},
{
"name": "full_axes",
"input": [
1365.0,
2503.0,
910.0,
-123.5,
811.25,
70.125
],
"observed": [
0.399019778,
-0.296150625,
0.867800713,
0.0,
0.580931485,
0.813882947,
0.0106347203,
0.0,
-0.709437668,
0.499889284,
0.496798605,
0.0,
-123.5,
811.25,
70.125
],
"render": [
0.399112821,
-0.29621619,
0.867735505,
0.0,
0.580675781,
0.814063072,
0.0108137615,
0.0,
-0.709594667,
0.499557108,
0.496908575,
0.0,
-123.5,
811.25,
70.125,
1.0,
6.0
]
},
{
"name": "negative_units",
"input": [
-1820.0,
-2048.0,
-682.0,
-123.5,
811.25,
70.125
],
"observed": [
0.800561607,
0.198106021,
-0.565557301,
0.0,
0.256134927,
0.740098596,
0.621811032,
0.0,
0.541752696,
-0.642657042,
0.541752696,
0.0,
-123.5,
811.25,
70.125
],
"render": [
0.800507903,
0.198169738,
-0.565611005,
0.0,
0.255934209,
0.740336657,
0.621610343,
0.0,
0.54192692,
-0.642363191,
0.54192692,
0.0,
-123.5,
811.25,
70.125,
1.0,
6.0
]
},
{
"name": "seam",
"input": [
16383.0,
16383.0,
16383.0,
0.0,
0.0,
0.0
],
"observed": [
0.999999881,
0.000383495149,
-0.000383348088,
0.0,
-0.000383348088,
0.999999881,
0.000383642182,
0.0,
0.000383495149,
-0.000383495179,
0.999999881,
0.0,
0.0,
0.0,
0.0
],
"render": [
0.99994123,
0.00766982883,
-0.00766960345,
0.0,
-0.00766960345,
0.999970615,
5.88262737e-05,
0.0,
0.00766982883,
0.0,
0.999970615,
0.0,
0.0,
0.0,
0.0,
1.0,
6.0
]
},
{
"name": "canonical360",
"input": [
16384.0,
16384.0,
16384.0,
0.0,
0.0,
0.0
],
"observed": [
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0
],
"render": [
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
6.0
]
},
{
"name": "halfturn",
"input": [
8192.0,
8192.0,
8192.0,
0.0,
0.0,
0.0
],
"observed": [
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
-0.0,
-0.0,
1.0,
0.0,
0.0,
0.0,
0.0
],
"render": [
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
0.0,
0.0,
0.0,
0.0,
1.0,
6.0
]
},
{
"name": "tiny",
"input": [
1.0,
2.0,
3.0,
0.0,
0.0,
0.0
],
"observed": [
0.999999046,
-0.00115048536,
0.000767431164,
0.0,
0.00115077931,
0.999999285,
-0.000382612576,
0.0,
-0.000766990415,
0.000383495353,
0.999999642,
0.0,
0.0,
0.0,
0.0
],
"render": [
0.99994123,
-0.00766982883,
0.00766960345,
0.0,
0.00766960345,
0.999970615,
5.88262737e-05,
0.0,
-0.00766982883,
0.0,
0.999970615,
0.0,
0.0,
0.0,
0.0,
1.0,
6.0
]
},
{
"name": "zero_root",
"input": [
14564.0,
2048.0,
15702.0,
0.0,
0.0,
0.0
],
"observed": [
0.565557301,
0.198106021,
0.800561607,
0.0,
-0.621811032,
0.740098596,
0.256134927,
0.0,
-0.541752696,
-0.642657042,
0.541752696,
0.0,
0.0,
0.0,
0.0
],
"render": [
0.565611005,
0.198169738,
0.800507903,
0.0,
-0.621610343,
0.740336657,
0.255934209,
0.0,
-0.54192692,
-0.642363191,
0.54192692,
0.0,
0.0,
0.0,
0.0,
1.0,
6.0
]
},
{
"name": "other_root",
"input": [
14564.0,
2048.0,
15702.0,
1000.0,
1011.25,
-2500.0
],
"observed": [
0.565557301,
0.198106021,
0.800561607,
0.0,
-0.621811032,
0.740098596,
0.256134927,
0.0,
-0.541752696,
-0.642657042,
0.541752696,
0.0,
1000.0,
1011.25,
-2500.0
],
"render": [
0.565611005,
0.198169738,
0.800507903,
0.0,
-0.621610343,
0.740336657,
0.255934209,
0.0,
-0.54192692,
-0.642363191,
0.54192692,
0.0,
1000.0,
1011.25,
-2500.0,
1.0,
6.0
]
}
],
"angles": [
{
"name": "zero",
"input": [
0.0,
0.0,
0.0
],
"observed": [
0,
0,
0
]
},
{
"name": "forward",
"input": [
-40.0,
45.0,
-15.0
],
"observed": [
14564,
2048,
15702
]
},
{
"name": "backward",
"input": [
10.0,
45.0,
15.0
],
"observed": [
455,
2048,
682
]
},
{
"name": "quarter",
"input": [
90.0,
180.0,
270.0
],
"observed": [
4096,
8192,
12288
]
},
{
"name": "revolutions",
"input": [
360.0,
720.0,
-360.0
],
"observed": [
0,
0,
0
]
},
{
"name": "negative",
"input": [
-0.5,
-40.0,
-359.998993
],
"observed": [
16362,
14564,
1
]
},
{
"name": "fractional",
"input": [
0.00100000005,
359.998993,
-0.00100000005
],
"observed": [
0,
16383,
0
]
},
{
"name": "arbitrary",
"input": [
0.0166666675,
30.0,
7.30000019
],
"observed": [
0,
1365,
332
]
},
{
"name": "large",
"input": [
1440.75,
-725.25,
9999.99023
],
"observed": [
34,
16146,
12742
]
},
{
"name": "exact_units",
"input": [
0.0219726562,
0.0439453125,
0.0659179688
],
"observed": [
1,
2,
3
]
},
{
"name": "canonical",
"input": [
360.0,
360.0,
360.0
],
"observed": [
0,
0,
0
]
},
{
"name": "seam",
"input": [
359.98999,
-0.00999999978,
-720.01001
],
"observed": [
16383,
0,
0
]
}
],
"scope": "Original OMT compute_hxform and compute_model_matrix with synthetic zero-offset element/identity parent; original EXE473540\u2192462500 with synthetic Euler getter and original finite remainder primitive; CRT exception dispatch bypassed. No game/render entrypoint or whole-game trajectory.",
"files": {
"tools/binary/jimmy_model_bridge.py": "c2270f046fc35ecd6e52af94df075ecce99d7309a5d66bcae2e46094665dab35",
"tools/binary/jimmy_model_bridge_probe.c": "71a186c9132d9378216b7291f0eea494dad7aa060bec410c7e0bc2f48abd2539",
"tools/binary/jimmy_model_bridge_angles_probe.c": "4bbb8de48806e33c9aeb4402f369e7d2212ea4a0710fb111dec41c3d8eaa910d",
"artifacts/jimmy-model-bridge/jimmy_model_bridge_probe.exe": "897ba58d9c6231587a20638b197304fa421880d46f7eb2516188caeed2a82a4d",
"artifacts/jimmy-model-bridge/jimmy_model_bridge_angles_probe.exe": "574323679fbea46a8bc072eba4c485158ede3371e152e359d9c00f33baf1cc4d",
"artifacts/jimmy-model-bridge/probe/wine.log": "fd0d486c2e416ae08623d583fbf7e856b2170918ebb57c984ca91cb9d5fe0060",
"artifacts/jimmy-model-bridge/angles.log": "9d34919b022183db096b6555c2e54c5c51dbab012ba53b45607c21b9a8777fb3"
}
}
+69 -3
View File
@@ -19,6 +19,8 @@ var tests = new (string Name, Action Check)[]
("backpedal cap and release", Backpedal),
("yaw sign, forward half-turn and left precedence", Turning),
("active heading clears stale turn while control lock retains facing", FacingOwnership),
("Init and authored Euler keep destination and dirty ownership separate", FacingState),
("air target and pitch seed phases survive mode and route transitions", AirPitchPhases),
("fixed-step input replay independent of presentation rate", ReplayRates),
("jump rises, falls and returns to support", JumpLanding),
("held zero-burn jump repeats and release stops repetition", HeldJump),
@@ -398,7 +400,7 @@ static void FacingOwnership()
"base facing advances its retained target during control lock while input and jump remain gated");
var tilted = FlatSimulation();
tilted.SeedBubbleTilt(new(350, 0, 10));
tilted.ApplyAuthoredTransform(tilted.ActorRoot,new Vector3(350, 0, 10));
tilted.Step(new(true, false, false, false, false));
Check(tilted.Pitch > 350 && tilted.Pitch < 351 && tilted.Roll < 10 && tilted.Roll > 9,
"ground heading levels all axes by the shortest arc through the zero seam");
@@ -408,6 +410,68 @@ static void FacingOwnership()
"pitch and roll settling belong to the same control-independent facing phase");
}
static void FacingState()
{
var simulation=FlatSimulation(155);
Check(simulation.FacingTarget==Vector3.Zero&&!simulation.FacingDirty,
"Init clears destination axes and dirty while STRT supplies current yaw");
simulation.ApplyAuthoredTransform(simulation.ActorRoot,new Vector3(15,275,20));
simulation.Step(default,controlled:false);
NearVector(simulation.Rotation,new(15,275,20),0,"authored current Euler survives without an active destination");
Check(simulation.FacingTarget==Vector3.Zero&&!simulation.FacingDirty,"authored write does not invent a destination write");
simulation.Step(new(true,false,false,false,false));
Check(simulation.FacingTarget==new Vector3(0,275,0)&&simulation.FacingDirty,
"accepted ground heading writes upright destination; before-step difference keeps dirty");
Check(simulation.Pitch<15&&simulation.Roll<20,"base facing consumes the new full-axis destination");
simulation.Reset();
simulation.Step(default,controlled:false);
Near(simulation.Yaw,155,0,"reset's zero destination cannot pull authored yaw toward zero");
Check(!simulation.FacingDirty,"inactive reset destination stays clean");
simulation.Step(new(true,false,false,false,false));
Check(!simulation.FacingDirty&&simulation.FacingTarget==simulation.Rotation,
"source clears dirty when all current axes already equal the written target");
}
static void AirPitchPhases()
{
var forward=new PlayerInput(true,false,false,false,true);
var simulation=FlatSimulation();
simulation.Step(forward); //Ground input, then ordinary air apply seeds−40/+10.
simulation.Step(forward);
Check(simulation.FacingTarget.X==-40&&simulation.FacingTarget.Z==0,
"ordinary airborne throttle publishes source forward pitch");
Check(MathF.IEEERemainder(simulation.Pitch,360)<0&&simulation.Velocity.Y>0,
"current pitch follows target while incoming vertical motion remains physical");
simulation.Step(new(false,true,false,true,true));
Check(simulation.FacingTarget.X==10&&simulation.FacingTarget.Z>0,
"backward target and turn lean use the updated air turn scalar");
var tilted=FlatSimulation();
for(var tick=0;tick<40;tick++)tilted.Step(forward);
Check(!tilted.Grounded&&tilted.Speed==600&&new Vector2(tilted.Velocity.X,tilted.Velocity.Z).Length()<550,
"source air pitch attenuates horizontal forward while retaining the controller speed scalar");
tilted.SetNoclip(true);
Check(!tilted.FacingDirty&&tilted.FacingTarget==tilted.Rotation,"modern noclip entry freezes the pending airborne facing request");
foreach(var retained in new[]{false,true})
{
var bubble=FlatSimulation();bubble.InputAfterPlayerUpdate=retained;bubble.GadgetMode=0;
bubble.Step(new(false,false,false,false,false,Fire:true));
Near(bubble.FacingTarget.X,retained?-10:-40,0,"first Bubble input reads pitch from its preceding apply phase");
Near(bubble.ForwardAirPitch,-10,0,"Bubble apply seeds the next input's pitch");
bubble.GadgetMode=-1;
var carried=bubble.CaptureLevelState(-1)!;
Near(carried.ForwardPitch,-10,0,"cleanup retains the field rather than inferring it from current mode");
var destination=FlatSimulation();destination.LevelCode="VR04";
Check(destination.ApplyRetainedLevelState(carried with{MovementMode=1}),"route accepts proven retained pitch fields");
Check(destination.FacingTarget==Vector3.Zero&&!destination.FacingDirty,"route Init resets destination independently of retained pitches");
destination.Step(forward);
Near(destination.FacingTarget.X,-10,0,"first ordinary air input can consume a prior Bubble pitch seed");
Near(destination.ForwardAirPitch,-40,0,"ordinary apply restores its own pitch seeds afterward");
destination.Step(forward);
Near(destination.FacingTarget.X,-40,0,"following input consumes ordinary seed");
}
}
static void ReplayRates()
{
LabSimulation? reference = null;
@@ -524,8 +588,10 @@ static void JetpackControl()
}
Check(straight.Position.Z > 400 && left.Yaw > 20 && MathF.IEEERemainder(right.Yaw,360)<-20,
"powered Up moves from rest and Left/Right turn while airborne");
Check(left.Position.X < -50 && right.Position.X > 50 && left.Position.Y > initialHeight,
"powered paths change direction and retain vertical lift");
//Recovered forward pitch attenuates horizontal travel; this verifies a
//measurable change of path without retaining the old flat-air distance.
Check(left.Position.X < -30 && right.Position.X > 30 && left.Position.Y > initialHeight,
$"powered paths change direction and retain vertical lift: left={left.Position}, right={right.Position}, initialY={initialHeight}");
var beforeBrake = left.Speed;
for (var i = 0; i < 40; i++) left.Step(new(false, true, false, false, true));
Check(beforeBrake > 0 && left.Speed == 0 && left.TurnRate == 0 && !left.Grounded,
@@ -45,5 +45,6 @@
<Compile Include="../../src/GamePort/Game/JimmyGroundMotion.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyAirMotion.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyOrientation.cs"/>
<Compile Include="../../src/GamePort/Game/JimmyRenderTransform.cs"/>
</ItemGroup>
</Project>
+44
View File
@@ -0,0 +1,44 @@
"""Original target/current Euler, initialization and retained seed ownership."""
from pathlib import Path
import sys
import unittest
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'tools/binary'))
from jimmy_air_target_state import collect
class JimmyAirTargetStateEvidence(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.report=collect(ROOT.parent/'Original')
def test_original_instruction_sites_and_virtual_bindings(self):
self.assertEqual(len(self.report['sites']),32)
self.assertEqual(len(self.report['slots']),9)
self.assertEqual(len(self.report['ranges']),11)
for row in self.report['sites']+self.report['ranges']:
self.assertEqual(int(row['va'],16)-0x400000,int(row['file_offset'],16))
slots={r['slot']:r['target'] for r in self.report['slots']}
self.assertEqual(slots['0x36c'],'0x472660')
self.assertEqual(slots['0x330'],'0x472420')
self.assertEqual(slots['0x3d8'],'0x43a420')
def test_actual_start_data_is_upright_without_conflating_target_init(self):
route=self.report['route']
self.assertEqual([r['rotation'] for r in route],[[0,155,0],[0,290,0],[0,220,0]])
self.assertEqual([r['start_tag'] for r in route],['STARTEXP','PHONEBOOTH','PHONEBOOTH'])
self.assertEqual(self.report['destination_euler_fields'],['0x274','0x278','0x27c'])
self.assertNotEqual(self.report['current_euler_fields'],self.report['destination_euler_fields'])
def test_seed_writes_belong_to_apply_and_constructor(self):
sites={r['name']:r['bytes'] for r in self.report['sites']}
self.assertTrue(sites['constructor_forward_pitch'].endswith('000020c2'))
self.assertTrue(sites['ordinary_apply_forward_pitch'].endswith('000020c2'))
self.assertTrue(sites['bubble_apply_forward_pitch'].endswith('000020c1'))
self.assertEqual(sites['destination_marks_dirty'],'c6410a01')
self.assertEqual(sites['init_clears_facing_dirty'],'88460a')
self.assertEqual(self.report['pitch_seed_fields']['interface'],['0x72c','0x730'])
if __name__=='__main__':unittest.main()
+33
View File
@@ -0,0 +1,33 @@
"""Original Jimmy model-cache/OMT transform source and native fixture guards."""
from pathlib import Path
import hashlib,json,sys,unittest
ROOT=Path(__file__).resolve().parents[1]
sys.path.insert(0,str(ROOT/'tools/binary'))
from jimmy_model_bridge import collect
class JimmyModelBridgeEvidence(unittest.TestCase):
def fixture(self):
return json.loads((ROOT/'tests/GamePort.JimmyRenderTests/original-render-reference.json').read_text())
def test_original_ranges_constants_and_bindings(self):
actual=collect(ROOT.parent/'Original');fixture=self.fixture()
for key,value in actual.items():self.assertEqual(value,fixture[key],key)
self.assertEqual(actual['degree_constants']['0x4d6408'],45.51111111111111)
self.assertEqual(actual['degree_constants']['0x4d6410'],360)
self.assertEqual(len(actual['bindings']),5)
def test_native_fixture_scope_counts_and_provenance(self):
f=self.fixture();self.assertEqual(len(f['models']),14);self.assertEqual(len(f['angles']),12)
for name,digest in f['files'].items():
self.assertEqual(len(digest),64)
if name.startswith('tools/'):self.assertEqual(hashlib.sha256((ROOT/name).read_bytes()).hexdigest(),digest)
cases={c['name']:c for c in f['angles']}
self.assertEqual(cases['forward']['observed'],[14564,2048,15702])
self.assertEqual(cases['quarter']['observed'],[4096,8192,12288])
self.assertEqual(cases['revolutions']['observed'],[0,0,0])
models={c['name']:c for c in f['models']}
self.assertEqual(models['zero_root']['observed'][:12],models['other_root']['observed'][:12])
self.assertEqual(models['other_root']['observed'][12:],[1000,1011.25,-2500])
self.assertTrue(all(c['render'][-1]==6 for c in f['models']))
if __name__=='__main__':unittest.main()