Perception 2.0 adds scalable vision/hearing, spatial queries, sensing priorities, 3D support, debug tools, and smoother integration with Swarm Core and Decision.Swarm Perception is a modular perception system built for large crowds, swarms, stealth games, RTS units, and simulation agents. Instead of relying on expensive per-agent physics overlap checks, it uses a spatial hash to find nearby candidates efficiently, then applies configurable sensors such as vision cones, optional 3D vision, line-of-sight checks, and directional hearing driven by noise events.Agents build awareness over time through memory, suspicion accumulation, suspicion decay, and configurable forget delays. Built-in target selection policies let agents choose a primary target by closest distance, highest suspicion, most recent stimulus, highest threat, or weighted scoring. Agents can also output investigate points, share awareness with allies through perception groups, and stamp alerts into an influence/alert field for coordination, stealth, and tactical gameplay.Version 2.0 improves scalability and vertical-world support. Perception can now better handle agents and targets above or below each other using 3D spatial queries, 3D vision options, and directional hearing controls. Sensing workloads can be budgeted and staggered across agents, with priority levels for high, normal, and low importance agents.The package is designed for production use, with throttled LOS checks, camera-distance LOD tiers, proximity throttling, target update intervals, sensing budgets, and non-alloc query paths. Debugging is built in, with gizmo overlays for sensors, memory, detection state, and stimulus visualization.A demo scene and setup tools are included. The event system supports both typed callbacks and UnityEvents for quick no-code integration. Advanced users can plug in custom spatial providers, making it possible to replace or extend the backend without rewriting gameplay logic.Spatial QueriesSpatial-hash candidate lookup for scalable target searchesXZ and 3D spatial query supportNon-alloc query paths for large crowdsPluggable spatial provider interface for custom backends or future ECS/DOTS-style integrationsVisionConfigurable vision sensor with range, FOV, and layer maskOptional vertical FOV for 3D spacesOptional line-of-sight raycastsLOS throttling and update intervals to control costSupport for multiple sensors per agent, such as front/rear or mixed sensor setupsHearingDirectional hearing driven by noise eventsConfigurable range, angle, and falloffNoise event lifetime supportRing buffer capacity for noise event storageMemory & AwarenessLast seen and last heard trackingSuspicion accumulation and decayConfigurable forget delayInvestigate point output from best stimulus or last known positionGroup perception sharing for squad awarenessTarget SelectionClosest targetHighest suspicionMost recent stimulusHighest threatWeighted selection policyFilteringTeam and affiliation filteringAlly, enemy, neutral, and unknown handlingLayer-mask filtering for sensor queriesAlert / InfluenceAlert and influence field stamping supportUseful for stealth, squad coordination, and tactical AIEventsPer-agent perception eventsGlobal perception eventsTyped C# callbacksUnityEvents for no-code hookupsDebuggingSensor gizmosTarget gizmosNoise gizmosMemory and awareness gizmosClick-to-select minimap visualizationSight shown in blue and sound shown in greenPerformance ToolsCamera-distance LOD tiersProximity throttlingSensing budget controlsTarget update intervalsStaggered sensing updates by priorityTunable sensing priority levels: high, normal, and lowDemoDemo scene includedSetup helpers includedExample agents showing sensing, memory, target selection, and investigation behavior.AI tools were used to assist with code structure, documentation drafting, and implementation review. Final design decisions, testing, tuning, and asset integration were manually reviewed and refined.




