Class AILodSettings
Distance thresholds and per-tier update intervals for AI level-of-detail. Assign to LodSettings.
[CreateAssetMenu(fileName = "New AI LOD Settings", menuName = "FishMMO/Character/NPC/AI/LOD Settings")]
public class AILodSettings : ScriptableObject
- Inheritance
-
ObjectScriptableObjectAILodSettings
- Inherited Members
-
ScriptableObject.SetDirty()ScriptableObject.CreateInstance<T>()Object.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
Intervals are counted in AI ticks, not frames. The AI runs on the FishNet
TimeManager at a fixed rate derived from AiTickRate, so an
interval of 3 means "one update every 3 AI ticks" and converts to a wall-clock rate that
does not move when the server's frame rate does.
This replaced a frame-count modulus. Under that scheme the real AI rate was whatever the server's frame rate happened to be divided by the modulus — so a loaded server did not just render less often, its NPCs also thought, leashed, swept and decayed threat more slowly, exactly when the load that caused it needed them to behave predictably. Tuning was equally hopeless, because "modulus 12" meant a different number of updates per second on every machine.
At the default 8 Hz AI tick, intervals of 1 / 3 / 10 / 40 give roughly 8 Hz, 2.7 Hz, 0.8 Hz and 0.2 Hz.
Fields
ActiveDistanceSqr
[Header("Distance Thresholds")]
[Tooltip("Squared distance for Active tier (e.g., 40² = 1600). NPCs within this range get full updates.")]
public float ActiveDistanceSqr
Field Value
ActiveTickInterval
[Header("Update Interval (in AI ticks)")]
[Tooltip("Active tier: AI ticks between updates. 1 = every AI tick. Full pipeline.")]
[Min(1)]
public int ActiveTickInterval
Field Value
DormantTickInterval
[Tooltip("Dormant tier: AI ticks between wake-up checks. No AI runs at all in between.")]
[Min(1)]
public int DormantTickInterval
Field Value
FarDistanceSqr
[Tooltip("Squared distance for Far tier (e.g., 300² = 90000). Beyond this, NPC is Dormant.")]
public float FarDistanceSqr
Field Value
FarTickInterval
[Tooltip("Far tier: AI ticks between updates. Minimal AI (wander/idle only, no combat).")]
[Min(1)]
public int FarTickInterval
Field Value
NearbyDistanceSqr
[Tooltip("Squared distance for Nearby tier (e.g., 100² = 10000).")]
public float NearbyDistanceSqr
Field Value
NearbyTickInterval
[Tooltip("Nearby tier: AI ticks between updates. Simplified AI (no behavior tree, no boss script, no sweep).")]
[Min(1)]
public int NearbyTickInterval
Field Value
ReevaluateInterval
[Header("Re-evaluation")]
[Tooltip("Seconds between LOD tier re-evaluation. Lower = more responsive but more expensive.")]
public float ReevaluateInterval
Field Value
Methods
GetTickInterval(AILodTier)
Returns how many AI ticks pass between updates at the given tier.
public int GetTickInterval(AILodTier tier)
Parameters
tierAILodTierThe tier to query.
Returns
- int
The interval in AI ticks, never below 1.
GetTier(float)
Determines the LOD tier from a squared distance to the nearest observer.
public AILodTier GetTier(float sqrDistance)
Parameters
sqrDistancefloatSquared distance to the nearest player.
Returns
- AILodTier
The tier that distance falls into.
GetTierHertz(AILodTier, float)
Converts a tier's interval into the wall-clock rate it produces at a given AI tick rate.
public float GetTierHertz(AILodTier tier, float aiTickRate)
Parameters
Returns
- float
Updates per second at that tier.
Remarks
Editor and diagnostics only — it exists so a designer can see what a given interval actually means in hertz rather than having to work it out.