# hrober0/crowdsimulation architecture

> Architecture diagram of the GitHub repository hrober0/crowdsimulation, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-14). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hrober0/crowdsimulation
- Repository: https://github.com/hrober0/crowdsimulation

## Overview

This Unity project provides Burst-oriented crowd navigation: users issue movement orders, agents request paths through a mutable NavMesh, and the crowd simulation combines navigation with collision avoidance. The README documents NavMesh graph construction, A* pathfinding, seeker-based costs, obstacle updates, and RVO2-style avoidance. The tree supports locating those subsystems, but no source excerpts were provided, so internal call ownership and finer runtime links cannot be verified.

Main entry points: [`Assets/Navigation/PathFinding.cs`](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/PathFinding.cs) (A* Pathfinding), [`Assets/Avoidance/Jobs/UpdateAgentsVelocitiesJob.cs`](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Avoidance/Jobs/UpdateAgentsVelocitiesJob.cs) (RVO Avoidance), [`Assets/Examples/ComplexNavigation/Agents/Systems/AgentMovementSystem.cs`](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/Agents/Systems/AgentMovementSystem.cs) (Agent Movement), [`Assets/Navigation/Jobs/NavMeshUpdateJob.cs`](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/Jobs/NavMeshUpdateJob.cs) (Local NavMesh Update)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["Navigation"]
  node_pathfinding["A* Pathfinding<br/>[PathFinding.cs]"]
  node_navmesh[("NavMesh Graph<br/>[NavMesh.cs]")]
  node_navmesh_update["Local NavMesh Update"]
  node_obstacles["Nav Obstacles<br/>[NavObstacles.cs]"]
  node_attributes["Node Attributes<br/>[INodeAttributes.cs]"]
  node_seekers["Path Seekers<br/>[IPathSeeker.cs]"]
  node_path_movement["Path Movement<br/>[PathMovement.cs]"]
end

subgraph group_avoidance["Avoidance"]
  node_avoidance_calculation["Velocity Calculation"]
  node_avoidance_engine["RVO Avoidance"]
  node_agent_lookup["Agent Lookup"]
  node_obstacle_lookup["Obstacle Lookup"]
end

subgraph group_simulation["Crowd Simulation"]
  node_path_requests["Path Requests"]
  node_agent_movement["Agent Movement"]
  node_spatial_hash["Agent Spatial Hash"]
  node_position_update["Position Update"]
end

subgraph group_inputs["User Input"]
  node_orders["Agent Orders"]
end

node_user(("User"))

node_user -->|"issues orders"| node_orders
node_orders -.->|"sets targets"| node_path_requests
node_path_requests -.->|"requests paths"| node_pathfinding
node_pathfinding -->|"searches graph"| node_navmesh
node_navmesh_update -->|"updates locally"| node_navmesh
node_obstacles -->|"provides shapes"| node_navmesh_update
node_attributes -->|"informs cost"| node_seekers
node_seekers -->|"evaluates paths"| node_pathfinding
node_pathfinding -.->|"returns paths"| node_path_movement
node_path_movement -.->|"guides movement"| node_agent_movement
node_agent_movement -.->|"updates positions"| node_position_update
node_spatial_hash -.->|"supports queries"| node_avoidance_calculation
node_avoidance_calculation -.->|"calculates velocities"| node_avoidance_engine
node_agent_lookup -.->|"provides agents"| node_avoidance_engine
node_obstacle_lookup -.->|"provides obstacles"| node_avoidance_engine
node_avoidance_engine -.->|"steers agents"| node_position_update
node_pathfinding -->|"integrates navigation"| node_agent_movement
node_avoidance_engine -->|"integrates avoidance"| node_agent_movement

