LANTERN purge B7: rename CharacterId -> FrameKind (frame terminology)

Enum renamed in StatIds.cs (byte values unchanged - serialized definitions/saves
never re-mean); all call sites + doc mentions swept (ClassTraits, PlayerAuthoring,
CharacterStatsDefinition field type, menu/UI, tests). CharacterStatsDefinition SO
CLASS name kept (asset-binding risk; deferred per plan). 390 green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-15 15:51:48 -07:00
parent 4a8220ad3e
commit 77de740b63
22 changed files with 34 additions and 32 deletions
@@ -19,7 +19,7 @@ namespace ProjectM.Authoring
[Tooltip("All ability definitions available in the game. Indexed at runtime by AbilityId.")]
public List<AbilityDefinition> Abilities = new List<AbilityDefinition>();
[Tooltip("All character-stats definitions. Indexed at runtime by CharacterId.")]
[Tooltip("All character-stats definitions. Indexed at runtime by FrameKind.")]
public List<CharacterStatsDefinition> Characters = new List<CharacterStatsDefinition>();
private class DatabaseBaker : Baker<AbilityDatabaseAuthoring>
@@ -11,7 +11,7 @@ namespace ProjectM.Authoring
[CreateAssetMenu(menuName = "Project M/Character Stats Definition", fileName = "Character_")]
public class CharacterStatsDefinition : ScriptableObject
{
public CharacterId Id = CharacterId.Default;
public FrameKind Id = FrameKind.Default;
public string DisplayName = "Character";
[Min(0f)] public float MoveSpeed = 6f;
@@ -43,7 +43,7 @@ namespace ProjectM.Authoring
if (authoring.Character != null) DependsOn(authoring.Character);
byte characterId = authoring.Character != null
? (byte)authoring.Character.Id : (byte)CharacterId.Default;
? (byte)authoring.Character.Id : (byte)FrameKind.Default;
float maxHealth = authoring.Character != null
? authoring.Character.MaxHealth : authoring.FallbackMaxHealth;
@@ -37,7 +37,7 @@ namespace ProjectM.Client
public static void Kill() => Send(DebugOp.KillPlayer);
/// <summary>Set the <see cref="ProjectM.Simulation.TuningKnob"/> knob to value (server-applied, x1000 fixed-point; MC-0).</summary>
public static void SetTuning(byte knob, float value) => Send(DebugOp.SetTuning, knob, Mathf.RoundToInt(value * 1000f));
/// <summary>Swap the sender's class to <paramref name="classId"/> (a <see cref="ProjectM.Simulation.CharacterId"/> byte); server-authoritative (class-switch dev tool).</summary>
/// <summary>Swap the sender's class to <paramref name="classId"/> (a <see cref="ProjectM.Simulation.FrameKind"/> byte); server-authoritative (class-switch dev tool).</summary>
public static void SetClass(byte classId) => Send(DebugOp.SetClass, classId);
public static void SetWarrior() => SetClass(ClassTraits.WarriorClass);
public static void SetRanger() => SetClass(ClassTraits.RangerClass);
@@ -68,7 +68,7 @@ namespace ProjectM.Client
switch (idx)
{
case 0: // Controls (chosen class)
bool ranger = WorldLauncher.SelectedClass == (byte)CharacterId.Ranger;
bool ranger = WorldLauncher.SelectedClass == (byte)FrameKind.Ranger;
Head(c, ranger ? "CLASS: Ranger (ranged anchor)" : "CLASS: Warrior (melee anchor)");
Body(c, "Move — WASD / Left Stick");
Body(c, "Aim — Mouse cursor / Right Stick");
@@ -99,8 +99,8 @@ namespace ProjectM.Client
var classRow = new VisualElement();
classRow.style.flexDirection = FlexDirection.Row;
classRow.style.justifyContent = Justify.Center;
classRow.Add(MenuUi.Button("Warrior", () => SelectClass((byte)CharacterId.Warrior)));
classRow.Add(MenuUi.Button("Ranger", () => SelectClass((byte)CharacterId.Ranger)));
classRow.Add(MenuUi.Button("Warrior", () => SelectClass((byte)FrameKind.Warrior)));
classRow.Add(MenuUi.Button("Ranger", () => SelectClass((byte)FrameKind.Ranger)));
card.Add(classRow);
card.Add(MenuUi.Button("Single Player", () => Launch(SessionMode.Single, false)));
@@ -149,7 +149,7 @@ namespace ProjectM.Client
if (_classLabel != null) _classLabel.text = ClassName(classId);
}
static string ClassName(byte classId) => classId == (byte)CharacterId.Ranger ? "CLASS: Ranger (ranged)" : "CLASS: Warrior (melee)";
static string ClassName(byte classId) => classId == (byte)FrameKind.Ranger ? "CLASS: Ranger (ranged)" : "CLASS: Warrior (melee)";
void ShowSettings()
{
@@ -28,8 +28,8 @@ namespace ProjectM.Client
public static bool Busy { get; private set; }
/// <summary>Slice 2: the class chosen in the menu (a CharacterId byte), seeded into the client world at session start.</summary>
public static byte SelectedClass = (byte)CharacterId.Warrior;
/// <summary>Slice 2: the frame chosen in the menu (a FrameKind byte), seeded into the client world at session start.</summary>
public static byte SelectedClass = (byte)FrameKind.Warrior;
/// <summary>The mode of the most recently started session — the HUD's outcome banner branches on it
/// (single: PLAY AGAIN restarts; co-op: the honest exit is a clean teardown for everyone).</summary>
@@ -101,7 +101,7 @@ namespace ProjectM.Server
// meta-band StatModifiers on the just-instantiated player (same ECB as Instantiate, the
// ClassTraits idiom). Skip tier 0 / unknown ids (preserve-don't-crash); CLAMP a saved tier above a
// rebalanced MaxTier (D-F5). Class gate via BoonMath.MaskFor (ClassId is the normalized
// CharacterId 2/3 — a raw 1<<ClassId would compute bits 2/3 and silently skip everything).
// FrameKind 2/3 — a raw 1<<ClassId would compute bits 2/3 and silently skip everything).
if (!isGym)
{
ref var metaPool = ref metaCatalog.Value.Value;
@@ -34,7 +34,7 @@ namespace ProjectM.Simulation
/// <summary>One authored character-stats definition, baked immutable into the AbilityDatabase blob.</summary>
public struct CharacterStatsBlob
{
public byte Id; // CharacterId
public byte Id; // FrameKind
public float MoveSpeed;
public float TurnRateRadiansPerSec;
public float MaxHealth;
@@ -3,7 +3,7 @@ using Unity.Entities;
namespace ProjectM.Simulation
{
/// <summary>
/// Slice 2: the local player's chosen class (a <see cref="CharacterId"/> byte), staged in the CLIENT world as a
/// Slice 2: the local player's chosen class (a <see cref="FrameKind"/> byte), staged in the CLIENT world as a
/// singleton by the menu / WorldLauncher before going in-game. <see cref="GoInGameRequest"/> picks it up
/// (GoInGameClientSystem) so the server seeds the right class at spawn. NOT replicated — it is client-local
/// intent; the class travels to the server via the RPC, then back to all clients via the seeded StatModifiers +
@@ -4,12 +4,12 @@ using Unity.Entities;
namespace ProjectM.Simulation
{
/// <summary>
/// Slice 2 — pure mapping from a chosen class (a <see cref="CharacterId"/> byte) to its spawn-time setup: the
/// Slice 2 — pure mapping from a chosen frame (a <see cref=\"FrameKind\"/> byte) to its spawn-time setup: the
/// Fire-slot ability id + the permanent trait <see cref="StatModifier"/>s (tagged with the reserved
/// <see cref="Tuning.ClassSourceId"/> range, NEVER stripped by the generic modifier systems). Applied by
/// GoInGameServerSystem on the just-spawned player and unit-tested. Burst-safe (byte/uint only, no managed types).
/// <para>
/// Trait deltas seed onto the <see cref="CharacterId.Default"/> character (no per-class blob row needed — the
/// Trait deltas seed onto the <see cref=\"FrameKind.Default\"/> character (no per-class blob row needed — the
/// deltas ride the replicated StatModifier buffer, OwnerSendType.All, so the owning client folds the correct
/// EffectiveCharacterStats). The DRG-asymmetry (operator-locked): <b>Warrior</b> = melee bruiser (tankier,
/// slower, harder + longer-reach melee via MeleeDamage/MeleeRange); <b>Ranger</b> = ranged anchor (faster,
@@ -26,8 +26,8 @@ namespace ProjectM.Simulation
/// </summary>
public static class ClassTraits
{
public const byte WarriorClass = (byte)CharacterId.Warrior;
public const byte RangerClass = (byte)CharacterId.Ranger;
public const byte WarriorClass = (byte)FrameKind.Warrior;
public const byte RangerClass = (byte)FrameKind.Ranger;
/// <summary>How many trait modifiers a class seeds (each on a distinct SourceId at ClassSourceId + i).</summary>
public const int ClassSeedCount = 4;
@@ -79,7 +79,7 @@ namespace ProjectM.Simulation
[GhostComponent(OwnerSendType = SendToOwnerType.SendToOwner)]
public struct FrameId : IComponentData
{
/// <summary>The frame/class id (see the <c>CharacterId</c> / <c>ClassId</c> convention).</summary>
/// <summary>The frame/class id (see the <c>FrameKind</c> / <c>ClassId</c> convention).</summary>
[GhostField] public byte Value;
}
}
@@ -16,13 +16,15 @@ namespace ProjectM.Simulation
LightZone = 9, // Aoe/zone: a persistent light/damage zone
}
/// <summary>Stable key for an authored character-stats definition in the AbilityDatabase blob.</summary>
public enum CharacterId : byte
/// <summary>Stable key for an authored character-stats definition in the AbilityDatabase blob — the
/// frame/class id (a LANTERN suit-frame IS the class; renamed from the pre-LANTERN <c>CharacterId</c>,
/// byte values unchanged so serialized definitions/saves never re-mean).</summary>
public enum FrameKind : byte
{
None = 0,
Default = 1,
Warrior = 2, // Slice 2: melee-anchor bruiser (tankier, slower, longer/harder melee)
Ranger = 3, // Slice 2: ranged-anchor (squishier, faster, longer projectile range; weaker melee)
Warrior = 2, // Bathynaut-lineage melee-anchor bruiser (tankier, slower, longer/harder melee)
Ranger = 3, // Harpooner-lineage ranged-anchor (squishier, faster, longer projectile range; weaker melee)
}
/// <summary>
@@ -7,5 +7,5 @@ namespace ProjectM.Simulation
/// NetworkStreamInGame to the connection (enabling snapshot/command flow) and spawns the
/// client's player ghost. Lives in Simulation so both worlds see the type for RPC source-gen.
/// </summary>
public struct GoInGameRequest : IRpcCommand { public byte ClassId; } // Slice 2: per-player class (CharacterId byte; 0 -> server defaults to Warrior)
public struct GoInGameRequest : IRpcCommand { public byte ClassId; } // Slice 2: per-player class (FrameKind byte; 0 -> server defaults to Warrior)
}
@@ -59,7 +59,7 @@ namespace ProjectM.Simulation
/// <summary>Set the <see cref="TuningKnob"/> ArgA to ArgB/1000f (live dash/Charger feel-tuning; MC-0).</summary>
public const byte SetTuning = 12;
/// <summary>Swap the sender's class to ArgA (a <see cref="CharacterId"/> byte: Warrior=2 / Ranger=3).
/// <summary>Swap the sender's class to ArgA (a <see cref="FrameKind"/> byte: Warrior=2 / Ranger=3).
/// Strips the old class trait seeds, re-seeds the new ones, swaps the Fire ability, and heals a living
/// player to the new class's max. Editor-only dev tool (class-switch); 0 / unknown -> Warrior.</summary>
public const byte SetClass = 13;
@@ -7,7 +7,7 @@ namespace ProjectM.Simulation
/// One authored PERMANENT meta upgrade: tiered (buy tier owned+1 up to <see cref="MaxTier"/>), priced in Aether
/// with a linear ramp (<c>cost(owned) = BaseCost + owned*CostGrowth</c>), class-gated by <see cref="ClassMask"/>
/// (bit0 = Warrior, bit1 = Ranger — resolve via <see cref="BoonMath.MaskFor"/>, NEVER a raw <c>1&lt;&lt;ClassId</c>:
/// the stored ClassId is the normalized CharacterId 2/3). <see cref="Id"/> is the stable APPEND-ONLY key
/// the stored ClassId is the normalized FrameKind 2/3). <see cref="Id"/> is the stable APPEND-ONLY key
/// persisted in SaveData v6 and keyed into the live StatModifier as <c>Tuning.MetaSourceIdBase + Id</c>.
/// DISTINCT from <see cref="BoonDefBlob"/> — boons are run-scoped single-shots; overloading one catalog would
/// blur the two channels (DR-037). <see cref="PrereqId"/> = 0xFF means no prerequisite (v1 ships a FLAT catalog
@@ -14,7 +14,7 @@ namespace ProjectM.Simulation
[InternalBufferCapacity(24)]
public struct MetaTierState : IBufferElementData
{
/// <summary>Owning class id (Warrior/Ranger — the CharacterId anchor).</summary>
/// <summary>Owning class id (Warrior/Ranger — the FrameKind anchor).</summary>
[GhostField] public byte ClassId;
/// <summary>Upgrade id (append-only key into the meta catalog).</summary>
[GhostField] public byte UpgradeId;
@@ -10,7 +10,7 @@ namespace ProjectM.Simulation
public int Count;
}
/// <summary>One persisted per-class PERMANENT meta-upgrade tier (v6). ClassId = the normalized CharacterId
/// <summary>One persisted per-class PERMANENT meta-upgrade tier (v6). ClassId = the normalized FrameKind
/// (Warrior=2/Ranger=3); UpgradeId = the append-only meta-catalog key (unknown ids round-trip preserved and are
/// skipped live); Tier clamps to the catalog's MaxTier at seed/shop/spend, never at rest.</summary>
[Serializable]
@@ -7,7 +7,7 @@ namespace ProjectM.Simulation
/// Which authored character-stats definition this entity uses - a light key into the CharacterStats
/// blob, replacing M2's inlined PlayerMoveStats values. NOW a [GhostField] (Slice 2 classes) so the
/// server-written per-player class id replicates -> the owning client folds correct stats. <c>Id</c> stores a
/// <see cref="CharacterId"/>.
/// <see cref="FrameKind"/>.
/// </summary>
public struct CharacterStatsRef : IComponentData
{
@@ -32,7 +32,7 @@ namespace ProjectM.Tests
var chars = builder.Allocate(ref root.Characters, 1);
chars[0] = new CharacterStatsBlob
{
Id = (byte)CharacterId.Default, MoveSpeed = 6f, TurnRateRadiansPerSec = 12.5f,
Id = (byte)FrameKind.Default, MoveSpeed = 6f, TurnRateRadiansPerSec = 12.5f,
MaxHealth = 100f, Name = "Default"
};
@@ -71,7 +71,7 @@ namespace ProjectM.Tests
var blob = Build();
try
{
Assert.IsTrue(blob.Value.TryGetCharacter((byte)CharacterId.Default, out var def));
Assert.IsTrue(blob.Value.TryGetCharacter((byte)FrameKind.Default, out var def));
Assert.AreEqual(6f, def.MoveSpeed, 1e-4f);
Assert.AreEqual(100f, def.MaxHealth, 1e-4f);
Assert.AreEqual("Default", def.Name.ToString());
@@ -78,7 +78,7 @@ namespace ProjectM.Tests
var catalogE = em.CreateEntity(typeof(MetaUpgradeCatalog));
em.SetComponentData(catalogE, new MetaUpgradeCatalog { Value = MetaCatalogData.BuildDefault() });
var record = em.AddBuffer<MetaTierState>(catalogE); // the tier record rides any singleton entity in tests
byte warrior = ClassTraits.WarriorClass; // normalized CharacterId (2)
byte warrior = ClassTraits.WarriorClass; // normalized FrameKind (2)
record.Add(new MetaTierState { ClassId = warrior, UpgradeId = 1, Tier = 2 }); // Reinforced Frame t2 -> +30
record.Add(new MetaTierState { ClassId = warrior, UpgradeId = 5, Tier = 9 }); // Warrior's Might, saved OVER MaxTier(4) -> clamp
record.Add(new MetaTierState { ClassId = warrior, UpgradeId = 200, Tier = 1 }); // unknown id -> skipped
@@ -15,7 +15,7 @@ namespace ProjectM.Tests
public class StatRecomputeSystemTests
{
const byte AbilityPrimary = (byte)AbilityId.Primary;
const byte CharDefault = (byte)CharacterId.Default;
const byte CharDefault = (byte)FrameKind.Default;
static BlobAssetReference<AbilityDatabaseBlob> BuildDb()
{