56cf60cce3
Adds the server-authoritative mechanics for three new enemy archetypes on top of the Grunt/Charger base, plus the weighted wave-composition that introduces them: - Spitter: a ranged Husk variant (SpitterState) that holds a preferred range-band (advance/retreat/hold via EnemyAIMath.BandVelocity) and fires a telegraphed, dodgeable EnemyProjectile. New server EnemyProjectileMoveSystem (integrate + store LastStep) + EnemyProjectileDamageSystem (region-filtered swept hit-test rebuilt from LastStep — DR-018 anti-tunnelling; players use HitRadius, structures a const radius; at-most-once destroy). Concurrent-spit soft cap, soft-fail retry. - Swarmer: marker tag + deterministic cluster spawn (1 slot = 1 pack; EnemyAIMath.ClusterOffset), MaxAlive counts ENTITIES so a pack defers if it won't fit. - 4-type weighted mix: MixBands -> ZoneEnemyMath.WaveSlots/KindForSlot/ PackSizeForSlot drives both the expedition director and (fork-4a) the base siege, with a mandatory MaxAlive cap. Legacy WaveSize/IsChargerSlot kept + parity-tested. - Discriminator stays component-presence (no enum in Bursted systems): query- partition guards keep each enemy moved by exactly one EnemyAISystem pass (sole-Position-writer). EnemyTelegraph.IsCharger -> Kind byte for the client cue. New authoring (Spitter/Swarmer/EnemyProjectile) + expanded director authorings with tunable mix/cluster defaults. 13 new EditMode tests (mix composition + legacy parity, band/cluster math, projectile move + cross-region + swept anti-tunnelling regressions); full suite green before commit. Dormant until the prefab/subscene wiring lands (next): the new systems guard on TryGetSingleton/RequireForUpdate, so with no prefabs wired the new types stay inert. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
59 lines
2.3 KiB
C#
59 lines
2.3 KiB
C#
using Unity.Entities;
|
|
|
|
namespace ProjectM.Simulation
|
|
{
|
|
/// <summary>
|
|
/// Baked config for the Husk wave/threat director (singleton). The director escalates: wave N spawns
|
|
/// <c>BaseCount + (N-1)*CountPerWave</c> Husks (round-robin over the <see cref="WaveEnemyPrefab"/> pool) at a
|
|
/// deterministic ring around the <see cref="BaseAnchor"/>, one every <c>SpawnIntervalTicks</c>; once a wave is
|
|
/// cleared the field stays calm for <c>LullTicks</c> before the next, bigger wave. Replaces the flat sustain.
|
|
/// </summary>
|
|
public struct WaveDirector : IComponentData
|
|
{
|
|
public float RingRadius;
|
|
public int RingSlots;
|
|
public int BaseCount;
|
|
public int CountPerWave;
|
|
public int SpawnIntervalTicks;
|
|
public int LullTicks;
|
|
public int MaxAlive; // MC-2 fork-4a: mandatory cap for the 4-type base siege (uncapped packs/spits spike relevancy).
|
|
// MC-2 base-siege mix bands (the director builds a ZoneEnemyMath.MixBands): BaseCount above = the Grunt base count.
|
|
public int ChargerBase;
|
|
public int SpitterBase;
|
|
public int SwarmerSlotBase;
|
|
public int ChargerPerEpoch;
|
|
public int SpitterPerEpoch;
|
|
public int SwarmerSlotPerEpoch;
|
|
public int SwarmerPackSize;
|
|
public int SwarmerPackPerEpoch;
|
|
public float ClusterTightRadius;
|
|
}
|
|
|
|
/// <summary>Baked pool of Husk prefab variants the director draws from round-robin (Grunt / Swarmer / Brute / ...).</summary>
|
|
public struct WaveEnemyPrefab : IBufferElementData
|
|
{
|
|
public Entity Prefab;
|
|
}
|
|
|
|
/// <summary>Phase constants for <see cref="WaveState.Phase"/>.</summary>
|
|
public static class WavePhase
|
|
{
|
|
public const byte Lull = 0;
|
|
public const byte Spawning = 1;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Runtime state of the wave director (server-only singleton; not replicated). Tracks the current wave, the
|
|
/// phase (lull vs spawning), the next action tick, how many Husks remain to spawn this wave, and a monotonic
|
|
/// spawn counter (drives the ring slot + the round-robin prefab pick).
|
|
/// </summary>
|
|
public struct WaveState : IComponentData
|
|
{
|
|
public int WaveNumber;
|
|
public byte Phase;
|
|
public uint NextActionTick;
|
|
public int RemainingToSpawn;
|
|
public int SpawnCounter;
|
|
}
|
|
}
|