Netcode Bootstrap

This commit is contained in:
Luis Gonzalez
2026-05-31 14:27:52 -07:00
parent 99d8d2d2a9
commit 7fa77ce821
1813 changed files with 2921554 additions and 84 deletions
@@ -0,0 +1,30 @@
using Unity.Collections;
using Unity.Mathematics;
using Unity.NetCode;
namespace ProjectM.Simulation
{
/// <summary>
/// Twin-stick player input (server-authoritative, input-only clients). Gathered once per frame
/// on the owning client in <see cref="GhostInputSystemGroup"/> and streamed to the server via
/// AutoCommandTarget. Netcode source-gen produces InputBufferData&lt;PlayerInput&gt; plus the
/// copy/apply systems from this type. The [GhostField]s let remote owners be predicted; the
/// data replays deterministically under rollback.
/// </summary>
public struct PlayerInput : IInputComponentData
{
/// <summary>WASD / left-stick movement, normalized to roughly -1..1 per axis.</summary>
[GhostField(Quantization = 1000)] public float2 Move;
/// <summary>Right-stick / cursor aim direction (normalized). Zero =&gt; face movement direction.</summary>
[GhostField(Quantization = 1000)] public float2 Aim;
public FixedString512Bytes ToFixedString()
{
var s = new FixedString512Bytes();
s.Append(Move.x); s.Append(','); s.Append(Move.y); s.Append(';');
s.Append(Aim.x); s.Append(','); s.Append(Aim.y);
return s;
}
}
}