click node_orders "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/PlayerInput/AgentTargetManager.cs"
click node_path_requests "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/Agents/Systems/AgentPathRequestSystem.cs"
click node_pathfinding "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/PathFinding.cs"
click node_navmesh "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/NavMesh.cs"
click node_navmesh_update "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/Jobs/NavMeshUpdateJob.cs"
click node_obstacles "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/NavObstacles.cs"
click node_attributes "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/INodeAttributes.cs"
click node_seekers "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/IPathSeeker.cs"
click node_path_movement "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/PathMovement.cs"
click node_agent_movement "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/Agents/Systems/AgentMovementSystem.cs"
click node_spatial_hash "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/Agents/Systems/AgentSpatialHashSystem.cs"
click node_avoidance_calculation "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/Avoidance/Systems/AgentVelocityCalculationSystem.cs"
click node_avoidance_engine "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Avoidance/Jobs/UpdateAgentsVelocitiesJob.cs"
click node_agent_lookup "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Avoidance/Jobs/BuildAgentLookupJob.cs"
click node_obstacle_lookup "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Avoidance/Jobs/BuildObstacleVerticesLookupJob.cs"
click node_position_update "https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/Agents/Systems/AgentPositionUpdateSystem.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_pathfinding,node_navmesh,node_navmesh_update,node_obstacles,node_attributes,node_seekers,node_path_movement,node_user toneBlue
class node_avoidance_calculation,node_avoidance_engine,node_agent_lookup,node_obstacle_lookup toneAmber
class node_path_requests,node_agent_movement,node_spatial_hash,node_position_update toneMint
class node_orders toneRose
```

## Components

### Navigation

- [A* Pathfinding](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/PathFinding.cs): `Assets/Navigation/PathFinding.cs`
- [NavMesh Graph](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/NavMesh.cs): `Assets/Navigation/NavMesh.cs`
- [Local NavMesh Update](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/Jobs/NavMeshUpdateJob.cs): `Assets/Navigation/Jobs/NavMeshUpdateJob.cs`
- [Nav Obstacles](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/NavObstacles.cs): `Assets/Navigation/NavObstacles.cs`
- [Node Attributes](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/INodeAttributes.cs): `Assets/Navigation/INodeAttributes.cs`
- [Path Seekers](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/IPathSeeker.cs): `Assets/Navigation/IPathSeeker.cs`
- [Path Movement](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Navigation/PathMovement.cs): `Assets/Navigation/PathMovement.cs`

### Avoidance

- [Velocity Calculation](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/Avoidance/Systems/AgentVelocityCalculationSystem.cs): `Assets/Examples/ComplexNavigation/Avoidance/Systems/AgentVelocityCalculationSystem.cs`
- [RVO Avoidance](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Avoidance/Jobs/UpdateAgentsVelocitiesJob.cs): `Assets/Avoidance/Jobs/UpdateAgentsVelocitiesJob.cs`
- [Agent Lookup](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Avoidance/Jobs/BuildAgentLookupJob.cs): `Assets/Avoidance/Jobs/BuildAgentLookupJob.cs`
- [Obstacle Lookup](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Avoidance/Jobs/BuildObstacleVerticesLookupJob.cs): `Assets/Avoidance/Jobs/BuildObstacleVerticesLookupJob.cs`

### Crowd Simulation

- [Path Requests](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/Agents/Systems/AgentPathRequestSystem.cs): `Assets/Examples/ComplexNavigation/Agents/Systems/AgentPathRequestSystem.cs`
- [Agent Movement](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/Agents/Systems/AgentMovementSystem.cs): `Assets/Examples/ComplexNavigation/Agents/Systems/AgentMovementSystem.cs`
- [Agent Spatial Hash](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/Agents/Systems/AgentSpatialHashSystem.cs): `Assets/Examples/ComplexNavigation/Agents/Systems/AgentSpatialHashSystem.cs`
- [Position Update](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/Agents/Systems/AgentPositionUpdateSystem.cs): `Assets/Examples/ComplexNavigation/Agents/Systems/AgentPositionUpdateSystem.cs`

### User Input

- [Agent Orders](https://github.com/hrober0/crowdsimulation/blob/main/Assets/Examples/ComplexNavigation/PlayerInput/AgentTargetManager.cs): `Assets/Examples/ComplexNavigation/PlayerInput/AgentTargetManager.cs`

### Other components

- **User**

## Connections

- User → Agent Orders: issues orders (evidence: `README.md`)
- Agent Orders → Path Requests: sets targets
- Path Requests → A* Pathfinding: requests paths
- A* Pathfinding → NavMesh Graph: searches graph (evidence: `README.md`)
- Local NavMesh Update → NavMesh Graph: updates locally (evidence: `README.md`)
- Nav Obstacles → Local NavMesh Update: provides shapes (evidence: `README.md`)
- Node Attributes → Path Seekers: informs cost (evidence: `README.md`)
- Path Seekers → A* Pathfinding: evaluates paths (evidence: `README.md`)
- A* Pathfinding → Path Movement: returns paths
- Path Movement → Agent Movement: guides movement
- Agent Movement → Position Update: updates positions
- Agent Spatial Hash → Velocity Calculation: supports queries
- Velocity Calculation → RVO Avoidance: calculates velocities
- Agent Lookup → RVO Avoidance: provides agents
- Obstacle Lookup → RVO Avoidance: provides obstacles
- RVO Avoidance → Position Update: steers agents
- A* Pathfinding → Agent Movement: integrates navigation (evidence: `README.md`)
- RVO Avoidance → Agent Movement: integrates avoidance (evidence: `README.md`)
