Vixen
c7401864
csharp
public readonly record struct StimulusEvent

Something that happened, which some senses are the only way of noticing.

Read the guide page for this →

Remarks

⚠ Hearing and damage are events, and sight and touch are states, and that difference is why both machines exist. An entity is continuously visible, so sight is sampled: it can be asked at any moment and the answer is a property of the world right now. A gunshot is not continuously audible — an entity is not "audible", an event is — so a hearing sense that sampled would have to sample the exact frame the shot happened, which at 4 Hz means hearing one shot in six.

So events are kept for EventMemory seconds and each listener consumes the ones newer than its own last pass. A listener at 4 Hz hears every shot; it just hears them up to a quarter of a second late, which is the reaction time it was configured for.

Fields and properties (7)

  • public AiSense Sense

    Which sense it reaches.

  • public Entity Source

    Who caused it.

  • public Entity Target

    Who it happened to, or Null for anyone in range.

  • public Vector3 Position

    Where it happened.

  • public float Strength

    How loud, or how much damage.

  • public float Stamp

    The clock reading when it was reported.

  • public long Sequence

    Where it came in the order of reports. ⚠ What a listener consumes against, and the clock is not. The clock only advances inside a step, so an event reported after a pass in the same frame carries exactly the clock that pass recorded — and a listener comparing clocks would decide it had already heard a gunshot that had not happened yet.

Methods (1)

  • public StimulusEvent(AiSense Sense, Entity Source, Entity Target, Vector3 Position, float Strength, float Stamp, long Sequence)

    Something that happened, which some senses are the only way of noticing.

Used by (1)

  • PerceptionSystemVixen.Ai.Perception