Initial Combat Implementation

This commit is contained in:
Luis Gonzalez
2026-05-31 21:35:12 -07:00
parent 7fa77ce821
commit 1f647dd5e1
166 changed files with 93337 additions and 91 deletions
@@ -10,9 +10,10 @@ namespace ProjectM.Tests
/// <summary>
/// Plain-Entities determinism test for <see cref="PlayerMoveSystem"/> (the M1 predicted move
/// system). Boots a bare ECS world, registers the system in the SimulationSystemGroup, creates a
/// synthetic player (PlayerInput + PlayerMoveStats + LocalTransform + enabled Simulate), injects
/// a fixed delta-time, ticks N times, and asserts the position advanced by exactly
/// MoveSpeed * dt * N. Version-independent and netcode-free, mirroring HeartbeatSystemTests.
/// synthetic player (PlayerInput + EffectiveCharacterStats + LocalTransform + enabled Simulate),
/// injects a fixed delta-time, ticks N times, and asserts the position advanced by exactly
/// MoveSpeed * dt * N. As of M3 move speed is read from EffectiveCharacterStats (the data-driven
/// effective stat) rather than the removed PlayerMoveStats. Version-independent and netcode-free.
/// </summary>
public class PlayerMoveSystemTests
{
@@ -27,14 +28,14 @@ namespace ProjectM.Tests
var em = world.EntityManager;
var entity = em.CreateEntity(
typeof(PlayerInput), typeof(PlayerMoveStats), typeof(LocalTransform), typeof(Simulate));
typeof(PlayerInput), typeof(EffectiveCharacterStats), typeof(LocalTransform), typeof(Simulate));
const float moveSpeed = 5f;
const float dt = 0.1f;
const int ticks = 10;
em.SetComponentData(entity, LocalTransform.FromPosition(float3.zero));
em.SetComponentData(entity, new PlayerMoveStats { MoveSpeed = moveSpeed, TurnRateRadiansPerSec = 0f });
em.SetComponentData(entity, new EffectiveCharacterStats { MoveSpeed = moveSpeed, TurnRateRadiansPerSec = 0f, MaxHealth = 0f });
em.SetComponentData(entity, new PlayerInput { Move = new float2(1f, 0f), Aim = float2.zero });
for (int i = 0; i < ticks; i++)
@@ -66,9 +67,9 @@ namespace ProjectM.Tests
var em = world.EntityManager;
var e = em.CreateEntity(
typeof(PlayerInput), typeof(PlayerMoveStats), typeof(LocalTransform), typeof(Simulate));
typeof(PlayerInput), typeof(EffectiveCharacterStats), typeof(LocalTransform), typeof(Simulate));
em.SetComponentData(e, LocalTransform.FromPosition(float3.zero));
em.SetComponentData(e, new PlayerMoveStats { MoveSpeed = 3f, TurnRateRadiansPerSec = 0f });
em.SetComponentData(e, new EffectiveCharacterStats { MoveSpeed = 3f, TurnRateRadiansPerSec = 0f, MaxHealth = 0f });
em.SetComponentData(e, new PlayerInput { Move = new float2(0f, 1f), Aim = float2.zero });
for (int i = 0; i < ticks; i++)