Cut 5c-1: Multi-human authoritative sim, SimSnapshot/SimEvent boundary, RustToDust.Net & RustToDust.Server
This commit is contained in:
parent
8eba2ea39f
commit
d8f5c49b8d
34 changed files with 5785 additions and 700 deletions
|
|
@ -126,7 +126,7 @@ public partial class Main : Node3D
|
|||
|
||||
private void SetupPerfCombatScenario(ArenaSession session)
|
||||
{
|
||||
var p = session.State.Player;
|
||||
var p = session.State.Contenders[0];
|
||||
float fwdX = MathF.Sin(p.Yaw);
|
||||
float fwdZ = MathF.Cos(p.Yaw);
|
||||
float rightX = -fwdZ;
|
||||
|
|
@ -187,8 +187,8 @@ public partial class Main : Node3D
|
|||
|
||||
try
|
||||
{
|
||||
_session = new ArenaSession(seed, _mapKind);
|
||||
var p = _session.State.Player;
|
||||
_session = new ArenaSession(seed, _mapKind, slot0Human: true);
|
||||
var p = _session.State.Contenders[0];
|
||||
_cameraYaw = p.Yaw;
|
||||
_cameraPitch = _mapKind == ArenaMapKind.Sion ? Mathf.DegToRad(5f) : Mathf.DegToRad(12f);
|
||||
_cameraZoom = 1.0f;
|
||||
|
|
@ -319,7 +319,8 @@ public partial class Main : Node3D
|
|||
if (_perfTargetFrames > 0)
|
||||
{
|
||||
long t0 = Stopwatch.GetTimestamp();
|
||||
_session.Step(input);
|
||||
_session.SetHumanInput(0, input);
|
||||
_session.Step();
|
||||
long t1 = Stopwatch.GetTimestamp();
|
||||
double toMs = 1000.0 / Stopwatch.Frequency;
|
||||
_perfPendingStepMs += (t1 - t0) * toMs;
|
||||
|
|
@ -327,7 +328,8 @@ public partial class Main : Node3D
|
|||
}
|
||||
else
|
||||
{
|
||||
_session.Step(input);
|
||||
_session.SetHumanInput(0, input);
|
||||
_session.Step();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -536,7 +538,7 @@ public partial class Main : Node3D
|
|||
if (Input.IsKeyPressed(Key.D) || Input.IsKeyPressed(Key.Right)) steer += 1f;
|
||||
if (Input.IsKeyPressed(Key.A) || Input.IsKeyPressed(Key.Left)) steer -= 1f;
|
||||
|
||||
bool isVtol = Session.State.Player.Grid.Spec.IsVtol;
|
||||
bool isVtol = Session.State.Contenders[0].Grid.Spec.IsVtol;
|
||||
float verticalThrottle = 0f;
|
||||
if (Input.IsKeyPressed(Key.Space)) verticalThrottle += 1f;
|
||||
if (Input.IsKeyPressed(Key.C) || Input.IsKeyPressed(Key.Ctrl)) verticalThrottle -= 1f;
|
||||
|
|
@ -561,7 +563,7 @@ public partial class Main : Node3D
|
|||
|
||||
private (float AimX, float AimY, float AimZ) ComputeCenterScreenAim()
|
||||
{
|
||||
var player = Session.State.Player;
|
||||
var player = Session.State.Contenders[0];
|
||||
var spec = player.Grid.Spec;
|
||||
Vector2 screenSize = GetViewport().GetVisibleRect().Size;
|
||||
if (screenSize.X < 2f || screenSize.Y < 2f)
|
||||
|
|
@ -667,7 +669,7 @@ public partial class Main : Node3D
|
|||
|
||||
private void UpdateCamera(float dt, float alpha)
|
||||
{
|
||||
var p = Session.State.Player;
|
||||
var p = Session.State.Contenders[0];
|
||||
var spec = p.Grid.Spec;
|
||||
var (posInterp, _, _) = Session.GetInterpolatedContenderPose(p.Id, alpha);
|
||||
|
||||
|
|
@ -794,7 +796,7 @@ public partial class Main : Node3D
|
|||
|
||||
private void OnEquipCargo(int cargoIndex, string hardpointId)
|
||||
{
|
||||
_session?.TryEquipCargo(cargoIndex, hardpointId);
|
||||
_session?.TryEquipCargo(0, cargoIndex, hardpointId);
|
||||
}
|
||||
|
||||
private void SetupLightingAndSky()
|
||||
|
|
|
|||
Loading…
Reference in a new issue