Polishes
This commit is contained in:
@@ -51,6 +51,7 @@ namespace ProjectM.Authoring
|
|||||||
});
|
});
|
||||||
AddComponent(entity, new EnemyAttackCooldown { NextAttackTick = 0 });
|
AddComponent(entity, new EnemyAttackCooldown { NextAttackTick = 0 });
|
||||||
AddComponent<KnockbackState>(entity); // server-only recoil state (zero = not knocked)
|
AddComponent<KnockbackState>(entity); // server-only recoil state (zero = not knocked)
|
||||||
|
AddComponent(entity, new EnemyNavState { LastPos = float.MaxValue }); // server-only anti-stuck nav state (not replicated); sentinel LastPos forces a first-tick reset
|
||||||
AddComponent<AttackWindup>(entity); // replicated telegraph signal (zero = not winding up)
|
AddComponent<AttackWindup>(entity); // replicated telegraph signal (zero = not winding up)
|
||||||
// Slice 1 (Feature C): client-safe baked telegraph metadata. EnemyBaker is the SOLE writer of
|
// Slice 1 (Feature C): client-safe baked telegraph metadata. EnemyBaker is the SOLE writer of
|
||||||
// EnemyTelegraph even on a Charger (the prefab composes both authorings on one entity); reading the
|
// EnemyTelegraph even on a Charger (the prefab composes both authorings on one entity); reading the
|
||||||
|
|||||||
@@ -0,0 +1,205 @@
|
|||||||
|
#if UNITY_EDITOR
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEditor;
|
||||||
|
|
||||||
|
namespace ProjectM.Client
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// EDITOR-ONLY live tuner for the "3D pixel art" full-screen render style — the
|
||||||
|
/// <c>Hidden/ProjectM/PixelOutline</c> shader driven by <c>PixelOutline.mat</c> via the
|
||||||
|
/// PC_Renderer <c>FullScreenPassRendererFeature</c>. Self-spawns on Play (no scene wiring),
|
||||||
|
/// so it works in Game.unity and DevSandbox.unity alike. Toggle the panel with <b>F3</b>.
|
||||||
|
///
|
||||||
|
/// It writes straight to the shared material ASSET, so every drag applies to the running
|
||||||
|
/// game instantly AND sticks after you exit Play mode (material assets aren't reverted the
|
||||||
|
/// way scene objects are). "Save Asset" force-writes to disk now; "Reset" restores the
|
||||||
|
/// shader's shipped defaults. Stripped from player builds (#if UNITY_EDITOR).
|
||||||
|
/// </summary>
|
||||||
|
public class PixelArtDevControls : MonoBehaviour
|
||||||
|
{
|
||||||
|
const string MaterialPath = "Assets/_Project/Shaders/PixelOutline.mat";
|
||||||
|
|
||||||
|
static PixelArtDevControls _instance;
|
||||||
|
|
||||||
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)]
|
||||||
|
static void Bootstrap()
|
||||||
|
{
|
||||||
|
if (_instance != null)
|
||||||
|
return;
|
||||||
|
var go = new GameObject("~PixelArtDevControls") { hideFlags = HideFlags.HideAndDontSave };
|
||||||
|
DontDestroyOnLoad(go);
|
||||||
|
_instance = go.AddComponent<PixelArtDevControls>();
|
||||||
|
}
|
||||||
|
|
||||||
|
Material _mat;
|
||||||
|
bool _open;
|
||||||
|
Vector2 _scroll;
|
||||||
|
GUIStyle _wrap;
|
||||||
|
|
||||||
|
Material Mat
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_mat == null)
|
||||||
|
_mat = AssetDatabase.LoadAssetAtPath<Material>(MaterialPath);
|
||||||
|
return _mat;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GUIStyle Wrap => _wrap ??= new GUIStyle(GUI.skin.label) { wordWrap = true, fontSize = 10 };
|
||||||
|
|
||||||
|
void OnDisable() => AimPresentation.ForceCursorVisible = false;
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (Input.GetKeyDown(KeyCode.F3))
|
||||||
|
_open = !_open;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OnGUI()
|
||||||
|
{
|
||||||
|
if (GUI.Button(new Rect(10, 10, 128, 24), _open ? "PIXEL ▲ (F3)" : "PIXEL ▼ (F3)"))
|
||||||
|
_open = !_open;
|
||||||
|
|
||||||
|
if (!_open)
|
||||||
|
return;
|
||||||
|
|
||||||
|
AimPresentation.ForceCursorVisible = true;
|
||||||
|
|
||||||
|
var mat = Mat;
|
||||||
|
if (mat == null)
|
||||||
|
{
|
||||||
|
GUILayout.BeginArea(new Rect(10, 40, 270, 64), GUI.skin.box);
|
||||||
|
GUILayout.Label("PixelOutline.mat not found at\n" + MaterialPath, Wrap);
|
||||||
|
GUILayout.EndArea();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
float panelH = Mathf.Min(660f, Screen.height - 60f);
|
||||||
|
GUILayout.BeginArea(new Rect(10, 40, 272, panelH), GUI.skin.box);
|
||||||
|
GUILayout.Label("PIXEL-ART RENDER STYLE (live)");
|
||||||
|
_scroll = GUILayout.BeginScrollView(_scroll);
|
||||||
|
|
||||||
|
Toggle(mat, "_MasterEnabled", "MASTER (whole effect on/off)");
|
||||||
|
GUILayout.Space(6);
|
||||||
|
|
||||||
|
GUILayout.Label("- Toggles -");
|
||||||
|
Toggle(mat, "_PixelateEnabled", "Pixelate");
|
||||||
|
Toggle(mat, "_PosterizeEnabled", "Posterize (banded color)");
|
||||||
|
Toggle(mat, "_DepthEdgesEnabled", "Depth edges (silhouette)");
|
||||||
|
Toggle(mat, "_NormalEdgesEnabled", "Normal edges (creases)");
|
||||||
|
|
||||||
|
GUILayout.Space(6);
|
||||||
|
GUILayout.Label("- Pixelation -");
|
||||||
|
Slider(mat, "_PixelHeight", "Grid height (px)", 40f, 720f, "0");
|
||||||
|
|
||||||
|
GUILayout.Space(6);
|
||||||
|
GUILayout.Label("- Color / tone -");
|
||||||
|
Slider(mat, "_ColorLevels", "Posterize levels", 2f, 64f, "0");
|
||||||
|
Slider(mat, "_Brightness", "Brightness", 0.5f, 2f, "0.00");
|
||||||
|
Slider(mat, "_Contrast", "Contrast", 0.5f, 2f, "0.00");
|
||||||
|
Slider(mat, "_Saturation", "Saturation", 0f, 2f, "0.00");
|
||||||
|
|
||||||
|
GUILayout.Space(6);
|
||||||
|
GUILayout.Label("- Outlines -");
|
||||||
|
Slider(mat, "_DepthThreshold", "Depth threshold", 0f, 1f, "0.000");
|
||||||
|
Slider(mat, "_NormalThreshold", "Normal threshold", 0f, 4f, "0.00");
|
||||||
|
Slider(mat, "_OutlineThickness", "Thickness (texels)", 0.25f, 4f, "0.00");
|
||||||
|
Slider(mat, "_EdgeStrength", "Edge strength", 0f, 1f, "0.00");
|
||||||
|
ColorRow(mat, "_OutlineColorOuter", "Silhouette color");
|
||||||
|
ColorRow(mat, "_OutlineColorInner", "Crease color");
|
||||||
|
|
||||||
|
GUILayout.Space(8);
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
if (GUILayout.Button("Reset defaults"))
|
||||||
|
ResetDefaults(mat);
|
||||||
|
if (GUILayout.Button("Save Asset"))
|
||||||
|
SaveAsset(mat);
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
GUILayout.Label("Drags apply live and persist after Play. 'Save Asset' writes to disk now.", Wrap);
|
||||||
|
|
||||||
|
GUILayout.EndScrollView();
|
||||||
|
GUILayout.EndArea();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Toggle(Material mat, string prop, string label)
|
||||||
|
{
|
||||||
|
bool cur = mat.GetFloat(prop) > 0.5f;
|
||||||
|
bool now = GUILayout.Toggle(cur, " " + label);
|
||||||
|
if (now != cur)
|
||||||
|
{
|
||||||
|
mat.SetFloat(prop, now ? 1f : 0f);
|
||||||
|
EditorUtility.SetDirty(mat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void Slider(Material mat, string prop, string label, float min, float max, string fmt)
|
||||||
|
{
|
||||||
|
float cur = mat.GetFloat(prop);
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label(label, GUILayout.Width(126));
|
||||||
|
GUILayout.Label(cur.ToString(fmt), GUILayout.Width(48));
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
float now = GUILayout.HorizontalSlider(cur, min, max);
|
||||||
|
if (!Mathf.Approximately(now, cur))
|
||||||
|
{
|
||||||
|
mat.SetFloat(prop, now);
|
||||||
|
EditorUtility.SetDirty(mat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void ColorRow(Material mat, string prop, string label)
|
||||||
|
{
|
||||||
|
Color c = mat.GetColor(prop);
|
||||||
|
GUILayout.Label(label);
|
||||||
|
Color n = c;
|
||||||
|
n.r = ChannelSlider("R", c.r);
|
||||||
|
n.g = ChannelSlider("G", c.g);
|
||||||
|
n.b = ChannelSlider("B", c.b);
|
||||||
|
if (n != c)
|
||||||
|
{
|
||||||
|
n.a = 1f;
|
||||||
|
mat.SetColor(prop, n);
|
||||||
|
EditorUtility.SetDirty(mat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static float ChannelSlider(string label, float v)
|
||||||
|
{
|
||||||
|
GUILayout.BeginHorizontal();
|
||||||
|
GUILayout.Label(label, GUILayout.Width(14));
|
||||||
|
float r = GUILayout.HorizontalSlider(v, 0f, 1f);
|
||||||
|
GUILayout.EndHorizontal();
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Shipped defaults from PixelOutline.shader / .mat.
|
||||||
|
static void ResetDefaults(Material mat)
|
||||||
|
{
|
||||||
|
mat.SetFloat("_MasterEnabled", 1f);
|
||||||
|
mat.SetFloat("_PixelHeight", 200f);
|
||||||
|
mat.SetFloat("_PosterizeEnabled", 1f);
|
||||||
|
mat.SetFloat("_ColorLevels", 12f);
|
||||||
|
mat.SetFloat("_Brightness", 1.1f);
|
||||||
|
mat.SetFloat("_Contrast", 1.05f);
|
||||||
|
mat.SetFloat("_Saturation", 1.35f);
|
||||||
|
mat.SetFloat("_DepthThreshold", 0.08f);
|
||||||
|
mat.SetFloat("_NormalThreshold", 1f);
|
||||||
|
mat.SetFloat("_OutlineThickness", 1f);
|
||||||
|
mat.SetFloat("_EdgeStrength", 1f);
|
||||||
|
mat.SetFloat("_PixelateEnabled", 1f);
|
||||||
|
mat.SetFloat("_DepthEdgesEnabled", 1f);
|
||||||
|
mat.SetFloat("_NormalEdgesEnabled", 1f);
|
||||||
|
mat.SetColor("_OutlineColorOuter", Color.black);
|
||||||
|
mat.SetColor("_OutlineColorInner", Color.black);
|
||||||
|
EditorUtility.SetDirty(mat);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void SaveAsset(Material mat)
|
||||||
|
{
|
||||||
|
EditorUtility.SetDirty(mat);
|
||||||
|
AssetDatabase.SaveAssetIfDirty(mat);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e197a9add2f5e9845bac0bddd950232a
|
||||||
@@ -0,0 +1,184 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ProjectM.Simulation;
|
||||||
|
using Unity.Entities;
|
||||||
|
using Unity.Mathematics;
|
||||||
|
using Unity.NetCode;
|
||||||
|
using Unity.Transforms;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UIElements;
|
||||||
|
|
||||||
|
namespace ProjectM.Client
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Client-only ENEMY VISIBILITY markers — makes living enemies (especially the last one) easy to find so a room
|
||||||
|
/// never devolves into hunting an unseen straggler. Observe-only presentation <see cref="SystemBase"/> in
|
||||||
|
/// <see cref="PresentationSystemGroup"/> (same shape as <see cref="OnboardingSystem"/> / <see cref="HudSystem"/>:
|
||||||
|
/// reads replicated state, never mutates the sim, never destroys a ghost). Owns its own runtime UIDocument
|
||||||
|
/// (sortingOrder 48 — just under the HUD's 50) and a POOL of marker glyphs: each living enemy within
|
||||||
|
/// <see cref="FeelConfig.EnemyMarkerRange"/> of the local player gets either a clamped EDGE ARROW when off-screen
|
||||||
|
/// (rotated toward it — the "it's over here" cue, reusing OnboardingSystem's WorldToScreen edge math) or a subtle
|
||||||
|
/// overhead PIP when on-screen. The pips fade toward <see cref="FeelConfig.EnemyMarkerMinAlpha"/> as the on-screen
|
||||||
|
/// enemy count rises (declutter a swarm); off-screen arrows always stay full so a straggler is never missed. The
|
||||||
|
/// boss is excluded (it has its own HUD presence bar); corpses (<see cref="Dying"/>) are excluded.
|
||||||
|
/// </summary>
|
||||||
|
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)]
|
||||||
|
[UpdateInGroup(typeof(PresentationSystemGroup))]
|
||||||
|
public partial class EnemyMarkerSystem : SystemBase
|
||||||
|
{
|
||||||
|
const int MaxMarkers = 32; // pool cap (a room never fields this many; when few remain, all are marked)
|
||||||
|
const float Margin = 48f; // screen-edge inset for off-screen arrows (panel units)
|
||||||
|
|
||||||
|
GameObject _go;
|
||||||
|
UIDocument _doc;
|
||||||
|
bool _built;
|
||||||
|
readonly List<Label> _pool = new();
|
||||||
|
readonly List<float3> _positions = new();
|
||||||
|
|
||||||
|
protected override void OnStartRunning()
|
||||||
|
{
|
||||||
|
if (_go != null) return;
|
||||||
|
_go = new GameObject("~EnemyMarkers");
|
||||||
|
_doc = _go.AddComponent<UIDocument>();
|
||||||
|
_doc.panelSettings = MenuUi.LoadPanelSettings();
|
||||||
|
_doc.sortingOrder = 48; // just below the HUD (50)
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnDestroy()
|
||||||
|
{
|
||||||
|
if (_go != null) Object.Destroy(_go);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnUpdate()
|
||||||
|
{
|
||||||
|
if (_doc == null) return;
|
||||||
|
var root = _doc.rootVisualElement;
|
||||||
|
if (root == null) return;
|
||||||
|
if (!_built)
|
||||||
|
{
|
||||||
|
root.style.position = Position.Absolute;
|
||||||
|
root.style.left = 0; root.style.right = 0; root.style.top = 0; root.style.bottom = 0;
|
||||||
|
root.pickingMode = PickingMode.Ignore; // never eat world clicks
|
||||||
|
_built = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
var cam = Camera.main;
|
||||||
|
if (!FeelConfig.EnemyMarkerEnabled || cam == null)
|
||||||
|
{
|
||||||
|
HideFrom(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Local player position (range gate — scopes markers to the current room / region).
|
||||||
|
bool haveLocal = false; float3 localPos = default;
|
||||||
|
foreach (var lt in SystemAPI.Query<RefRO<LocalTransform>>().WithAll<GhostOwnerIsLocal, PlayerTag>())
|
||||||
|
{ haveLocal = true; localPos = lt.ValueRO.Position; break; }
|
||||||
|
|
||||||
|
// Collect living enemies within range (nearest-capped by MaxMarkers).
|
||||||
|
_positions.Clear();
|
||||||
|
float rangeSq = FeelConfig.EnemyMarkerRange * FeelConfig.EnemyMarkerRange;
|
||||||
|
foreach (var lt in SystemAPI.Query<RefRO<LocalTransform>>().WithAll<EnemyTag>().WithNone<Dying, BossState>())
|
||||||
|
{
|
||||||
|
float3 p = lt.ValueRO.Position;
|
||||||
|
if (haveLocal && math.distancesq(p, localPos) > rangeSq) continue;
|
||||||
|
_positions.Add(p);
|
||||||
|
if (_positions.Count >= MaxMarkers) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
float pw = root.layout.width, ph = root.layout.height;
|
||||||
|
if (pw <= 1f || ph <= 1f) { HideFrom(0); return; }
|
||||||
|
|
||||||
|
// First pass: how many are on-screen (drives the pip declutter fade).
|
||||||
|
int onScreen = 0;
|
||||||
|
for (int i = 0; i < _positions.Count; i++)
|
||||||
|
if (!IsOffScreen(cam, _positions[i], pw, ph)) onScreen++;
|
||||||
|
int fadeStart = math.max(1, FeelConfig.EnemyMarkerFadeStartCount);
|
||||||
|
float pipAlpha = math.lerp(1f, math.clamp(FeelConfig.EnemyMarkerMinAlpha, 0f, 1f),
|
||||||
|
math.saturate((onScreen - fadeStart) / (float)fadeStart));
|
||||||
|
|
||||||
|
// Second pass: place each marker.
|
||||||
|
Color baseCol = FeelConfig.EnemyMarkerColor;
|
||||||
|
float size = FeelConfig.EnemyMarkerSize;
|
||||||
|
for (int i = 0; i < _positions.Count; i++)
|
||||||
|
{
|
||||||
|
var lbl = GetMarker(i, root);
|
||||||
|
Place(lbl, cam, _positions[i], pw, ph, baseCol, size, pipAlpha);
|
||||||
|
}
|
||||||
|
HideFrom(_positions.Count);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsOffScreen(Camera cam, float3 world, float pw, float ph)
|
||||||
|
{
|
||||||
|
Vector3 sp = cam.WorldToScreenPoint((Vector3)world);
|
||||||
|
bool behind = sp.z < 0f;
|
||||||
|
float px = (sp.x / Mathf.Max(1f, Screen.width)) * pw;
|
||||||
|
float py = (1f - sp.y / Mathf.Max(1f, Screen.height)) * ph;
|
||||||
|
if (behind) { px = pw - px; py = ph - py; }
|
||||||
|
return behind || px < Margin || px > pw - Margin || py < Margin || py > ph - Margin;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Place(Label lbl, Camera cam, float3 world, float pw, float ph, Color baseCol, float size, float pipAlpha)
|
||||||
|
{
|
||||||
|
Vector3 sp = cam.WorldToScreenPoint((Vector3)world);
|
||||||
|
bool behind = sp.z < 0f;
|
||||||
|
float px = (sp.x / Mathf.Max(1f, Screen.width)) * pw;
|
||||||
|
float py = (1f - sp.y / Mathf.Max(1f, Screen.height)) * ph;
|
||||||
|
if (behind) { px = pw - px; py = ph - py; }
|
||||||
|
|
||||||
|
bool off = behind || px < Margin || px > pw - Margin || py < Margin || py > ph - Margin;
|
||||||
|
float cx = pw * 0.5f, cy = ph * 0.5f;
|
||||||
|
float dx = px - cx, dy = py - cy;
|
||||||
|
float len = Mathf.Sqrt(dx * dx + dy * dy);
|
||||||
|
if (len < 0.001f) { dx = 0f; dy = -1f; len = 1f; }
|
||||||
|
float ndx = dx / len, ndy = dy / len;
|
||||||
|
|
||||||
|
lbl.style.fontSize = size;
|
||||||
|
|
||||||
|
if (off)
|
||||||
|
{
|
||||||
|
// Clamp to the margin rectangle along the center->enemy ray, rotate a triangle toward it.
|
||||||
|
float tx = (ndx > 0 ? (pw - Margin - cx) : (Margin - cx)) / (Mathf.Abs(ndx) < 1e-4f ? (ndx < 0 ? -1e-4f : 1e-4f) : ndx);
|
||||||
|
float ty = (ndy > 0 ? (ph - Margin - cy) : (Margin - cy)) / (Mathf.Abs(ndy) < 1e-4f ? (ndy < 0 ? -1e-4f : 1e-4f) : ndy);
|
||||||
|
float tt = Mathf.Min(Mathf.Abs(tx), Mathf.Abs(ty));
|
||||||
|
float ax = cx + ndx * tt, ay = cy + ndy * tt;
|
||||||
|
float angle = Mathf.Atan2(dy, dx) * Mathf.Rad2Deg; // "▶" points +x at 0 deg
|
||||||
|
lbl.text = "▶";
|
||||||
|
lbl.style.left = ax - size * 0.5f;
|
||||||
|
lbl.style.top = ay - size * 0.5f;
|
||||||
|
lbl.style.rotate = new StyleRotate(new Rotate(new Angle(angle)));
|
||||||
|
lbl.style.color = new Color(baseCol.r, baseCol.g, baseCol.b, baseCol.a); // arrows stay full alpha
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Overhead pip pointing down at the enemy; fades when the screen is crowded.
|
||||||
|
lbl.text = "▾";
|
||||||
|
lbl.style.left = px - size * 0.5f;
|
||||||
|
lbl.style.top = py - size - 20f; // float above the enemy
|
||||||
|
lbl.style.rotate = new StyleRotate(new Rotate(new Angle(0f)));
|
||||||
|
lbl.style.color = new Color(baseCol.r, baseCol.g, baseCol.b, baseCol.a * pipAlpha);
|
||||||
|
}
|
||||||
|
lbl.style.display = DisplayStyle.Flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
Label GetMarker(int i, VisualElement root)
|
||||||
|
{
|
||||||
|
while (_pool.Count <= i)
|
||||||
|
{
|
||||||
|
var l = new Label("▶");
|
||||||
|
l.style.position = Position.Absolute;
|
||||||
|
l.style.unityFontStyleAndWeight = FontStyle.Bold;
|
||||||
|
l.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||||
|
l.pickingMode = PickingMode.Ignore;
|
||||||
|
l.style.display = DisplayStyle.None;
|
||||||
|
root.Add(l);
|
||||||
|
_pool.Add(l);
|
||||||
|
}
|
||||||
|
return _pool[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
void HideFrom(int start)
|
||||||
|
{
|
||||||
|
for (int i = start; i < _pool.Count; i++)
|
||||||
|
_pool[i].style.display = DisplayStyle.None;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5b754936521bd1443b6daa41a9ae0fc8
|
||||||
@@ -161,6 +161,20 @@ namespace ProjectM.Client
|
|||||||
public static float StrikeBeepMaxDistSq;
|
public static float StrikeBeepMaxDistSq;
|
||||||
|
|
||||||
|
|
||||||
|
// ---- Enemy visibility markers (EnemyMarkerSystem: off-screen edge arrows + on-screen overhead pips) ----
|
||||||
|
/// <summary>Master gate for the enemy visibility markers.</summary>
|
||||||
|
public static bool EnemyMarkerEnabled;
|
||||||
|
/// <summary>Only mark living enemies within this world distance of the local player (scopes to the current room; avoids cross-region arrow spam).</summary>
|
||||||
|
public static float EnemyMarkerRange;
|
||||||
|
/// <summary>On-screen enemy count above which the overhead pips fade toward EnemyMarkerMinAlpha (declutter a swarm; off-screen arrows stay full).</summary>
|
||||||
|
public static int EnemyMarkerFadeStartCount;
|
||||||
|
/// <summary>Faded pip alpha once the on-screen count is well past EnemyMarkerFadeStartCount.</summary>
|
||||||
|
public static float EnemyMarkerMinAlpha;
|
||||||
|
/// <summary>Marker tint (pip + off-screen arrow).</summary>
|
||||||
|
public static Color EnemyMarkerColor;
|
||||||
|
/// <summary>Marker glyph font size (px).</summary>
|
||||||
|
public static float EnemyMarkerSize;
|
||||||
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
||||||
public static void ResetDefaults()
|
public static void ResetDefaults()
|
||||||
{
|
{
|
||||||
@@ -240,6 +254,13 @@ namespace ProjectM.Client
|
|||||||
StrikeBeepLeadTicks = 8;
|
StrikeBeepLeadTicks = 8;
|
||||||
StrikeBeepMaxDistSq = 225f; // 15 m
|
StrikeBeepMaxDistSq = 225f; // 15 m
|
||||||
|
|
||||||
|
// Enemy visibility markers (EnemyMarkerSystem)
|
||||||
|
EnemyMarkerEnabled = true;
|
||||||
|
EnemyMarkerRange = 140f;
|
||||||
|
EnemyMarkerFadeStartCount = 6;
|
||||||
|
EnemyMarkerMinAlpha = 0.28f;
|
||||||
|
EnemyMarkerColor = new Color(1f, 0.86f, 0.3f, 1f); // warm amber, reads over the cool world
|
||||||
|
EnemyMarkerSize = 24f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,103 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using ProjectM.Simulation;
|
||||||
|
using Unity.Entities;
|
||||||
|
using Unity.Mathematics;
|
||||||
|
using Unity.Transforms;
|
||||||
|
|
||||||
|
namespace ProjectM.Client
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Client-only harvest BODY feedback for resource nodes + Blight clutter — the "you're mining this down" cue that
|
||||||
|
/// complements <see cref="WorldFeedbackSystem"/>'s chip particles/SFX. Observe-only presentation (SystemBase, main
|
||||||
|
/// thread, no Burst) in <see cref="PresentationSystemGroup"/>: it edge-detects each node/clutter ghost's replicated
|
||||||
|
/// <c>Remaining</c> and drives a CLIENT-OWNED <see cref="PostTransformMatrix"/> scale on the ghost root so the node
|
||||||
|
/// (1) SHRINKS as Remaining falls toward 0 and (2) POPS briefly larger on each hit — a clear per-hit reaction plus
|
||||||
|
/// a running "how much is left" read. PostTransformMatrix composes on top of the replicated LocalTransform and is
|
||||||
|
/// NOT a ghost field, so this is pure client cosmetics: no wire change, no sim mutation, and it never destroys a
|
||||||
|
/// ghost (GhostDespawnSystem owns despawn; the shatter burst is WorldFeedbackSystem's prune path). Uses a scale
|
||||||
|
/// reaction rather than a <c>_BaseColor</c> flash because node materials (unlike the white-based enemy/player
|
||||||
|
/// bodies) aren't guaranteed white, so a base-color override could clobber their rest tint. Knobs in
|
||||||
|
/// <see cref="WorldFeelConfig"/> (<c>NodeMinScale</c> / <c>NodeHitPopScale</c> / <c>NodePopDurationSec</c>).
|
||||||
|
/// </summary>
|
||||||
|
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)]
|
||||||
|
[UpdateInGroup(typeof(PresentationSystemGroup))]
|
||||||
|
public partial class NodeFeedbackSystem : SystemBase
|
||||||
|
{
|
||||||
|
class Entry
|
||||||
|
{
|
||||||
|
public int LastRemaining;
|
||||||
|
public int MaxRemaining; // client "full" reference = the largest Remaining ever seen for this node
|
||||||
|
public float Pop; // 1 on a fresh hit, decays to 0 (the per-hit scale-up)
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly Dictionary<Entity, Entry> _tracked = new();
|
||||||
|
readonly HashSet<Entity> _seen = new();
|
||||||
|
readonly List<Entity> _stale = new();
|
||||||
|
|
||||||
|
protected override void OnUpdate()
|
||||||
|
{
|
||||||
|
if (!WorldFeelConfig.Enabled) { RestoreAll(); return; }
|
||||||
|
float dt = SystemAPI.Time.DeltaTime;
|
||||||
|
EntityManager.CompleteDependencyBeforeRO<ResourceNode>();
|
||||||
|
EntityManager.CompleteDependencyBeforeRO<BlightClutter>();
|
||||||
|
|
||||||
|
_seen.Clear();
|
||||||
|
var ecb = new EntityCommandBuffer(Unity.Collections.Allocator.Temp);
|
||||||
|
|
||||||
|
float popDecay = dt / math.max(0.01f, WorldFeelConfig.NodePopDurationSec);
|
||||||
|
float minScale = math.clamp(WorldFeelConfig.NodeMinScale, 0.05f, 1f);
|
||||||
|
float popAmt = math.max(0f, WorldFeelConfig.NodeHitPopScale);
|
||||||
|
|
||||||
|
foreach (var (node, entity) in SystemAPI.Query<RefRO<ResourceNode>>().WithEntityAccess())
|
||||||
|
Drive(entity, node.ValueRO.Remaining, popDecay, minScale, popAmt, ecb);
|
||||||
|
foreach (var (clut, entity) in SystemAPI.Query<RefRO<BlightClutter>>().WithEntityAccess())
|
||||||
|
Drive(entity, clut.ValueRO.Remaining, popDecay, minScale, popAmt, ecb);
|
||||||
|
|
||||||
|
ecb.Playback(EntityManager);
|
||||||
|
ecb.Dispose();
|
||||||
|
|
||||||
|
// Prune despawned (depleted/shattered) nodes — their PostTransformMatrix dies with the ghost.
|
||||||
|
if (_tracked.Count != _seen.Count)
|
||||||
|
{
|
||||||
|
_stale.Clear();
|
||||||
|
foreach (var kv in _tracked) if (!_seen.Contains(kv.Key)) _stale.Add(kv.Key);
|
||||||
|
for (int i = 0; i < _stale.Count; i++) _tracked.Remove(_stale[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Drive(Entity e, int remaining, float popDecay, float minScale, float popAmt, EntityCommandBuffer ecb)
|
||||||
|
{
|
||||||
|
_seen.Add(e);
|
||||||
|
if (!_tracked.TryGetValue(e, out var entry))
|
||||||
|
{
|
||||||
|
entry = new Entry { LastRemaining = remaining, MaxRemaining = math.max(1, remaining), Pop = 0f };
|
||||||
|
_tracked[e] = entry;
|
||||||
|
if (!EntityManager.HasComponent<PostTransformMatrix>(e))
|
||||||
|
ecb.AddComponent(e, new PostTransformMatrix { Value = float4x4.Scale(1f) }); // present next frame
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (remaining < entry.LastRemaining) entry.Pop = 1f; // a hit landed
|
||||||
|
entry.LastRemaining = remaining;
|
||||||
|
if (remaining > entry.MaxRemaining) entry.MaxRemaining = remaining;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry.Pop = math.max(0f, entry.Pop - popDecay);
|
||||||
|
|
||||||
|
// Progressive shrink toward NodeMinScale as Remaining -> 0, plus a brief per-hit pop.
|
||||||
|
float frac = math.saturate(remaining / (float)math.max(1, entry.MaxRemaining));
|
||||||
|
float scale = math.lerp(minScale, 1f, frac) * (1f + entry.Pop * popAmt);
|
||||||
|
if (EntityManager.HasComponent<PostTransformMatrix>(e))
|
||||||
|
EntityManager.SetComponentData(e, new PostTransformMatrix { Value = float4x4.Scale(scale) });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Toggled off (WorldFeelConfig.Enabled=false) -> restore every tracked node to full size and stop tracking.
|
||||||
|
void RestoreAll()
|
||||||
|
{
|
||||||
|
foreach (var kv in _tracked)
|
||||||
|
if (EntityManager.Exists(kv.Key) && EntityManager.HasComponent<PostTransformMatrix>(kv.Key))
|
||||||
|
EntityManager.SetComponentData(kv.Key, new PostTransformMatrix { Value = float4x4.Scale(1f) });
|
||||||
|
_tracked.Clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1fca48a6fde1ed94b9f2445b4d9c73d3
|
||||||
@@ -81,7 +81,7 @@ namespace ProjectM.Client
|
|||||||
SystemAPI.Query<RefRO<ResourceNode>, RefRO<LocalTransform>>().WithEntityAccess())
|
SystemAPI.Query<RefRO<ResourceNode>, RefRO<LocalTransform>>().WithEntityAccess())
|
||||||
{
|
{
|
||||||
_seen.Add(e);
|
_seen.Add(e);
|
||||||
Observe(e, node.ValueRO.Remaining, xf.ValueRO.Position, false, TintForResource(node.ValueRO.ResourceId));
|
Observe(e, node.ValueRO.Remaining, xf.ValueRO.Position, false, TintForResource(node.ValueRO.ResourceId), haveLocal && math.distancesq(xf.ValueRO.Position, localPos) <= WorldFeelConfig.ProximityRange * WorldFeelConfig.ProximityRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Blight clutter — chip on damage.
|
// Blight clutter — chip on damage.
|
||||||
@@ -89,7 +89,7 @@ namespace ProjectM.Client
|
|||||||
SystemAPI.Query<RefRO<BlightClutter>, RefRO<LocalTransform>>().WithEntityAccess())
|
SystemAPI.Query<RefRO<BlightClutter>, RefRO<LocalTransform>>().WithEntityAccess())
|
||||||
{
|
{
|
||||||
_seen.Add(e);
|
_seen.Add(e);
|
||||||
Observe(e, clutter.ValueRO.Remaining, xf.ValueRO.Position, true, WorldFeelConfig.WildTint);
|
Observe(e, clutter.ValueRO.Remaining, xf.ValueRO.Position, true, WorldFeelConfig.WildTint, haveLocal && math.distancesq(xf.ValueRO.Position, localPos) <= WorldFeelConfig.ProximityRange * WorldFeelConfig.ProximityRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prune: a despawn = the server destroyed it (node depleted / clutter shattered). Gate on proximity so
|
// Prune: a despawn = the server destroyed it (node depleted / clutter shattered). Gate on proximity so
|
||||||
@@ -119,12 +119,17 @@ namespace ProjectM.Client
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Observe(Entity e, int remaining, float3 pos, bool isClutter, Color tint)
|
void Observe(Entity e, int remaining, float3 pos, bool isClutter, Color tint, bool nearLocal)
|
||||||
{
|
{
|
||||||
if (_cache.TryGetValue(e, out var prev) && remaining < prev.Remaining)
|
if (_cache.TryGetValue(e, out var prev) && remaining < prev.Remaining)
|
||||||
{
|
{
|
||||||
EmitTinted(_chipFx, (Vector3)pos + Vector3.up * 0.6f, WorldFeelConfig.ChipBurstCount, tint);
|
EmitTinted(_chipFx, (Vector3)pos + Vector3.up * 0.6f, WorldFeelConfig.ChipBurstCount, tint);
|
||||||
PlayClip(_chipClip, (Vector3)pos, WorldFeelConfig.ChipSfxVolume);
|
PlayClip(_chipClip, (Vector3)pos, WorldFeelConfig.ChipSfxVolume);
|
||||||
|
if (nearLocal) // tiny per-hit camera impact, only for harvesting near the local player (not a teammate's far node)
|
||||||
|
{
|
||||||
|
if (WorldFeelConfig.ChipFovKick > 0f) PrototypeCameraRig.PunchFov(WorldFeelConfig.ChipFovKick, 90f);
|
||||||
|
if (WorldFeelConfig.ChipShake > 0f) PrototypeCameraRig.AddShake(WorldFeelConfig.ChipShake);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_cache[e] = new Cache { Remaining = remaining, Pos = pos, IsClutter = isClutter, Tint = tint };
|
_cache[e] = new Cache { Remaining = remaining, Pos = pos, IsClutter = isClutter, Tint = tint };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,13 +42,25 @@ namespace ProjectM.Client
|
|||||||
/// <summary>Tint for Biomass-node chips (HDR sickly green).</summary>
|
/// <summary>Tint for Biomass-node chips (HDR sickly green).</summary>
|
||||||
public static Color BiomassTint;
|
public static Color BiomassTint;
|
||||||
|
|
||||||
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)]
|
// ---- Node harvest BODY feedback (NodeFeedbackSystem: client-only PostTransformMatrix scale). ----
|
||||||
public static void ResetDefaults()
|
/// <summary>Smallest a node/clutter shrinks to just before it depletes (fraction of its full size).</summary>
|
||||||
|
public static float NodeMinScale;
|
||||||
|
/// <summary>Brief extra scale-up on each harvest hit (the per-hit "reaction" pop); decays over NodePopDurationSec.</summary>
|
||||||
|
public static float NodeHitPopScale;
|
||||||
|
/// <summary>Seconds for the per-hit scale-pop to decay back.</summary>
|
||||||
|
public static float NodePopDurationSec;
|
||||||
|
|
||||||
|
/// <summary>Tiny camera FOV kick per harvest hit near the player (impact); 0 = off.</summary>
|
||||||
|
public static float ChipFovKick;
|
||||||
|
/// <summary>Tiny camera shake per harvest hit near the player.</summary>
|
||||||
|
public static float ChipShake;
|
||||||
|
|
||||||
|
public static void ResetDefaults()
|
||||||
{
|
{
|
||||||
Enabled = true;
|
Enabled = true;
|
||||||
ChipBurstCount = 6;
|
ChipBurstCount = 12; // beefed from 6 -> a clearly visible chip spray per harvest hit
|
||||||
ClearBurstCount = 18;
|
ClearBurstCount = 22;
|
||||||
ChipSfxVolume = 0.30f;
|
ChipSfxVolume = 0.42f; // beefed from 0.30 -> a punchier "tink"
|
||||||
ClearSfxVolume = 0.55f;
|
ClearSfxVolume = 0.55f;
|
||||||
ClearFovKick = 0.8f;
|
ClearFovKick = 0.8f;
|
||||||
ClearShake = 0.12f;
|
ClearShake = 0.12f;
|
||||||
@@ -56,6 +68,11 @@ namespace ProjectM.Client
|
|||||||
WildTint = new Color(3.0f, 1.1f, 0.25f);
|
WildTint = new Color(3.0f, 1.1f, 0.25f);
|
||||||
OreTint = new Color(2.6f, 1.9f, 0.7f);
|
OreTint = new Color(2.6f, 1.9f, 0.7f);
|
||||||
BiomassTint = new Color(0.9f, 2.4f, 0.8f);
|
BiomassTint = new Color(0.9f, 2.4f, 0.8f);
|
||||||
|
NodeMinScale = 0.35f; // node shrinks to ~1/3 size as it nears depletion
|
||||||
|
NodeHitPopScale = 0.16f; // brief +16% pop on each hit
|
||||||
|
NodePopDurationSec = 0.16f;
|
||||||
|
ChipFovKick = 0.35f; // subtle per-hit camera impact near the player
|
||||||
|
ChipShake = 0.05f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,17 @@ namespace ProjectM.Server
|
|||||||
bool sweep = havePhysics && sweepMask != 0u;
|
bool sweep = havePhysics && sweepMask != 0u;
|
||||||
const float SweepRadius = 0.5f; // collide-and-slide sphere radius for Husk movement
|
const float SweepRadius = 0.5f; // collide-and-slide sphere radius for Husk movement
|
||||||
|
|
||||||
|
// Anti-stuck (1/2): DEPENETRATE every living enemy out of any env/cover it overlaps BEFORE seeking, so a
|
||||||
|
// Husk spawned inside or shoved into a cover rock isn't frozen by a zero-fraction sweep (the sweep cannot
|
||||||
|
// move a mover that STARTS already penetrating). One point-distance query per living enemy (<=~15/room).
|
||||||
|
// Boss excluded (BossAISystem owns it at a larger radius).
|
||||||
|
if (sweep)
|
||||||
|
{
|
||||||
|
foreach (var depenXform in SystemAPI.Query<RefRW<LocalTransform>>()
|
||||||
|
.WithAll<EnemyTag>().WithNone<Dying, BossState>())
|
||||||
|
depenXform.ValueRW.Position = EnemyMoveUtil.Depenetrate(in physics, depenXform.ValueRO.Position, SweepRadius, envFilter);
|
||||||
|
}
|
||||||
|
|
||||||
foreach (var (xform, stats, cooldown, knockback, windup, region) in
|
foreach (var (xform, stats, cooldown, knockback, windup, region) in
|
||||||
SystemAPI.Query<RefRW<LocalTransform>, RefRO<EnemyStats>, RefRW<EnemyAttackCooldown>,
|
SystemAPI.Query<RefRW<LocalTransform>, RefRO<EnemyStats>, RefRW<EnemyAttackCooldown>,
|
||||||
RefRW<KnockbackState>, RefRW<AttackWindup>, RefRO<RegionTag>>()
|
RefRW<KnockbackState>, RefRW<AttackWindup>, RefRO<RegionTag>>()
|
||||||
@@ -548,6 +559,84 @@ namespace ProjectM.Server
|
|||||||
sepEnt.Dispose(); sepPos.Dispose(); sepRad.Dispose(); sepMov.Dispose();
|
sepEnt.Dispose(); sepPos.Dispose(); sepRad.Dispose(); sepMov.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Anti-stuck (2/2): the GUARANTEED backstop. An enemy that WANTS to close on its target (outside attack
|
||||||
|
// range, not knocked/lunging/staggered) but hasn't gained ground on it for StuckUnstickTicks is phase-
|
||||||
|
// nudged toward the nearest target (collide-and-slide bypassed) until it escapes -> a room can never
|
||||||
|
// soft-lock on one Husk wedged in geometry the reactive slide can't solve. Progress is measured as
|
||||||
|
// distance CLOSED toward the target (not raw displacement) so the separation jiggle can't mask a stuck
|
||||||
|
// Husk. Server-only; EnemyNavState is not replicated. Spitters hold at range by design (excluded); the
|
||||||
|
// boss is driven by BossAISystem (excluded).
|
||||||
|
{
|
||||||
|
const float StuckMinProgressPerTick = 0.02f;
|
||||||
|
const uint StuckUnstickTicks = 90u; // ~1.5s of no ground gained before the nudge triggers
|
||||||
|
const uint NudgeBurstTicks = 45u; // ~0.75s of phasing toward the target per trigger
|
||||||
|
const float UnstickNudgeSpeed = 4.5f; // units/s while phase-nudging out of geometry
|
||||||
|
float nudgeStep = UnstickNudgeSpeed * dt;
|
||||||
|
foreach (var (nxform, nstats, nav, nregion, nent) in
|
||||||
|
SystemAPI.Query<RefRW<LocalTransform>, RefRO<EnemyStats>, RefRW<EnemyNavState>, RefRO<RegionTag>>()
|
||||||
|
.WithAll<EnemyTag>().WithNone<SpitterState, BossState, Dying>().WithEntityAccess())
|
||||||
|
{
|
||||||
|
float3 npos = nxform.ValueRO.Position;
|
||||||
|
byte nRegion = nregion.ValueRO.Region;
|
||||||
|
|
||||||
|
bool committed = false;
|
||||||
|
if (SystemAPI.HasComponent<KnockbackState>(nent))
|
||||||
|
{
|
||||||
|
var k = SystemAPI.GetComponent<KnockbackState>(nent);
|
||||||
|
committed |= k.UntilTick != 0 && new NetworkTick(k.UntilTick).IsNewerThan(serverTick);
|
||||||
|
}
|
||||||
|
if (SystemAPI.HasComponent<LungeState>(nent))
|
||||||
|
{
|
||||||
|
var l = SystemAPI.GetComponent<LungeState>(nent);
|
||||||
|
committed |= (l.UntilTick != 0 && new NetworkTick(l.UntilTick).IsNewerThan(serverTick))
|
||||||
|
|| (l.StaggerUntilTick != 0 && new NetworkTick(l.StaggerUntilTick).IsNewerThan(serverTick));
|
||||||
|
}
|
||||||
|
|
||||||
|
EnemyAIMath.PickWeightedNearest(npos, playerPositions, playerRegions, structurePositions, structureRegions, nRegion, structAggro, out bool nIsStruct, out int nIdx);
|
||||||
|
bool nCoreAlive = coreAlive && nRegion == RegionId.Base;
|
||||||
|
bool hasTarget = nIdx >= 0 || nCoreAlive;
|
||||||
|
float3 nTarget = nIdx < 0 ? corePos : (nIsStruct ? structurePositions[nIdx] : playerPositions[nIdx]);
|
||||||
|
bool wantsToClose = hasTarget && !committed
|
||||||
|
&& math.distance(npos.xz, nTarget.xz) > nstats.ValueRO.AttackRange * 1.15f;
|
||||||
|
|
||||||
|
bool nudging = nav.ValueRO.NudgeUntilTick != 0 && new NetworkTick(nav.ValueRO.NudgeUntilTick).IsNewerThan(serverTick);
|
||||||
|
if (nudging)
|
||||||
|
{
|
||||||
|
if (wantsToClose)
|
||||||
|
{
|
||||||
|
float3 toT = nTarget - npos; toT.y = 0f;
|
||||||
|
float l2 = math.lengthsq(toT);
|
||||||
|
if (l2 > 1e-6f)
|
||||||
|
{
|
||||||
|
float3 step = math.normalize(toT) * math.min(nudgeStep, math.sqrt(l2));
|
||||||
|
float3 np = npos + step; np.y = npos.y;
|
||||||
|
nxform.ValueRW.Position = np;
|
||||||
|
nav.ValueRW.LastPos = np;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nav.ValueRW.NudgeUntilTick = 0; // reached range / lost target -> stop nudging
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!wantsToClose)
|
||||||
|
{
|
||||||
|
nav.ValueRW.StuckTicks = 0u;
|
||||||
|
nav.ValueRW.LastPos = npos;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
float progressToward = math.distance(nav.ValueRO.LastPos.xz, nTarget.xz) - math.distance(npos.xz, nTarget.xz);
|
||||||
|
uint st = progressToward < StuckMinProgressPerTick ? nav.ValueRO.StuckTicks + 1u : 0u;
|
||||||
|
nav.ValueRW.LastPos = npos;
|
||||||
|
if (st >= StuckUnstickTicks)
|
||||||
|
{
|
||||||
|
nav.ValueRW.NudgeUntilTick = TickUtil.NonZero(now + NudgeBurstTicks);
|
||||||
|
st = 0u;
|
||||||
|
}
|
||||||
|
nav.ValueRW.StuckTicks = st;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (chargerWhiffsThisTick != 0 && SystemAPI.HasSingleton<DevTelemetry>())
|
if (chargerWhiffsThisTick != 0 && SystemAPI.HasSingleton<DevTelemetry>())
|
||||||
SystemAPI.GetSingletonRW<DevTelemetry>().ValueRW.ChargerWhiffWindowsOpened += chargerWhiffsThisTick;
|
SystemAPI.GetSingletonRW<DevTelemetry>().ValueRW.ChargerWhiffWindowsOpened += chargerWhiffsThisTick;
|
||||||
|
|
||||||
|
|||||||
@@ -13,8 +13,10 @@ namespace ProjectM.Server
|
|||||||
public static class EnemyMoveUtil
|
public static class EnemyMoveUtil
|
||||||
{
|
{
|
||||||
/// <summary>Collide-and-slide sphere-cast for server-authoritative enemy movement: sweep the intended step
|
/// <summary>Collide-and-slide sphere-cast for server-authoritative enemy movement: sweep the intended step
|
||||||
/// against the static environment (boundary ring + landmarks + player-built walls) and stop at / glance along
|
/// against the static environment (boundary ring + landmarks + cover rocks + player-built walls) and stop at /
|
||||||
/// the first wall hit. Y is held flat (top-down movement plane).</summary>
|
/// glance along wall hits. Runs up to TWO slide iterations so a concave pocket (a cover rock meeting the
|
||||||
|
/// boundary rim) glances along BOTH surfaces instead of dead-stopping at the first (a single iteration left
|
||||||
|
/// enemies parked in pockets). Y is held flat (top-down movement plane).</summary>
|
||||||
public static float3 SweptMove(in PhysicsWorldSingleton physics, float3 from, float3 to, float radius, CollisionFilter filter)
|
public static float3 SweptMove(in PhysicsWorldSingleton physics, float3 from, float3 to, float radius, CollisionFilter filter)
|
||||||
{
|
{
|
||||||
float3 delta = to - from;
|
float3 delta = to - from;
|
||||||
@@ -22,27 +24,62 @@ namespace ProjectM.Server
|
|||||||
float dist = math.length(delta);
|
float dist = math.length(delta);
|
||||||
if (dist < 1e-5f)
|
if (dist < 1e-5f)
|
||||||
return to;
|
return to;
|
||||||
float3 dir = delta / dist;
|
|
||||||
const float skin = 0.05f;
|
const float skin = 0.05f;
|
||||||
var cw = physics.CollisionWorld;
|
var cw = physics.CollisionWorld;
|
||||||
|
float3 dir = delta / dist;
|
||||||
if (!cw.SphereCast(from, radius, dir, dist, out var hit, filter))
|
if (!cw.SphereCast(from, radius, dir, dist, out var hit, filter))
|
||||||
return to;
|
return to;
|
||||||
|
|
||||||
float allowed = math.max(0f, hit.Fraction * dist - skin);
|
float allowed = math.max(0f, hit.Fraction * dist - skin);
|
||||||
float3 stop = from + dir * allowed;
|
float3 pos = from + dir * allowed;
|
||||||
stop.y = from.y;
|
pos.y = from.y;
|
||||||
|
float3 remaining = to - pos;
|
||||||
|
|
||||||
// Slide the unused motion along the wall, then sweep the slide so we don't tunnel a second wall.
|
for (int i = 0; i < 2; i++)
|
||||||
float3 slide = EnemyAIMath.SlideVelocity(to - stop, hit.SurfaceNormal);
|
{
|
||||||
|
float3 slide = EnemyAIMath.SlideVelocity(remaining, hit.SurfaceNormal);
|
||||||
float slideDist = math.length(slide);
|
float slideDist = math.length(slide);
|
||||||
if (slideDist < 1e-5f)
|
if (slideDist < 1e-5f)
|
||||||
return stop;
|
break;
|
||||||
float3 sdir = slide / slideDist;
|
float3 sdir = slide / slideDist;
|
||||||
float3 result = cw.SphereCast(stop, radius, sdir, slideDist, out var hit2, filter)
|
if (cw.SphereCast(pos, radius, sdir, slideDist, out var hit2, filter))
|
||||||
? stop + sdir * math.max(0f, hit2.Fraction * slideDist - skin)
|
{
|
||||||
: stop + slide;
|
float sAllowed = math.max(0f, hit2.Fraction * slideDist - skin);
|
||||||
result.y = from.y;
|
pos += sdir * sAllowed;
|
||||||
return result;
|
remaining = slide - sdir * sAllowed; // carry the still-unused motion into the next glance
|
||||||
|
hit = hit2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pos += slide;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pos.y = from.y;
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>Push a sphere at <paramref name="pos"/> out of any static env/structure it overlaps, along the
|
||||||
|
/// nearest surface normal (flattened to XZ; a near-vertical floor/ceiling normal is ignored so movers aren't
|
||||||
|
/// shoved off their plane). Fixes the "spawned or shoved INTO a rock -> SphereCast fraction ~0 -> frozen
|
||||||
|
/// forever" class: the collide-and-slide sweep can never move a mover that STARTS already penetrating, so we
|
||||||
|
/// un-embed it first. The correction is capped at one radius/tick so it eases out over a couple of ticks
|
||||||
|
/// rather than teleporting. Stateless; called once per enemy per tick before seeking.</summary>
|
||||||
|
public static float3 Depenetrate(in PhysicsWorldSingleton physics, float3 pos, float radius, CollisionFilter filter)
|
||||||
|
{
|
||||||
|
var cw = physics.CollisionWorld;
|
||||||
|
var input = new PointDistanceInput { Position = pos, MaxDistance = radius + 0.5f, Filter = filter };
|
||||||
|
if (!cw.CalculateDistance(input, out var hit) || hit.Distance >= radius)
|
||||||
|
return pos;
|
||||||
|
float3 n = hit.SurfaceNormal;
|
||||||
|
n.y = 0f;
|
||||||
|
float len = math.length(n);
|
||||||
|
if (len < 1e-5f)
|
||||||
|
return pos; // floor/ceiling normal -> don't shove the mover off its movement plane
|
||||||
|
float push = math.min(radius - hit.Distance, radius); // cap so a deep embed eases out over ticks, no pop
|
||||||
|
float3 outp = pos + (n / len) * push;
|
||||||
|
outp.y = pos.y;
|
||||||
|
return outp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,14 +40,18 @@ namespace ProjectM.Simulation
|
|||||||
/// Projects a planar movement <paramref name="vel"/> onto a wall plane defined by <paramref name="surfaceNormal"/>
|
/// Projects a planar movement <paramref name="vel"/> onto a wall plane defined by <paramref name="surfaceNormal"/>
|
||||||
/// (collide-and-slide): removes the component of <paramref name="vel"/> that pushes into the surface so the
|
/// (collide-and-slide): removes the component of <paramref name="vel"/> that pushes into the surface so the
|
||||||
/// mover glances along the wall instead of stopping dead. Both inputs are flattened to the XZ plane (top-down).
|
/// mover glances along the wall instead of stopping dead. Both inputs are flattened to the XZ plane (top-down).
|
||||||
/// Returns <paramref name="vel"/> unchanged when the normal is degenerate.
|
/// When the flattened normal is DEGENERATE (a near-vertical / rounded-rock face collapses to ~0 in XZ),
|
||||||
|
/// sliding is undefined and returning <paramref name="vel"/> unchanged would drive the mover straight back
|
||||||
|
/// into the wall (the enemy-stuck-on-cover-rock bug) — so it deflects to a horizontal tangent of the motion
|
||||||
|
/// (a 90 deg turn about Y) to glance AROUND the obstacle instead of freezing against it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static float3 SlideVelocity(float3 vel, float3 surfaceNormal)
|
public static float3 SlideVelocity(float3 vel, float3 surfaceNormal)
|
||||||
{
|
{
|
||||||
|
vel.y = 0f;
|
||||||
surfaceNormal.y = 0f;
|
surfaceNormal.y = 0f;
|
||||||
float len = math.length(surfaceNormal);
|
float len = math.length(surfaceNormal);
|
||||||
if (len < 1e-6f)
|
if (len < 1e-6f)
|
||||||
return vel;
|
return new float3(-vel.z, 0f, vel.x); // degenerate normal -> tangent deflection, not motion-into-wall
|
||||||
float3 n = surfaceNormal / len;
|
float3 n = surfaceNormal / len;
|
||||||
float3 slid = vel - math.dot(vel, n) * n;
|
float3 slid = vel - math.dot(vel, n) * n;
|
||||||
slid.y = 0f;
|
slid.y = 0f;
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
using Unity.Entities;
|
||||||
|
using Unity.Mathematics;
|
||||||
|
|
||||||
|
namespace ProjectM.Simulation
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Server-only per-Husk navigation / anti-stuck state (NOT replicated — clients never simulate enemies, so this
|
||||||
|
/// carries no <c>[GhostField]</c> and does not change the ghost hash). Tracks the enemy's XZ position at the end
|
||||||
|
/// of last tick plus how long it has failed to make progress toward its target, so <c>EnemyAISystem</c> can
|
||||||
|
/// phase-nudge a genuinely stuck enemy (wedged on a cover rock or a rock-vs-boundary pocket) toward the nearest
|
||||||
|
/// player — the guaranteed backstop that keeps an expedition room from ever soft-locking on one unreachable Husk.
|
||||||
|
/// Baked onto every enemy by <c>EnemyAuthoring</c>. Complements the collide-and-slide fixes in
|
||||||
|
/// <see cref="EnemyAIMath.SlideVelocity"/> / <c>EnemyMoveUtil</c> (which make sticking rare in the first place).
|
||||||
|
/// </summary>
|
||||||
|
public struct EnemyNavState : IComponentData
|
||||||
|
{
|
||||||
|
/// <summary>Enemy XZ position at the end of last tick (progress baseline; Y unused).</summary>
|
||||||
|
public float3 LastPos;
|
||||||
|
|
||||||
|
/// <summary>Consecutive ticks the enemy wanted to move toward its target but made ~no progress.</summary>
|
||||||
|
public uint StuckTicks;
|
||||||
|
|
||||||
|
/// <summary>While a <c>NetworkTick</c> newer than the current tick is stored here the enemy is phase-nudging
|
||||||
|
/// toward its target (collide-and-slide bypassed) to escape geometry; <c>0</c> = not nudging. Routed through
|
||||||
|
/// <c>TickUtil.NonZero</c> so a computed tick never collides with the 0 "inactive" sentinel.</summary>
|
||||||
|
public uint NudgeUntilTick;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5f3964cc62bbb0042b85e8a6a944dabe
|
||||||
@@ -28,15 +28,16 @@ Material:
|
|||||||
- _Brightness: 1.1
|
- _Brightness: 1.1
|
||||||
- _ColorLevels: 12
|
- _ColorLevels: 12
|
||||||
- _Contrast: 1.05
|
- _Contrast: 1.05
|
||||||
- _DepthEdgesEnabled: 1
|
- _DepthEdgesEnabled: 0
|
||||||
- _DepthThreshold: 0.08
|
- _DepthThreshold: 0.08
|
||||||
- _EdgeStrength: 1
|
- _EdgeStrength: 1
|
||||||
- _NormalEdgesEnabled: 1
|
- _MasterEnabled: 1
|
||||||
|
- _NormalEdgesEnabled: 0
|
||||||
- _NormalThreshold: 1
|
- _NormalThreshold: 1
|
||||||
- _OutlineThickness: 1
|
- _OutlineThickness: 1
|
||||||
- _PixelHeight: 200
|
- _PixelHeight: 200
|
||||||
- _PixelateEnabled: 1
|
- _PixelateEnabled: 0
|
||||||
- _PosterizeEnabled: 1
|
- _PosterizeEnabled: 0
|
||||||
- _Saturation: 1.35
|
- _Saturation: 1.35
|
||||||
m_Colors:
|
m_Colors:
|
||||||
- _OutlineColorInner: {r: 0, g: 0, b: 0, a: 1}
|
- _OutlineColorInner: {r: 0, g: 0, b: 0, a: 1}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ Shader "Hidden/ProjectM/PixelOutline"
|
|||||||
{
|
{
|
||||||
Properties
|
Properties
|
||||||
{
|
{
|
||||||
|
[ToggleUI] _MasterEnabled ("Master (whole effect)", Float) = 1
|
||||||
_PixelHeight ("Pixel Grid Height", Float) = 200
|
_PixelHeight ("Pixel Grid Height", Float) = 200
|
||||||
[ToggleUI] _PosterizeEnabled ("Posterize (banded color)", Float) = 1
|
[ToggleUI] _PosterizeEnabled ("Posterize (banded color)", Float) = 1
|
||||||
_ColorLevels ("Posterize Levels / channel", Range(2,64)) = 12
|
_ColorLevels ("Posterize Levels / channel", Range(2,64)) = 12
|
||||||
@@ -39,6 +40,7 @@ Shader "Hidden/ProjectM/PixelOutline"
|
|||||||
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
|
#include "Packages/com.unity.render-pipelines.core/Runtime/Utilities/Blit.hlsl"
|
||||||
|
|
||||||
CBUFFER_START(UnityPerMaterial)
|
CBUFFER_START(UnityPerMaterial)
|
||||||
|
float _MasterEnabled;
|
||||||
float _PixelHeight;
|
float _PixelHeight;
|
||||||
float _PosterizeEnabled;
|
float _PosterizeEnabled;
|
||||||
float _ColorLevels;
|
float _ColorLevels;
|
||||||
@@ -65,6 +67,10 @@ Shader "Hidden/ProjectM/PixelOutline"
|
|||||||
{
|
{
|
||||||
float2 uv = input.texcoord;
|
float2 uv = input.texcoord;
|
||||||
|
|
||||||
|
// Master bypass: return the untouched scene (dev on/off for the whole style).
|
||||||
|
if (_MasterEnabled < 0.5)
|
||||||
|
return half4(SAMPLE_TEXTURE2D_X(_BlitTexture, sampler_PointClamp, uv).rgb, 1.0);
|
||||||
|
|
||||||
// Fixed, square-pixel low-res grid derived from a target grid height.
|
// Fixed, square-pixel low-res grid derived from a target grid height.
|
||||||
float aspect = _ScreenParams.x / max(_ScreenParams.y, 1.0);
|
float aspect = _ScreenParams.x / max(_ScreenParams.y, 1.0);
|
||||||
float2 res = float2(max(_PixelHeight * aspect, 1.0), max(_PixelHeight, 1.0));
|
float2 res = float2(max(_PixelHeight * aspect, 1.0), max(_PixelHeight, 1.0));
|
||||||
|
|||||||
@@ -104,13 +104,16 @@ namespace ProjectM.Tests
|
|||||||
Assert.AreEqual(0f, slid.y, Eps);
|
Assert.AreEqual(0f, slid.y, Eps);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
public void SlideVelocity_DegenerateNormal_DeflectsToTangent()
|
||||||
public void SlideVelocity_DegenerateNormal_ReturnsInput()
|
|
||||||
{
|
{
|
||||||
|
// A degenerate (zero / near-vertical) normal has no defined slide plane. The mover must NOT keep driving
|
||||||
|
// straight into the wall (the enemy-stuck-on-cover-rock bug) -> it deflects to a horizontal tangent of the
|
||||||
|
// motion (a 90 deg turn about Y: (x,0,z) -> (-z,0,x)) so it glances AROUND the obstacle.
|
||||||
var v = new float3(2, 0, 3);
|
var v = new float3(2, 0, 3);
|
||||||
var slid = EnemyAIMath.SlideVelocity(v, float3.zero);
|
var slid = EnemyAIMath.SlideVelocity(v, float3.zero);
|
||||||
Assert.AreEqual(v.x, slid.x, Eps);
|
Assert.AreEqual(-v.z, slid.x, Eps);
|
||||||
Assert.AreEqual(v.z, slid.z, Eps);
|
Assert.AreEqual(v.x, slid.z, Eps);
|
||||||
|
Assert.AreEqual(0f, slid.y, Eps);
|
||||||
}
|
}
|
||||||
// ---- EB-1 fortress aggro: PickWeightedNearest ----
|
// ---- EB-1 fortress aggro: PickWeightedNearest ----
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ Long-form originals + the milestone each came from: `Docs/Vault/_Meta/CLAUDE_Bui
|
|||||||
- **A dark-lit screenshot MASKS material bugs — verify material *values*.** `shader.GetPropertyType(idx)`-guard before `GetColor`/`GetFloat`/`GetTexture` (`S_General`'s `_BaseColorMultiply` is a float → `GetColor` returns black). Gate emission on the `_Emissive` flag + a fixture name; keep converted env metallic low (0.1–0.2).
|
- **A dark-lit screenshot MASKS material bugs — verify material *values*.** `shader.GetPropertyType(idx)`-guard before `GetColor`/`GetFloat`/`GetTexture` (`S_General`'s `_BaseColorMultiply` is a float → `GetColor` returns black). Gate emission on the `_Emissive` flag + a fixture name; keep converted env metallic low (0.1–0.2).
|
||||||
- **VolumeProfile.Add persistence + the URP `m_AssetVersion` build blocker** → archive 2026-07-06 (+ native memory `urp-global-settings-version-blocks-build`).
|
- **VolumeProfile.Add persistence + the URP `m_AssetVersion` build blocker** → archive 2026-07-06 (+ native memory `urp-global-settings-version-blocks-build`).
|
||||||
- **`LocalTransform.FromPosition()` resets Scale=1** — server spawners read the prefab's baked `LocalTransform`, override only Position (Scale is a `[GhostField]` → consistent-but-wrong).
|
- **`LocalTransform.FromPosition()` resets Scale=1** — server spawners read the prefab's baked `LocalTransform`, override only Position (Scale is a `[GhostField]` → consistent-but-wrong).
|
||||||
- **Static decor → gameplay subscene** (EG renders only baked entities); **strip colliders from cosmetic props** + no `GhostAuthoring` on scenery (classic-URP cosmetic colliders are **inert to the DOTS PhysicsWorld**). **World collision = subscene-only ★:** `Environment`-layer boundary ring + landmark box colliders (player blocked via the default layer matrix); enemies slide via a server `CollisionWorld.SphereCast` in `EnemyAISystem` (filter=`WorldCollisionConfig.EnvironmentMask`). Boundary = a height-gated `SM_Env_Rock_Cliff` bowl rim. See [[2026-06-08_World_Collision_HUD_Scaling]].
|
- **Static decor → gameplay subscene** (EG renders only baked entities); **strip colliders from cosmetic props** + no `GhostAuthoring` on scenery (classic-URP colliders are inert to the DOTS PhysicsWorld). **World collision = subscene-only ★:** `Environment`-layer boundary ring + landmark colliders (player blocked via the layer matrix); enemies slide via a server `CollisionWorld.SphereCast` in `EnemyAISystem`. **★ enemy slide has NO pathfinding — a near-vertical wall normal or an embedded spawn FROZE Husks on cover rocks (soft-locks a room on one leftover); fixed 07-07 via `EnemyMoveUtil.Depenetrate` + tangent-slide + an `EnemyNavState` nudge backstop. Re-validate movers aren't frozen when adding Environment cover.** Boundary = `SM_Env_Rock_Cliff` rim. See [[2026-06-08_World_Collision_HUD_Scaling]].
|
||||||
- **A GA "projectile" prefab self-propels** — strip to particles before `Start` (`CombatFeedbackSystem.StripCosmetic`); verify *components*, not the name.
|
- **A GA "projectile" prefab self-propels** — strip to particles before `Start` (`CombatFeedbackSystem.StripCosmetic`); verify *components*, not the name.
|
||||||
|
|
||||||
### Aim controls
|
### Aim controls
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
---
|
||||||
|
title: 2026-07-07_Expedition_Enemy_Stuck_Harvest_Feedback
|
||||||
|
type: note
|
||||||
|
permalink: gamevault/07-sessions/2026/2026-07-07-expedition-enemy-stuck-harvest-feedback
|
||||||
|
---
|
||||||
|
|
||||||
|
# 2026-07-07 — Expedition: enemy-stuck fix + visibility markers + harvest feedback
|
||||||
|
|
||||||
|
**Driver:** `/dots-dev` (Small track — no ghost/RPC/relevancy/ordering change; server-only movement + client-only presentation). Two operator-reported expedition problems.
|
||||||
|
|
||||||
|
## Problems → root causes (ground truth)
|
||||||
|
|
||||||
|
1. **Enemies get stuck on cover collisions + are hard to see → a leftover enemy soft-locks the room.** Three linked causes:
|
||||||
|
- **Movement:** `EnemyMoveUtil.SweptMove` (server-only collide-and-slide, the sole enemy mover) had (a) **no depenetration** — an enemy spawned inside / shoved into a collider gets `SphereCast` fraction ≈0 → `stop = from` → frozen forever; (b) `EnemyAIMath.SlideVelocity` flattened the wall normal to XZ, so a rounded/short Synty **cover rock** (near-vertical normal) collapsed to ~0 → returned motion *straight into the wall* → net-zero; (c) only **one** slide iteration → concave rock∧boundary-rim pockets trap. The Phase-1 in-room cover rocks (4/room, Environment-layer) were the fresh geometry exposing all three. No pathfinding exists (straight-line seek + reactive slide).
|
||||||
|
- **Soft-lock:** `RoomEnemyDirectorSystem` gates clear on `aliveZone == 0` with **no timeout/fallback** — one stuck *living* Husk blocks the room forever (the `Dying` corpse-exclusion doesn't help a living one).
|
||||||
|
- **Visibility:** enemies are small, Synty-atlas lit (no rim), Swarmer desaturated green; **no persistent marker / off-screen indicator** existed.
|
||||||
|
2. **Harvest nodes lacked obvious hit feedback.** `WorldFeedbackSystem` already chipped particles+SFX on a replicated `Remaining` decrease, but subtly; no node body reaction.
|
||||||
|
|
||||||
|
## Fixes shipped
|
||||||
|
|
||||||
|
**Enemy movement (server-only, no wire change):**
|
||||||
|
- `EnemyAIMath.SlideVelocity` — degenerate (near-vertical/zero) XZ normal now deflects to a horizontal **tangent** (`(x,0,z)→(-z,0,x)`) instead of driving into the wall. Unit test updated (`SlideVelocity_DegenerateNormal_DeflectsToTangent`).
|
||||||
|
- `EnemyMoveUtil` — added a stateless **`Depenetrate`** (`CollisionWorld.CalculateDistance(PointDistanceInput,…)` → push out along `SurfaceNormal` by `radius−Distance`, capped at 1 radius/tick, floor/ceiling normals ignored) + **2 slide iterations** in `SweptMove`.
|
||||||
|
- `EnemyAISystem` — a **depenetration pre-pass** (every living enemy, top of `OnUpdate`; boss excluded) + a **stuck-nudge backstop pass** (after separation): an enemy that wants to close but gains no ground toward its target for `StuckUnstickTicks (90 ≈ 1.5s)` phase-nudges toward the nearest target (sweep bypassed) for a `NudgeBurstTicks (45)` burst — guarantees a room always resolves. Progress measured as **distance CLOSED toward target** (not raw displacement) so the separation jiggle can't mask a stuck Husk. Backstop consts inline (not on the RPC'd `TuningConfig` — server-only, avoids the IRpcCommand-hash blast-radius). New server-only component **`EnemyNavState`** (`LastPos`/`StuckTicks`/`NudgeUntilTick`, **not** a `[GhostField]`), baked by `EnemyAuthoring`. Spitters (hold at range) + boss excluded.
|
||||||
|
|
||||||
|
**Enemy visibility (client-only, new):** `EnemyMarkerSystem` — own runtime UIDocument (sortingOrder 48), pooled markers: off-screen enemies get a clamped edge **arrow** (reuses `OnboardingSystem`'s WorldToScreen edge-intersection math), on-screen get a subtle overhead **pip** that fades toward `EnemyMarkerMinAlpha` as the on-screen count rises. Range-gated to the local player (`EnemyMarkerRange 140`), boss + corpses excluded. Knobs in `FeelConfig`.
|
||||||
|
|
||||||
|
**Harvest feedback (client-only):**
|
||||||
|
- `NodeFeedbackSystem` (new) — on a `ResourceNode`/`BlightClutter` `Remaining` decrease, drives a **client-owned `PostTransformMatrix`** on the node root: progressive **shrink** toward `NodeMinScale` as it depletes + a brief **scale-pop** per hit. Chose a scale reaction over a `_BaseColor` flash because node materials (unlike white-based enemy/player bodies) aren't guaranteed white, so a base-color override could clobber their rest tint.
|
||||||
|
- `WorldFeedbackSystem` — beefed chip burst (6→12) + SFX (0.30→0.42) + a proximity-gated per-hit **camera micro-punch**.
|
||||||
|
- Knobs in `WorldFeelConfig`.
|
||||||
|
|
||||||
|
## Validation
|
||||||
|
- **L1** console clean (0 errors) throughout — including while the freshly-edited **Bursted** `EnemyAISystem` processed 5 real enemies with the new passes (no stale-Burst-binary `InvalidOperationException`, no exceptions).
|
||||||
|
- **L2** EditMode **455/455** (incl. the updated `SlideVelocity` tangent test).
|
||||||
|
- **L3 / Play smoke:** drove a run into an expedition COMBAT room (server-side ready). Enemies spawned on the ring (~14u) and **advanced across the rock-filled room to the player** (dist → 1.4, attacking) — repeatedly; not stuck. **Enemy markers visually confirmed** (`scratchpad/markers_03.png`: amber ▾ pips above every Husk, incl. a distant one by the top-right rocks). server==client enemy positions matched. Both new client systems + `WorldFeedbackSystem` ran against real enemies/nodes with zero errors.
|
||||||
|
|
||||||
|
### Validation gotcha (recorded)
|
||||||
|
Driving an AFK run headless is flaky: the buffed player's `Health` is **reset to the class value (~130) on (re)spawn**, so a `SetComponentData(Health=100000)` buff does NOT persist → the AFK player dies to the swarm in ~15s and the run aborts (`expeditionPlayers==0 → Returning`), despawning the room. Also **post-abort re-launch is gated** (a clean Play restart from Staging launches reliably on the first ready; re-readying after an abort is intermittent). To screenshot mid-fight, **capture in the SAME `execute_code` call that first detects `enemies>0`** (round-trip > survival window).
|
||||||
|
|
||||||
|
## Not freeze-framed (operator eyeball on next playtest — trivial with real input)
|
||||||
|
- **Node shrink/pop VISUAL** — `NodeFeedbackSystem` ran clean against the 2 nodes but the run-timing never let me catch the shrink on-screen. **One risk to confirm:** the shrink uses `PostTransformMatrix` on the node **root** — this scales the mesh only if the mesh is on the root or on *parented* children. If a node's mesh is an unparented render child, scale the children instead (cheap fix).
|
||||||
|
|
||||||
|
## Next-session intent
|
||||||
|
Operator playtests the expedition: confirm (1) no stuck stragglers across a few rooms, (2) markers read well / not cluttered, (3) node shrink+pop visible on harvest, (4) tune knobs (`FeelConfig.EnemyMarker*`, `WorldFeelConfig.Node*`/`Chip*`, backstop consts in `EnemyAISystem`). Then bank as a DR if the design sticks.
|
||||||
|
|
||||||
|
Related: [[DR-023_Enemy_Animation_MonsterMash]] · [[DR-044_Expedition_Redesign_Shipped_Demo_Polish]] · [[DR-045_Combat_Demo_Feel_Boss_Fight]]
|
||||||
Reference in New Issue
Block a user