Table of Contents

Class AIArchetypeTemplate

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

A complete, reusable AI brain in one asset: which states an NPC uses, how it picks abilities, how it behaves in combat, how it accrues threat, and how it is throttled at distance.

[CreateAssetMenu(fileName = "New AI Archetype", menuName = "FishMMO/Character/NPC/AI/Archetype", order = -10)]
public class AIArchetypeTemplate : ScriptableObject
Inheritance
Object
ScriptableObject
AIArchetypeTemplate
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.name
Object.hideFlags

Remarks

This is the only AI wiring an NPC prefab carries. Assign one to Archetype and the controller reads every state and tuning value straight from it. Wiring an NPC previously meant dragging eight state assets plus a personality, a rotation and a LOD asset onto every prefab by hand, and getting one of them wrong — a null attacking state, a retreat state on an archetype that never retreats — produced an NPC that silently did nothing.

There is deliberately no per-prefab override of individual slots. Many NPCs share one brain, and an override layer meant the personality lived in two places and a prefab could quietly disagree with the archetype it named. A creature that needs one slot different gets its own archetype. Validate(List<string>) reports combinations that cannot work.

Fields

AbilityRotation

[Tooltip("Optional condition-driven ability rotation.")]
public AIAbilityRotation AbilityRotation

Field Value

AIAbilityRotation

AggressionDamageWeight

[Header("Threat")]
[Tooltip("Threat per 1 point of damage taken.")]
public float AggressionDamageWeight

Field Value

float

AggressionDecayRate

[Tooltip("Threat lost per second while no new events arrive.")]
public float AggressionDecayRate

Field Value

float

AggressionHealingWeight

[Tooltip("Threat per 1 point of healing witnessed on a combat participant.")]
public float AggressionHealingWeight

Field Value

float

AggressionHitBonus

[Tooltip("Flat threat added per hit, regardless of damage.")]
public float AggressionHitBonus

Field Value

float

AggressionStaleTimeout

[Tooltip("Seconds before a drained threat entry is forgotten.")]
public float AggressionStaleTimeout

Field Value

float

AggressionVarietyChance

[Range(0, 1)]
[Tooltip("Chance target selection picks the second-highest threat instead of the highest.")]
public float AggressionVarietyChance

Field Value

float

AttackingState

[Tooltip("Combat state. Required for the NPC to be able to fight at all.")]
public BaseAIState AttackingState

Field Value

BaseAIState

AvoidancePriority

[Tooltip("NavMeshAgent avoidance priority.")]
public AgentAvoidancePriority AvoidancePriority

Field Value

AgentAvoidancePriority

BehaviorTree

[Tooltip("Optional high-level behavior tree evaluated above the state machine.")]
public AIBehaviorTree BehaviorTree

Field Value

AIBehaviorTree

DeadState

[Tooltip("Optional state entered on death.")]
public BaseAIState DeadState

Field Value

BaseAIState

Description

[Header("Identity")]
[Tooltip("Human-readable description of this archetype. Editor only.")]
[TextArea(2, 5)]
public string Description

Field Value

string

EnemySweepRate

[Tooltip("How often (seconds) the NPC sweeps for nearby enemies while out of combat.")]
public float EnemySweepRate

Field Value

float

IdleState

[Tooltip("Passive standing-around state.")]
public BaseAIState IdleState

Field Value

BaseAIState

InitialState

[Header("Core States")]
[Tooltip("State the NPC starts in when it spawns.")]
public BaseAIState InitialState

Field Value

BaseAIState

LodSettings

[Header("Performance")]
[Tooltip("Optional distance-based update throttling.")]
public AILodSettings LodSettings

Field Value

AILodSettings

PatrolState

[Tooltip("Waypoint movement. Requires waypoints on the spawner.")]
public BaseAIState PatrolState

Field Value

BaseAIState

Personality

[Header("Combat Tuning")]
[Tooltip("Combat personality: ability preferences, flee threshold, targeting mode.")]
public AICombatPersonality Personality

Field Value

AICombatPersonality

RetreatState

[Tooltip("Flee state. Required for a personality with a retreat threshold to actually flee.")]
public BaseAIState RetreatState

Field Value

BaseAIState

ReturnHomeState

[Tooltip("Leash return. Required for leashing to work.")]
public BaseAIState ReturnHomeState

Field Value

BaseAIState

WanderState

[Header("Movement States")]
[Tooltip("Random movement around the home position.")]
public BaseAIState WanderState

Field Value

BaseAIState

Methods

Validate(List<string>)

Checks this archetype for combinations that cannot behave as configured.

public bool Validate(List<string> problems)

Parameters

problems List<string>

Receives one line per problem found. Cleared first.

Returns

bool

True when the archetype is internally consistent.

Remarks

Exists so the shipped archetype assets can be asserted in an EditMode test rather than discovered to be broken in play. Every problem returned is one that produces an NPC which compiles, spawns, and then quietly misbehaves.