Cut 5c-1: Multi-human authoritative sim, SimSnapshot/SimEvent boundary, RustToDust.Net & RustToDust.Server

This commit is contained in:
Meta Vens 2026-12-05 08:35:07 +01:00
commit d8f5c49b8d
34 changed files with 5785 additions and 700 deletions

View file

@ -62,7 +62,7 @@ public partial class Smoke : Node
Check(!_main.GetWorld3D().Space.IsValid, "Godot should have no active 3D physics space");
Check(_main.Terrain.BakedTileCount == 64, $"Expected 64 baked terrain tiles, got {_main.Terrain.BakedTileCount}");
var player = _main.Session.State.Player;
var player = _main.Session.State.Contenders[0];
float startX = player.X;
float startZ = player.Z;
@ -580,7 +580,7 @@ public partial class Smoke : Node
}
// Seed realistic combat telemetry so the preview clearly showcases armor stripping, hit-flash, cargo rack, and thermal heat
var player = _main.Session.State.Player;
var player = _main.Session.State.Contenders[0];
var grid = player.Grid;
grid.TryAddCargo(Catalog.TouringPlasma);
grid.TryAddCargo(Catalog.GoldRadiator);
@ -925,7 +925,7 @@ public partial class Smoke : Node
// 6. All 7 walkers (including Kestrel) walk through real ArenaSession + Hybrid B FK snapshot cleanly
{
using var walkSession = new RustToDust.Ymir.ArenaSession(seed: 42, mapKind: ArenaMapKind.Desert);
using var walkSession = new RustToDust.Ymir.ArenaSession(seed: 42, mapKind: ArenaMapKind.Desert, slot0Human: true);
for (int cIdx = 1; cIdx < walkSession.State.Contenders.Count; cIdx++)
{
walkSession.SetContenderPose(cIdx, 450f + cIdx * 18f, 450f);
@ -946,10 +946,10 @@ public partial class Smoke : Node
{
var wSpec = Catalog.ChassisById[wId];
walkSession.SetContenderPose(0, 0f, 0f, 0f);
if (walkSession.State.Player.Grid.Spec.Id != wId)
if (walkSession.State.Contenders[0].Grid.Spec.Id != wId)
{
walkSession.State.SpawnChassisDrop(0f, 0f, wSpec);
Check(walkSession.TrySwapNearbyChassis(), $"Failed to swap walkSession player to '{wId}'");
Check(walkSession.TrySwapNearbyChassis(0), $"Failed to swap walkSession player to '{wId}'");
}
var vis = VehicleVisualInstance.Create(cache, wId, VehicleVisualRole.Player);
@ -961,10 +961,10 @@ public partial class Smoke : Node
Check(footNode is not null && pelvisNode is not null,
$"Missing FK nodes '{footNodeName}'/'{pelvisNodeName}' on walker '{wId}'");
var player = walkSession.State.Player;
var player = walkSession.State.Contenders[0];
for (int step = 0; step < 60; step++)
{
walkSession.Step(new PlayerInput(
walkSession.SetHumanInput(0, new PlayerInput(
Throttle: 1f,
Steer: 0f,
AimWorldX: player.X,
@ -972,6 +972,7 @@ public partial class Smoke : Node
Fire: false,
InteractPickup: false,
Brake: false));
walkSession.Step();
bool hasSnap = walkSession.TrySampleInterpolatedWalkerPose(true, player.Id, 1f, out var walkerSnap);
Check(hasSnap, $"Missing WalkerVisualSnapshot for '{wId}' at step {step}");
@ -1133,7 +1134,7 @@ public partial class Smoke : Node
// 10. MultiMeshPartPool & PomDecalPool sanity: live arena submits into MultiMeshPartPool and PomDecalPool stamps impacts cleanly
{
_main.Arena.PomDecals.StampTestDecal(
new Vector3(_main.Session.State.Player.X + 2f, _main.Session.State.Terrain.SampleHeight(_main.Session.State.Player.X + 2f, _main.Session.State.Player.Z) + 0.03f, _main.Session.State.Player.Z),
new Vector3(_main.Session.State.Contenders[0].X + 2f, _main.Session.State.Terrain.SampleHeight(_main.Session.State.Contenders[0].X + 2f, _main.Session.State.Contenders[0].Z) + 0.03f, _main.Session.State.Contenders[0].Z),
Vector3.Up, 1.2f, tileIndex: 14);
_main.Arena.Sync(_main.Session, 1.6f, 1f / 60f);
Check(_main.Arena.PartPool.TotalSubmittedInstances > 0,
@ -1141,7 +1142,7 @@ public partial class Smoke : Node
Check(_main.Arena.PomDecals.ActiveCount >= 1,
$"Expected PomDecalPool to hold >= 1 active decal, got {_main.Arena.PomDecals.ActiveCount}");
_main.Hud.PushTestHitArc(_main.Session.State.Player.X + 20f, _main.Session.State.Player.Z + 10f, WeaponVisualClass.Explosive);
_main.Hud.PushTestHitArc(_main.Session.State.Contenders[0].X + 20f, _main.Session.State.Contenders[0].Z + 10f, WeaponVisualClass.Explosive);
Check(_main.Hud.ActiveHitArcCount >= 1, "Expected CrosshairOverlay to accept incoming hit arc");
}
@ -1223,7 +1224,7 @@ public partial class Smoke : Node
int vfxBefore = _main.Arena.TransientVfxCount;
int tracerId = _main.Session.State.AllocateTracerId();
Vector3 pPos = new(_main.Session.State.Player.X, _main.Session.State.Player.Y, _main.Session.State.Player.Z);
Vector3 pPos = new(_main.Session.State.Contenders[0].X, _main.Session.State.Contenders[0].Y, _main.Session.State.Contenders[0].Z);
tracers.Add(new TracerEvent(
pPos.X, pPos.Y + 1f, pPos.Z,
pPos.X + 20f, pPos.Y + 1f, pPos.Z,
@ -1400,7 +1401,7 @@ public partial class Smoke : Node
private async Task VerifyMaxLoadPaladinGarageAsync()
{
var grid = _main.Session.State.Player.Grid;
var grid = _main.Session.State.Contenders[0].Grid;
grid.SwapChassis(Catalog.Paladin);
Check(grid.TryMount(Catalog.TouringPlasma, "hp.weapon.sh_l"), "Expected TouringPlasma on Paladin hp.weapon.sh_l");
Check(grid.TryMount(Catalog.WeldedPlate, "hp.armor.torso"), "Expected WeldedPlate on Paladin hp.armor.torso");
@ -1483,7 +1484,7 @@ public partial class Smoke : Node
Vector2 vpSize = GetViewport().GetVisibleRect().Size;
Check(!_main.Hud.HasPanelOverlapOrClip(vpSize), $"Sion HUD panels overlapped or clipped at {vpSize}");
var player = sionState.Player;
var player = sionState.Contenders[0];
float startX = player.X;
float startZ = player.Z;
_main.SetScriptedInput(new PlayerInput(