载入中...
搜索中...
未找到
eve::crowd::Crowd类 参考

群体行为模块:连续流场寻路 + 海量单位移动/转向/行动 + Boids 鸟群。 更多...

#include <Crowd.h>

类 eve::crowd::Crowd 继承关系图:
eve::Module

类

class  AgentUpdatePlan
 Move-only owning preparation token; contains values and owner identity, never a Crowd pointer. @ownership Holds immutable flow leases when present; provider-first destruction is safe. @lifetime Single successful commit; restore or stale references reject atomically. @thread Owner thread only. @reentrancy No callbacks. Not persistent or cross-process data. 更多...
 
class  FlowBuildPlan
 Move-only navigation workstate; contains no borrowed provider pointers. 更多...
 
struct  FlowBuildProgress
 Deterministic work consumed by a navigation advancement. 更多...
 
struct  Impl
 
struct  NavigationRequests
 Private crowd runtime storage. @cost Linear in agent count for SOA vectors and transient broadphase/avoidance work buffers; capacity is bounded by maxAgents. 更多...
 
class  RestorePlan
 Prepared restore workspace; owns allocations until commit or destruction. 更多...
 
class  Snapshot
 Immutable in-process checkpoint; not a persistent or cross-process format. 更多...
 
class  SurfacePlan
 Move-only prepared terrain/navigation publication. 更多...
 

Public 类型

enum class  FlowBuildState {
  Ready , Cancelled , Committed , Pending ,
  Failed , Unreachable
}
 Lifecycle of an owning prepared navigation publication. 更多...
 

Public 成员函数

Result< SurfacePlan > prepareNavigationSurface (const NavigationSurfaceSnapshot &snapshot) const
 Validate and copy an immutable surface projection without publishing it.
 
Result< void > commitNavigationSurface (SurfacePlan &&plan)
 Publish terrain and navigation projection together without allocation.
 
Result< FlowBuildPlan > prepareFlowBuild (int gx, int gy) const
 Prepare owned navigation workstate for one goal without changing the live field.
 
Result< FlowBuildPlan > prepareFlowBuild (std::span< const FlowGoal > goals) const
 Prepare one shared field for a canonical, nonempty set of at most 1024 destinations.
 
Result< FlowBuildProgress > advanceFlowBuild (FlowBuildPlan &plan, int maxWork)
 Spend at most maxWork heap-pop/direction-cell units on owned request state.
 
Result< void > commitFlowBuild (FlowBuildPlan &&plan)
 Publish a prepared field without allocation; reject stale, foreign or cancelled plans.
 
Result< FlowLease > acquireFlowField (std::span< const FlowGoal > goals)
 Acquire an existing field for a canonical goal set without graph work.
 
Result< FlowLease > acquireFlowField (FlowBuildPlan &&plan)
 Publish a completed build into shared cache without selecting the default field.
 
Result< void > configureFlowCache (std::uint64_t budgetBytes)
 Set retained-storage budget, evicting only unleased fields with atomic pressure failure.
 
FlowCacheObservation getFlowCacheStatus () const noexcept
 Read retained-storage accounting without copying fields; owner thread only.
 
Result< FlowSample > sampleFlowField (const FlowLease &lease, float x, float y) const
 Sample a current lease; stale/foreign leases fail, unreachable locations return zero. @ownership Borrows lease during call only. @thread Owner thread. @reentrancy No callbacks.
 
Result< Snapshot > captureSnapshot () const
 Copy authoritative runtime state and clock into an owning checkpoint.
 
Result< RestorePlan > prepareRestore (const Snapshot &snapshot) const
 Allocate complete restored state and fresh handle ownership before publication.
 
Result< void > commitRestore (RestorePlan &&plan)
 Publish a prepared restore without allocation; consumes plan on success.
 
 Module_REG (Crowd)
 
 Crowd ()
 Crowd.
 
 ~Crowd () override
 Crowd.
 
Result< void > setWorkScheduler (CrowdExecution execution, std::shared_ptr< CrowdWorkScheduler > scheduler)
 Select serial execution or inject a shared synchronous scheduler lease.
 
LifetimeWitness lifetimeWitness () const noexcept
 Return a non-owning witness for this provider instance, independent of restored agent state.
 
void resizeField (int width, int height, float cellSize, float originX, float originY)
 配置流场网格(世界单位/格)。
 
void setBlocked (int cx, int cy, bool blocked)
 设置/清除某格阻挡。
 
void setCellCost (int cx, int cy, float cost)
 设置地形代价(0=阻挡,>=1 可走)。
 
float getCellCost (int cx, int cy) const
 查询地形代价。
 
void buildFlowField (int gx, int gy)
 Compatibility-only synchronous single-goal build through prepareFlowBuild/commitFlowBuild.
 
FieldObservation getFieldStatus () const noexcept
 Observe current field readiness and owner-local revision without rebuilding.
 
void addFlowGoal (int gx, int gy)
 追加目标格(多目标)。
 
void clearFlowGoals ()
 清空目标列表。
 
void build ()
 执行 Dijkstra 建场。
 
bool isFieldBuilt () const
 是否已建场。
 
bool isReachable (int cx, int cy) const
 某格是否可达。
 
int getFieldWidth () const
 网格信息访问器(调试渲染用)。
 
int getFieldHeight () const
 Returns the field height.
 
float getCellSize () const
 Returns the cell size.
 
float getFieldOriginX () const
 Returns the field origin x.
 
float getFieldOriginY () const
 Returns the field origin y.
 
FlowVec flowAtWorld (float wx, float wy) const
 世界坐标流场方向(双线性插值;场外返回零向量)。
 
float costAtWorld (float wx, float wy) const
 世界坐标积分代价(场外返回 kUnreachable)。
 
FlowVec flowAtCell (int cx, int cy) const
 格级流场方向。
 
int addAgent (float x, float y, float heading, float radius)
 添加单位;返回 id(=槽位索引;删除后 id 不稳定)。
 
int addNamedAgent (const std::string &stableId, float x, float y, float heading, float radius)
 Add an agent with an editor/game-stable logical identifier.
 
bool hasNamedAgent (const std::string &stableId) const
 Return whether a stable logical agent exists.
 
int getNamedAgentIndex (const std::string &stableId) const
 Resolve a stable logical identifier to the current compact slot.
 
std::string getAgentStableId (int index) const
 Return the stable logical identifier for a compact slot.
 
bool removeNamedAgent (const std::string &stableId)
 Remove an agent by stable logical identifier.
 
bool removeAgent (int id)
 删除单位(swap-pop O(1))。
 
void clearAgents ()
 清空全部单位。
 
int getAgentCount () const
 当前单位数。
 
Result< AgentRef > agentRef (int slot) const
 Resolve a compatibility dense slot to an owning identity value.
 
Result< AgentRef > resolveNamedAgent (const std::string &stableId) const
 Resolve a logical name once at binding boundaries, without rebuilding any state.
 
bool isAgentAlive (AgentRef reference) const noexcept
 Whether the owner and generation still identify a live agent. @thread Simulation thread only; the caller must separately keep the Crowd alive.
 
Result< AgentState > readAgent (AgentRef reference) const
 Read an owning state snapshot by owner-qualified identity.
 
Result< AgentUpdatePlan > prepareAgentUpdates (const AgentUpdateBatch &batch) const
 Canonically validate and own a batch before a later nonallocating commit. @ownership Copies values; retains no caller span or provider pointer. @lifetime Token may span motion steps; identity/flow validity is rechecked at commit. @thread Owner thread. @reentrancy No callbacks. @cost Linear copying plus identity sorting per batch; amortize preparation before a commit phase.
 
Result< AgentBatchReceipt > commitAgentUpdates (AgentUpdatePlan &&plan, std::span< const std::uint8_t > selection)
 Validate all identities then apply selected prepared updates without allocating success-path workspace.
 
Result< AgentBatchReceipt > updateAgents (const AgentUpdateBatch &batch)
 Compatibility-only one-call facade over canonical prepareAgentUpdates/commitAgentUpdates. @ownership Borrows input for the call. @thread Owner thread. @reentrancy No callbacks. @cost Allocates/copies and sorts per batch; new transaction consumers prepare once before publication.
 
Result< AgentBatchReceipt > removeAgents (const AgentRemovalBatch &batch)
 Atomically remove live references; every reference is checked before any removal. @ownership Borrows input during the call only. @thread Simulation thread only. @reentrancy No callbacks. @cost Linear removals plus sorting identities once per batch.
 
Result< AgentBatchReceipt > relocateAgents (const AgentRelocationBatch &batch)
 Atomically relocate live agents to exact clear positions; failure preserves all motion state. @ownership Borrows owned requests during this call. @lifetime References and intents remain unchanged. @thread Simulation thread only. @reentrancy No callbacks. @cost Copies position columns once per batch, then bounded candidate/pair geometry checks; amortize teleport requests per phase. This exact-placement operation has no nearest-free fallback.
 
Result< AgentBatchReceipt > copyAgentFrame (AgentFrame &destination) const
 Copy one owning frame into reusable caller storage; allocation failure preserves the output. @ownership Caller owns output; retains no internal view. @lifetime Survives all subsequent mutations. @thread Simulation thread only. @reentrancy No callbacks. @cost Linear in live agents per call; reuse capacity and copy once per consumer phase.
 
Result< AgentBatchReceipt > copyAgentStates (std::span< const AgentRef > references, AgentFrame &destination) const
 Copy a selected owning frame in request order; stale input preserves the destination. @ownership Borrows references only during the call; caller owns the copied frame. @lifetime Output survives all mutations. @thread Simulation thread only. @reentrancy No callbacks. @cost Linear in requested agents; reuse destination capacity once per consumer phase.
 
void setMaxAgents (int maxAgents)
 单位容量上限(默认 100000)。
 
int getMaxAgents () const
 Returns the max agents.
 
bool setAgentAction (int id, const std::string &action)
 设置行动:"idle" | "flow" | "seek" | "boids"。
 
std::string getAgentAction (int id) const
 查询行动名。
 
bool setAgentTarget (int id, float tx, float ty)
 设置世界目标点(seek 直接寻点,boids 作迁移偏置)。
 
bool clearAgentTarget (int id)
 清除目标点。
 
bool setAgentSpeed (int id, float speed)
 设置最大速度(世界单位/秒)。
 
bool setAgentAccel (int id, float accel)
 设置加速度上限(默认 maxSpeed×2)。
 
bool setAgentTurnRate (int id, float radPerSec)
 设置转向速率上限(弧度/秒)。
 
bool setAgentRadius (int id, float radius)
 设置半径。
 
bool setAgentData (int id, int data)
 设置游戏自定义标记。
 
int getAgentData (int id) const
 Returns the agent data.
 
Result< void > setAgentAvoidancePriority (int id, int priority)
 Set overlap-resolution priority; higher values yield less.
 
int getAgentAvoidancePriority (int id) const
 Return overlap-resolution priority, or zero for an invalid id.
 
Result< void > setAgentInteraction (int id, AgentInteraction policy)
 Atomically replace the local interaction policy for a current compact slot.
 
Result< AgentInteraction > getAgentInteraction (int id) const
 Read an owning policy snapshot, or NotFound for an invalid compact slot. @thread Simulation thread only. @lifetime The copy survives subsequent mutations.
 
Result< void > setInteractionPolicy (AgentRef reference, InteractionPolicy policy)
 Atomically replace independent steering/contact rules by owner-qualified identity.
 
Result< InteractionPolicy > readInteractionPolicy (AgentRef reference) const
 Read an owning canonical policy snapshot; stale or wrong-owner references return NotFound. @ownership Returns a value. @lifetime Survives mutation. @thread Simulation thread only. @reentrancy No callbacks.
 
Result< SpawnReceipt > applySpawnBatch (const SpawnBatch &batch)
 Apply a caller-built spawn batch atomically, including neighbor displacement.
 
Result< SpawnReceipt > createAgents (const AgentCreateBatch &batch)
 Canonical atomic agent creation with placement policies and work budgets. @ownership Borrows the owning batch for this call; returns an owning receipt. @thread Simulation thread only. @reentrancy No callbacks or reentry. @cost One simulation snapshot per creation batch plus explicitly bounded placement work; amortize by batching creation. Failure publishes neither agents nor displacement. @lifetime Returned references invalidate on agent removal, clear, restore or owner destruction.
 
bool setAgentPosition (int id, float x, float y)
 直接放置单位。
 
AgentState getAgentState (int id) const
 读取单位状态快照(非法 id 返回 action=-1)。
 
void setDefaultSpeed (float speed)
 新单位默认速度。
 
void setDefaultRadius (float radius)
 新单位默认半径。
 
void setDefaultTurnRate (float radPerSec)
 新单位默认转向速率(弧度/秒)。
 
void setArriveRadius (float radius)
 seek 到达减速半径。
 
void setSeparationRadius (float radius)
 分离/邻居查询半径。
 
void setPerceptionRadius (float radius)
 对齐/聚合感知半径(Boids;默认 64,可大于分离半径)。
 
void setSeparationWeight (float weight)
 Boids 分离力权重。
 
void setAlignmentWeight (float weight)
 Boids 对齐力权重。
 
void setCohesionWeight (float weight)
 Boids 聚合力权重。
 
void setWanderWeight (float weight)
 Boids wander 权重。
 
void setGoalWeight (float weight)
 Boids 目标偏置权重。
 
void setResolveOverlaps (bool enable)
 是否做位置重叠消解 pass(默认开)。
 
void setClampToField (bool enable)
 是否把单位钳制在流场边界内(默认开)。
 
Result< void > configureAvoidance (AvoidanceSettings settings)
 Configure predictive velocity sampling; invalid input leaves settings unchanged.
 
AvoidanceSettings getAvoidanceSettings () const
 Return an owning settings snapshot. @thread Simulation thread only.
 
Result< StepReport > advance (float dt)
 Advance using bounded simultaneous integration and contact projection.
 
Result< StepReport > advance (const CrowdStep &step)
 Advance the next owner tick using explicit time and deterministic operation budgets.
 
Result< void > checkAdvanceClock (const CrowdStep &step) const
 Validate external clock admission before a consumer publishes its input batch.
 
void step (float dt)
 Compatibility-only stepping facade; delegates to advance and throws on rejected input. Use advance to inspect residual crowding and handle failure. @thread Simulation thread only. @reentrancy No callbacks or reentry.
 
- Public 成员函数 继承自 eve::Module
virtual ~Module ()
 Module.
 
virtual std::string getName () const =0
 Returns the name.
 

友元

void exposeNavigationRequests (ssq::Class &cls)
 Register generation-qualified transient navigation request bindings.
 
Result< FlowLease > resolveFlowRequestLease (Crowd &crowd, const ssq::Table &token)
 Resolve a checked request-owned lease without retaining script table references.
 

详细描述

群体行为模块:连续流场寻路 + 海量单位移动/转向/行动 + Boids 鸟群。

Script: crowd <- eve.Crowd();

纯 CPU 仿真,与渲染解耦:每帧调用 step(dt) 推进;渲染/游戏逻辑通过 getPositions / getHeadings 批量读取(脚本预分配数组),万级单位无需逐单位回调。

行动模式: idle —— 不主动移动(分离力仍生效); flow —— 沿流场方向行军(Boids 分离力防扎堆); seek —— 向世界目标点移动,进入 arriveRadius 后线性减速; boids —— 鸟群:分离 + 对齐 + 聚合,可叠加目标偏置与 wander。

在文件 Crowd.h 第 266 行定义.

成员枚举类型说明

◆ FlowBuildState

Lifecycle of an owning prepared navigation publication.

枚举值
Ready 
Cancelled 
Committed 
Pending 
Failed 
Unreachable 

在文件 Crowd.h 第 302 行定义.

构造及析构函数说明

◆ Crowd()

eve::crowd::Crowd::Crowd ( )

Crowd.

在文件 Crowd.cpp 第 43 行定义.

◆ ~Crowd()

eve::crowd::Crowd::~Crowd ( )
override

Crowd.

在文件 Crowd.cpp 第 44 行定义.

引用了 eve::LifetimeOwner::reset().

成员函数说明

◆ acquireFlowField() [1/2]

Result< FlowLease > eve::crowd::Crowd::acquireFlowField ( FlowBuildPlan &&  plan)

Publish a completed build into shared cache without selecting the default field.

返回
Lease or stale/pressure failure; failure preserves cache and plan. @ownership Consumes plan only on success; lease copies pin storage, not this provider. @thread Owner thread only. @reentrancy No callbacks. @cost Bounded cache validation/eviction and ownership transfer after explicit graph advancement.

在文件 CrowdFlowCache.cpp 第 110 行定义.

引用了 bytes, Committed, eve::Conflict, entries, eve::Result< T >::failure(), eve::crowd::flowBuildAlgorithmVersion, getFieldStatus(), lease, Ready, eve::crowd::Crowd::Impl::retainedFlowBytes(), eve::Result< T >::success(), eve::crowd::FieldObservation::surface , 以及 Unreachable.

◆ acquireFlowField() [2/2]

Result< FlowLease > eve::crowd::Crowd::acquireFlowField ( std::span< const FlowGoal >  goals)

Acquire an existing field for a canonical goal set without graph work.

返回
Lease or NotFound; invalid input rejects without cache mutation. @ownership Copies pin immutable storage, not this provider. @thread Owner thread. @reentrancy No callbacks. @cost Sorts goals and compares complete bounded keys; amortize per navigation request.

在文件 CrowdFlowCache.cpp 第 98 行定义.

引用了 eve::crowd::canonicalFlowCoordinates(), eve::Result< T >::failure(), eve::crowd::flowBuildAlgorithmVersion, getFieldStatus(), eve::NotFound , 以及 eve::crowd::FieldObservation::surface.

被这些函数引用 eve::rts::CrowdFlowNavigation::pump().

◆ addAgent()

int eve::crowd::Crowd::addAgent ( float  x,
float  y,
float  heading,
float  radius 
)

添加单位;返回 id(=槽位索引;删除后 id 不稳定)。

参数
x世界 X
y世界 Y
heading初始朝向(弧度)
radius半径(用于分离/重叠消解)
返回
单位 id,达到上限返回 -1

在文件 Crowd.cpp 第 117 行定义.

引用了 d, heading, id, radius, x , 以及 y.

被这些函数引用 addNamedAgent().

◆ addFlowGoal()

void eve::crowd::Crowd::addFlowGoal ( int  gx,
int  gy 
)

追加目标格(多目标)。

在文件 Crowd.cpp 第 85 行定义.

◆ addNamedAgent()

int eve::crowd::Crowd::addNamedAgent ( const std::string &  stableId,
float  x,
float  y,
float  heading,
float  radius 
)

Add an agent with an editor/game-stable logical identifier.

参数
stableIdNon-empty logical identifier unique within this Crowd.
xInitial world X coordinate.
yInitial world Y coordinate.
headingInitial heading in radians.
radiusAgent collision radius.
返回
Current compact slot, or -1 when the identifier or capacity is invalid.

在文件 Crowd.cpp 第 150 行定义.

引用了 addAgent(), d, heading, index, name, eve::crowd::namedTieValue(), radius, x , 以及 y.

被这些函数引用 createAgents().

◆ advance() [1/2]

Result< StepReport > eve::crowd::Crowd::advance ( const CrowdStep &  step)

Advance the next owner tick using explicit time and deterministic operation budgets.

返回
Owning report, or structured failure preserving all motion, wander and clock state. @ownership Borrows the step during the call. @thread Simulation thread only. @reentrancy No callbacks. @cost Copies motion columns into reusable rollback storage once per tick, then bounded integration work; amortize calls at the fixed simulation cadence. Clock authority cannot mix with positive legacy stepping. @lifetime The report owns its observations. Timing counters never select simulation behavior.

在文件 CrowdAdvance.cpp 第 77 行定义.

引用了 step.

◆ advance() [2/2]

Result< StepReport > eve::crowd::Crowd::advance ( float  dt)

Advance using bounded simultaneous integration and contact projection.

参数
dtFinite, non-negative caller-supplied simulation seconds; zero is a no-op.
返回
Owning residual-contact report, or InvalidArgument/PreconditionViolation before mutation for invalid time or more than 1024 required substeps. @ownership Crowd retains agents; the report owns its observations. @lifetime Report values remain valid independently of subsequent mutations. @thread Simulation thread only; no concurrent access to this Crowd. @reentrancy No callbacks and no reentrant mutation. @cost Per tick, linear storage work plus local neighbor work per substep/contact iteration; dense clusters can be quadratic. Reuse one report per game tick.

Substeps are at most 1/60 second and limit travel relative to positive agent radii and terrain cell size. Call with a fixed dt sequence for repeatability on one build; cross-platform bit-exact replay is not guaranteed. Residual contacts are reported rather than pretending an impossible packing was solved.

在文件 CrowdAdvance.cpp 第 60 行定义.

引用了 dt, duration, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Duration::fromSeconds(), eve::InvalidArgument, eve::PreconditionViolation , 以及 tick.

被这些函数引用 eve::crowd::exposeAgentBatches().

◆ advanceFlowBuild()

Result< Crowd::FlowBuildProgress > eve::crowd::Crowd::advanceFlowBuild ( FlowBuildPlan &  plan,
int  maxWork 
)

Spend at most maxWork heap-pop/direction-cell units on owned request state.

返回
Progress; stale requests are cancelled before work, failures never publish. @thread Owner thread only. @reentrancy No callbacks. @cost Bounded local graph/gradient work; amortize across navigation update phases.

在文件 CrowdNavigation.cpp 第 54 行定义.

引用了 cancelled, Cancelled, cells, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), index, eve::InvalidArgument, eve::NoOp, Pending, Ready, eve::Status::success(), eve::Result< T >::success() , 以及 Unreachable.

被这些函数引用 buildFlowField() , 以及 eve::rts::CrowdFlowNavigation::pump().

◆ agentRef()

Result< AgentRef > eve::crowd::Crowd::agentRef ( int  slot) const

Resolve a compatibility dense slot to an owning identity value.

返回
Agent reference or NotFound. @ownership Returns a value; does not retain the Crowd. @lifetime The reference survives unrelated swap-pop; invalidate on removal or clear. @thread Simulation thread only. @reentrancy No callbacks.

在文件 CrowdRegistry.cpp 第 113 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), index, eve::NotFound, slot , 以及 eve::Result< T >::success().

被这些函数引用 createAgents(), resolveNamedAgent() , 以及 setAgentInteraction().

◆ applySpawnBatch()

Result< SpawnReceipt > eve::crowd::Crowd::applySpawnBatch ( const SpawnBatch &  batch)

Apply a caller-built spawn batch atomically, including neighbor displacement.

参数
batchUp to 1024 uniquely named agents and explicit placement/work budgets.
返回
Owning receipt, or a diagnostic without any world mutation on failure. @ownership Copies the batch; retains no caller references. Existing targets and velocities are preserved. @thread Simulation thread only. @reentrancy No callbacks or reentry. @cost Copies current simulation/field storage once per batch, then performs bounded candidate/contact work. Amortize by batching spawns; NearestFree chooses the first clear deterministic ring sample, not a continuous optimum.

PushNeighbors anchors all new agents, respects existing hold/pushability and interaction masks, and only moves the connected contact region. No simulation time is advanced. Terrain and distance limits are enforced before commit. Budget exhaustion is a visible failure, never a partial creation.

在文件 CrowdSpawn.cpp 第 35 行定义.

引用了 createAgents().

◆ build()

void eve::crowd::Crowd::build ( )

执行 Dijkstra 建场。

在文件 Crowd.cpp 第 89 行定义.

◆ buildFlowField()

void eve::crowd::Crowd::buildFlowField ( int  gx,
int  gy 
)

Compatibility-only synchronous single-goal build through prepareFlowBuild/commitFlowBuild.

异常
eve::ExceptionA rejected request leaves the published field unchanged. @cost Full field copy and Dijkstra; use explicit preparation/publication at navigation boundaries.

在文件 Crowd.cpp 第 75 行定义.

引用了 advanceFlowBuild(), commitFlowBuild(), eve::Result< void >::expect(), Pending , 以及 prepareFlowBuild().

◆ captureSnapshot()

Result< Crowd::Snapshot > eve::crowd::Crowd::captureSnapshot ( ) const

Copy authoritative runtime state and clock into an owning checkpoint.

返回
Immutable in-process state; no borrowed arrays or pointers. @thread Simulation owner thread. @reentrancy No callbacks. @cost Copies all agent/field storage; amortize at explicit checkpoint boundaries.

在文件 CrowdSnapshot.cpp 第 11 行定义.

引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::crowd::Serial, snapshot, state , 以及 eve::Result< T >::success().

◆ checkAdvanceClock()

Result< void > eve::crowd::Crowd::checkAdvanceClock ( const CrowdStep &  step) const

Validate external clock admission before a consumer publishes its input batch.

返回
Checked clock/duration admission only; geometry and solve budgets are checked by advance. @ownership Borrows step; retains nothing. @thread Simulation owner thread only. @reentrancy No callbacks. No reservation: intervening advances invalidate this observation.

在文件 CrowdAdvance.cpp 第 79 行定义.

引用了 step.

◆ clearAgents()

void eve::crowd::Crowd::clearAgents ( )

清空全部单位。

在文件 Crowd.cpp 第 250 行定义.

引用了 d.

◆ clearAgentTarget()

bool eve::crowd::Crowd::clearAgentTarget ( int  id)

清除目标点。

在文件 Crowd.cpp 第 309 行定义.

◆ clearFlowGoals()

void eve::crowd::Crowd::clearFlowGoals ( )

清空目标列表。

在文件 Crowd.cpp 第 87 行定义.

◆ commitAgentUpdates()

Result< AgentBatchReceipt > eve::crowd::Crowd::commitAgentUpdates ( AgentUpdatePlan &&  plan,
std::span< const std::uint8_t >  selection 
)

Validate all identities then apply selected prepared updates without allocating success-path workspace.

参数
planOwned token; consumed on success, preserved on rejection.
selectionEmpty means all; otherwise one zero/one byte per prepared update, borrowed during call.
返回
Selected count or failure before any mutation, including stale unselected references. @ownership Resolves numeric slots at commit; never retains registry pointers across steps. @thread Owner thread; unavailable during advancement. @reentrancy No callbacks. @cost Linear validation/application per prepared batch; no sorting or output allocation on success.

在文件 CrowdUpdatePlan.cpp 第 43 行定义.

引用了 code, eve::Conflict, count, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, message, eve::NotFound , 以及 eve::Result< T >::success().

被这些函数引用 updateAgents().

◆ commitFlowBuild()

Result< void > eve::crowd::Crowd::commitFlowBuild ( FlowBuildPlan &&  plan)

Publish a prepared field without allocation; reject stale, foreign or cancelled plans.

返回
Structured outcome; failure leaves the current field unchanged. @thread Owner thread only. @reentrancy No callbacks.

在文件 CrowdNavigation.cpp 第 87 行定义.

引用了 eve::Applied, Committed, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), Ready, eve::Status::success(), eve::Result< T >::success() , 以及 Unreachable.

被这些函数引用 buildFlowField().

◆ commitNavigationSurface()

Result< void > eve::crowd::Crowd::commitNavigationSurface ( SurfacePlan &&  plan)

Publish terrain and navigation projection together without allocation.

返回
Checked result; stale/foreign plans preserve the current field. @thread Owner thread. @reentrancy No callbacks.

在文件 CrowdSurface.cpp 第 89 行定义.

引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NoOp, eve::Status::success() , 以及 eve::Result< T >::success().

◆ commitRestore()

Result< void > eve::crowd::Crowd::commitRestore ( RestorePlan &&  plan)

Publish a prepared restore without allocation; consumes plan on success.

返回
Failure for empty, consumed or foreign plans, preserving current state. @thread Simulation owner thread. @reentrancy No callbacks.

在文件 CrowdSnapshot.cpp 第 55 行定义.

引用了 eve::Applied, eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::Status::success() , 以及 eve::Result< T >::success().

◆ configureAvoidance()

Result< void > eve::crowd::Crowd::configureAvoidance ( AvoidanceSettings  settings)

Configure predictive velocity sampling; invalid input leaves settings unchanged.

返回
Applied or InvalidArgument. @ownership Copies the settings. @thread Simulation thread only. @reentrancy No callbacks or reentry.

Sampling respects acceleration limits and prefers passing on the right.

  • It is a local heuristic, not a collision-free or deadlock-free guarantee; inspect advance reports.

在文件 CrowdAvoidance.cpp 第 20 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, settings, eve::Status::success() , 以及 eve::Result< T >::success().

◆ configureFlowCache()

Result< void > eve::crowd::Crowd::configureFlowCache ( std::uint64_t  budgetBytes)

Set retained-storage budget, evicting only unleased fields with atomic pressure failure.

返回
Applied or pressure/invalid failure. @thread Owner thread. @reentrancy No callbacks. @cost Stages bounded metadata for at most 10000 entries; amortize at navigation configuration boundaries.

在文件 CrowdFlowCache.cpp 第 146 行定义.

引用了 eve::Result< T >::failure(), eve::InvalidArgument , 以及 eve::Result< T >::success().

◆ copyAgentFrame()

Result< AgentBatchReceipt > eve::crowd::Crowd::copyAgentFrame ( AgentFrame &  destination) const

Copy one owning frame into reusable caller storage; allocation failure preserves the output. @ownership Caller owns output; retains no internal view. @lifetime Survives all subsequent mutations. @thread Simulation thread only. @reentrancy No callbacks. @cost Linear in live agents per call; reuse capacity and copy once per consumer phase.

在文件 CrowdBatch.cpp 第 90 行定义.

引用了 eve::crowd::AgentFrame::agents, eve::Failed, getAgentState(), eve::crowd::AgentFrame::simulationSeconds, slot, eve::Result< T >::success() , 以及 eve::crowd::AgentFrame::tick.

◆ copyAgentStates()

Result< AgentBatchReceipt > eve::crowd::Crowd::copyAgentStates ( std::span< const AgentRef >  references,
AgentFrame &  destination 
) const

Copy a selected owning frame in request order; stale input preserves the destination. @ownership Borrows references only during the call; caller owns the copied frame. @lifetime Output survives all mutations. @thread Simulation thread only. @reentrancy No callbacks. @cost Linear in requested agents; reuse destination capacity once per consumer phase.

在文件 CrowdBatch.cpp 第 108 行定义.

引用了 eve::crowd::AgentFrame::agents, eve::Failed, getAgentState(), index, isAgentAlive(), eve::NotFound , 以及 reference.

◆ costAtWorld()

float eve::crowd::Crowd::costAtWorld ( float  wx,
float  wy 
) const

世界坐标积分代价(场外返回 kUnreachable)。

在文件 Crowd.cpp 第 107 行定义.

引用了 wx , 以及 wy.

◆ createAgents()

Result< SpawnReceipt > eve::crowd::Crowd::createAgents ( const AgentCreateBatch &  batch)

Canonical atomic agent creation with placement policies and work budgets. @ownership Borrows the owning batch for this call; returns an owning receipt. @thread Simulation thread only. @reentrancy No callbacks or reentry. @cost One simulation snapshot per creation batch plus explicitly bounded placement work; amortize by batching creation. Failure publishes neither agents nor displacement. @lifetime Returned references invalidate on agent removal, clear, restore or owner destruction.

在文件 CrowdSpawn.cpp 第 37 行定义.

引用了 active, addNamedAgent(), agentRef(), eve::crowd::SpawnBatch::agents, angle, eve::Applied, eve::crowd::canonicalInteraction(), eve::crowd::SpawnReceipt::checks, code, eve::Conflict, count, eve::crowd::SpawnReceipt::created, d, depth, eve::crowd::SpawnReceipt::displacedAgents, distance, dx, dy, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::InvariantViolation, eve::crowd::isTerrainClear(), left, length, limit, eve::crowd::SpawnBatch::maxChecks, eve::crowd::SpawnBatch::maxDistance, eve::crowd::SpawnBatch::maxPasses, message, eve::crowd::namedTieValue(), eve::crowd::NearestFree, eve::NoOp, eve::crowd::SpawnBatch::policy, eve::PreconditionViolation, eve::crowd::PushNeighbors, radius, reference, eve::crowd::RejectOverlap, request, right, scale, eve::crowd::SpawnBatch::searchSpacing, setInteractionPolicy(), slot, eve::Status::success(), eve::Result< T >::success(), eve::crowd::validInteraction(), x , 以及 y.

被这些函数引用 applySpawnBatch().

◆ flowAtCell()

FlowVec eve::crowd::Crowd::flowAtCell ( int  cx,
int  cy 
) const

格级流场方向。

在文件 Crowd.cpp 第 109 行定义.

引用了 cx, cy , 以及 v.

◆ flowAtWorld()

FlowVec eve::crowd::Crowd::flowAtWorld ( float  wx,
float  wy 
) const

世界坐标流场方向(双线性插值;场外返回零向量)。

在文件 Crowd.cpp 第 101 行定义.

引用了 v, wx , 以及 wy.

◆ getAgentAction()

std::string eve::crowd::Crowd::getAgentAction ( int  id) const

查询行动名。

在文件 Crowd.cpp 第 296 行定义.

◆ getAgentAvoidancePriority()

int eve::crowd::Crowd::getAgentAvoidancePriority ( int  id) const

Return overlap-resolution priority, or zero for an invalid id.

在文件 Crowd.cpp 第 358 行定义.

◆ getAgentCount()

int eve::crowd::Crowd::getAgentCount ( ) const

当前单位数。

在文件 Crowd.cpp 第 280 行定义.

◆ getAgentData()

int eve::crowd::Crowd::getAgentData ( int  id) const

Returns the agent data.

在文件 Crowd.cpp 第 345 行定义.

◆ getAgentInteraction()

Result< AgentInteraction > eve::crowd::Crowd::getAgentInteraction ( int  id) const

Read an owning policy snapshot, or NotFound for an invalid compact slot. @thread Simulation thread only. @lifetime The copy survives subsequent mutations.

在文件 CrowdInteraction.cpp 第 39 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NotFound , 以及 eve::Result< T >::success().

◆ getAgentStableId()

std::string eve::crowd::Crowd::getAgentStableId ( int  index) const

Return the stable logical identifier for a compact slot.

参数
indexCurrent compact slot.
返回
Stable identifier, or an empty string for invalid or anonymous slots.

在文件 Crowd.cpp 第 182 行定义.

引用了 index.

◆ getAgentState()

AgentState eve::crowd::Crowd::getAgentState ( int  id) const

读取单位状态快照(非法 id 返回 action=-1)。

在文件 Crowd.cpp 第 369 行定义.

引用了 eve::crowd::AgentState::action , 以及 s.

被这些函数引用 copyAgentFrame(), copyAgentStates() , 以及 readAgent().

◆ getAvoidanceSettings()

AvoidanceSettings eve::crowd::Crowd::getAvoidanceSettings ( ) const

Return an owning settings snapshot. @thread Simulation thread only.

在文件 CrowdAvoidance.cpp 第 30 行定义.

◆ getCellCost()

float eve::crowd::Crowd::getCellCost ( int  cx,
int  cy 
) const

查询地形代价。

在文件 Crowd.cpp 第 60 行定义.

引用了 cx , 以及 cy.

◆ getCellSize()

float eve::crowd::Crowd::getCellSize ( ) const

Returns the cell size.

在文件 Crowd.cpp 第 97 行定义.

◆ getFieldHeight()

int eve::crowd::Crowd::getFieldHeight ( ) const

Returns the field height.

在文件 Crowd.cpp 第 96 行定义.

◆ getFieldOriginX()

float eve::crowd::Crowd::getFieldOriginX ( ) const

Returns the field origin x.

在文件 Crowd.cpp 第 98 行定义.

◆ getFieldOriginY()

float eve::crowd::Crowd::getFieldOriginY ( ) const

Returns the field origin y.

在文件 Crowd.cpp 第 99 行定义.

◆ getFieldStatus()

FieldObservation eve::crowd::Crowd::getFieldStatus ( ) const
noexcept

Observe current field readiness and owner-local revision without rebuilding.

返回
Owning metadata; stale differs from unbuilt and ready-but-unreachable. @thread Simulation owner thread. @reentrancy No callbacks or retained pointers.

在文件 Crowd.cpp 第 62 行定义.

引用了 eve::crowd::FieldObservation::builtRevision, eve::crowd::FieldObservation::goals, eve::crowd::FieldObservation::inputRevision, eve::crowd::FieldObservation::owner, eve::crowd::FieldObservation::revision, eve::crowd::FieldObservation::state , 以及 eve::crowd::FieldObservation::surface.

被这些函数引用 acquireFlowField(), acquireFlowField(), eve::rts::CrowdFlowNavigation::begin(), eve::rts::CrowdFlowNavigation::replaceGroups(), eve::rts::CrowdFlowNavigation::requestRoute() , 以及 eve::rts::CrowdFlowNavigation::steerRoute().

◆ getFieldWidth()

int eve::crowd::Crowd::getFieldWidth ( ) const

网格信息访问器(调试渲染用)。

在文件 Crowd.cpp 第 95 行定义.

◆ getFlowCacheStatus()

FlowCacheObservation eve::crowd::Crowd::getFlowCacheStatus ( ) const
noexcept

Read retained-storage accounting without copying fields; owner thread only.

在文件 CrowdFlowCache.cpp 第 157 行定义.

引用了 eve::crowd::FlowCacheObservation::entries , 以及 result.

◆ getMaxAgents()

int eve::crowd::Crowd::getMaxAgents ( ) const

Returns the max agents.

在文件 Crowd.cpp 第 286 行定义.

◆ getNamedAgentIndex()

int eve::crowd::Crowd::getNamedAgentIndex ( const std::string &  stableId) const

Resolve a stable logical identifier to the current compact slot.

参数
stableIdLogical identifier to resolve.
返回
Current compact slot, or -1 when missing.

在文件 Crowd.cpp 第 177 行定义.

引用了 found.

被这些函数引用 removeNamedAgent() , 以及 resolveNamedAgent().

◆ hasNamedAgent()

bool eve::crowd::Crowd::hasNamedAgent ( const std::string &  stableId) const

Return whether a stable logical agent exists.

参数
stableIdLogical identifier to query.
返回
True when the identifier is currently mapped.

在文件 Crowd.cpp 第 173 行定义.

◆ isAgentAlive()

bool eve::crowd::Crowd::isAgentAlive ( AgentRef  reference) const
noexcept

Whether the owner and generation still identify a live agent. @thread Simulation thread only; the caller must separately keep the Crowd alive.

在文件 CrowdRegistry.cpp 第 124 行定义.

引用了 reference.

被这些函数引用 copyAgentStates(), eve::rts::RTS::relocateUnits() , 以及 removeAgents().

◆ isFieldBuilt()

bool eve::crowd::Crowd::isFieldBuilt ( ) const

是否已建场。

在文件 Crowd.cpp 第 91 行定义.

◆ isReachable()

bool eve::crowd::Crowd::isReachable ( int  cx,
int  cy 
) const

某格是否可达。

在文件 Crowd.cpp 第 93 行定义.

引用了 cx , 以及 cy.

◆ lifetimeWitness()

LifetimeWitness eve::crowd::Crowd::lifetimeWitness ( ) const
inlinenoexcept

Return a non-owning witness for this provider instance, independent of restored agent state.

返回
Opaque weak witness; expiration means the provider cannot be dereferenced. @thread Owner thread only; does not authorize concurrent destruction or keep Crowd alive. @reentrancy No callbacks. Witness remains valid across agent clear and checkpoint restoration.

在文件 Crowd.h 第 444 行定义.

◆ Module_REG()

eve::crowd::Crowd::Module_REG ( Crowd  )

◆ prepareAgentUpdates()

Result< Crowd::AgentUpdatePlan > eve::crowd::Crowd::prepareAgentUpdates ( const AgentUpdateBatch &  batch) const

Canonically validate and own a batch before a later nonallocating commit. @ownership Copies values; retains no caller span or provider pointer. @lifetime Token may span motion steps; identity/flow validity is rechecked at commit. @thread Owner thread. @reentrancy No callbacks. @cost Linear copying plus identity sorting per batch; amortize preparation before a commit phase.

在文件 CrowdUpdatePlan.cpp 第 13 行定义.

引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), identities, eve::InvalidArgument, eve::NotFound, eve::Result< T >::success() , 以及 eve::crowd::validAgentUpdate().

被这些函数引用 updateAgents().

◆ prepareFlowBuild() [1/2]

Result< Crowd::FlowBuildPlan > eve::crowd::Crowd::prepareFlowBuild ( int  gx,
int  gy 
) const

Prepare owned navigation workstate for one goal without changing the live field.

返回
Move-only plan bound to this Crowd owner and current navigation input revision. @ownership Plan owns all storage and retains no provider pointers. @thread Owner thread only. @reentrancy No callbacks. @cost Copies grid storage and seeds goal work; amortize per navigation request. Graph work is advanced separately.

在文件 CrowdNavigation.cpp 第 31 行定义.

引用了 prepareFlowBuild().

被这些函数引用 buildFlowField(), prepareFlowBuild() , 以及 eve::rts::CrowdFlowNavigation::pump().

◆ prepareFlowBuild() [2/2]

Result< Crowd::FlowBuildPlan > eve::crowd::Crowd::prepareFlowBuild ( std::span< const FlowGoal >  goals) const

Prepare one shared field for a canonical, nonempty set of at most 1024 destinations.

返回
Owned plan; invalid cells reject before changing live state. Blocked goals are allowed. @ownership Copies, sorts and deduplicates caller coordinates; retains no input spans. @thread Simulation owner thread only. @reentrancy No callbacks. @cost Copies grid-sized workstate and sorts the goal set; amortize per shared navigation request. Graph advancement and atomic publication use the same kernel as single-goal compatibility calls.

在文件 CrowdNavigation.cpp 第 35 行定义.

引用了 eve::crowd::canonicalFlowCoordinates(), eve::Result< T >::failure(), Pending , 以及 eve::Result< T >::success().

◆ prepareNavigationSurface()

Result< Crowd::SurfacePlan > eve::crowd::Crowd::prepareNavigationSurface ( const NavigationSurfaceSnapshot &  snapshot) const

Validate and copy an immutable surface projection without publishing it.

返回
Owned plan; conflicting provenance or invalid cost/geometry leaves current state unchanged. @ownership Does not retain input arrays. @thread Owner thread. @reentrancy No callbacks. @cost Linear validation and grid copies; amortize per explicit surface revision boundary.

在文件 CrowdSurface.cpp 第 21 行定义.

引用了 code, eve::Conflict, count, eve::Diagnostic::error(), eve::Result< T >::failure(), index, eve::InvalidArgument, message, eve::NoOp, snapshot, eve::Status::success(), eve::Result< T >::success(), valid , 以及 value.

◆ prepareRestore()

Result< Crowd::RestorePlan > eve::crowd::Crowd::prepareRestore ( const Snapshot &  snapshot) const

Allocate complete restored state and fresh handle ownership before publication.

返回
One-use plan targeted at this Crowd; previous AgentRef values become stale on commit. @thread Simulation owner thread. @reentrancy No callbacks. @cost Copies snapshot storage once; prepare before cross-domain observable mutation.

在文件 CrowdSnapshot.cpp 第 26 行定义.

引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), lease, owner, snapshot , 以及 eve::Result< T >::success().

◆ readAgent()

Result< AgentState > eve::crowd::Crowd::readAgent ( AgentRef  reference) const

Read an owning state snapshot by owner-qualified identity.

返回
State or NotFound, including wrong-owner and stale-generation references. @ownership Returns a value. @lifetime Snapshot survives subsequent mutation. @thread Simulation thread only. @reentrancy No callbacks.

在文件 CrowdRegistry.cpp 第 126 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), getAgentState(), eve::NotFound, reference, slot , 以及 eve::Result< T >::success().

◆ readInteractionPolicy()

Result< InteractionPolicy > eve::crowd::Crowd::readInteractionPolicy ( AgentRef  reference) const

Read an owning canonical policy snapshot; stale or wrong-owner references return NotFound. @ownership Returns a value. @lifetime Survives mutation. @thread Simulation thread only. @reentrancy No callbacks.

在文件 CrowdInteraction.cpp 第 48 行定义.

引用了 eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NotFound, reference, slot , 以及 eve::Result< T >::success().

◆ relocateAgents()

Result< AgentBatchReceipt > eve::crowd::Crowd::relocateAgents ( const AgentRelocationBatch &  batch)

Atomically relocate live agents to exact clear positions; failure preserves all motion state. @ownership Borrows owned requests during this call. @lifetime References and intents remain unchanged. @thread Simulation thread only. @reentrancy No callbacks. @cost Copies position columns once per batch, then bounded candidate/pair geometry checks; amortize teleport requests per phase. This exact-placement operation has no nearest-free fallback.

在文件 CrowdRelocation.cpp 第 7 行定义.

引用了 eve::crowd::AgentRelocationBatch::agents, eve::Applied, code, eve::Conflict, d, eve::Diagnostic::error(), eve::Result< T >::failure(), index, eve::InvalidArgument, eve::crowd::isTerrainClear(), eve::crowd::AgentRelocationBatch::maxChecks, message, eve::NoOp, eve::NotFound, eve::PreconditionViolation, request, slot, slots, eve::Status::success(), eve::Result< T >::success() , 以及 value.

被这些函数引用 eve::rts::RTS::relocateUnits().

◆ removeAgent()

bool eve::crowd::Crowd::removeAgent ( int  id)

删除单位(swap-pop O(1))。

在文件 Crowd.cpp 第 191 行定义.

引用了 d , 以及 id.

被这些函数引用 removeAgents() , 以及 removeNamedAgent().

◆ removeAgents()

Result< AgentBatchReceipt > eve::crowd::Crowd::removeAgents ( const AgentRemovalBatch &  batch)

Atomically remove live references; every reference is checked before any removal. @ownership Borrows input during the call only. @thread Simulation thread only. @reentrancy No callbacks. @cost Linear removals plus sorting identities once per batch.

在文件 CrowdBatch.cpp 第 70 行定义.

引用了 eve::crowd::AgentRemovalBatch::agents, eve::Conflict, EV_ASSERT, eve::Failed, identities, isAgentAlive(), eve::NotFound, reference, removeAgent(), removed , 以及 eve::Result< T >::success().

◆ removeNamedAgent()

bool eve::crowd::Crowd::removeNamedAgent ( const std::string &  stableId)

Remove an agent by stable logical identifier.

参数
stableIdLogical identifier to remove.
返回
True when an existing agent was removed.

在文件 Crowd.cpp 第 186 行定义.

引用了 getNamedAgentIndex(), index , 以及 removeAgent().

◆ resizeField()

void eve::crowd::Crowd::resizeField ( int  width,
int  height,
float  cellSize,
float  originX,
float  originY 
)

配置流场网格(世界单位/格)。

在文件 Crowd.cpp 第 48 行定义.

引用了 height , 以及 width.

◆ resolveNamedAgent()

Result< AgentRef > eve::crowd::Crowd::resolveNamedAgent ( const std::string &  stableId) const

Resolve a logical name once at binding boundaries, without rebuilding any state.

返回
Agent reference or NotFound. @ownership Returns a value; no input retained. @lifetime Invalid after agent removal, clear or owner destruction. @thread Simulation thread only. @reentrancy No callbacks.

在文件 CrowdRegistry.cpp 第 120 行定义.

引用了 agentRef() , 以及 getNamedAgentIndex().

◆ sampleFlowField()

Result< FlowSample > eve::crowd::Crowd::sampleFlowField ( const FlowLease &  lease,
float  x,
float  y 
) const

Sample a current lease; stale/foreign leases fail, unreachable locations return zero. @ownership Borrows lease during call only. @thread Owner thread. @reentrancy No callbacks.

在文件 CrowdFlowCache.cpp 第 164 行定义.

引用了 eve::Conflict, eve::InvalidArgument, eve::crowd::isFlowPointReachable(), lease, eve::crowd::Reachable, result, eve::crowd::FlowSample::state, eve::Result< T >::success(), x , 以及 y.

◆ setAgentAccel()

bool eve::crowd::Crowd::setAgentAccel ( int  id,
float  accel 
)

设置加速度上限(默认 maxSpeed×2)。

在文件 Crowd.cpp 第 321 行定义.

◆ setAgentAction()

bool eve::crowd::Crowd::setAgentAction ( int  id,
const std::string &  action 
)

设置行动:"idle" | "flow" | "seek" | "boids"。

在文件 Crowd.cpp 第 288 行定义.

引用了 a , 以及 action.

◆ setAgentAvoidancePriority()

Result< void > eve::crowd::Crowd::setAgentAvoidancePriority ( int  id,
int  priority 
)

Set overlap-resolution priority; higher values yield less.

返回
Applied, or NotFound for an invalid slot.

在文件 Crowd.cpp 第 350 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::NotFound, priority, eve::Status::success() , 以及 eve::Result< T >::success().

◆ setAgentData()

bool eve::crowd::Crowd::setAgentData ( int  id,
int  data 
)

设置游戏自定义标记。

在文件 Crowd.cpp 第 339 行定义.

◆ setAgentInteraction()

Result< void > eve::crowd::Crowd::setAgentInteraction ( int  id,
AgentInteraction  policy 
)

Atomically replace the local interaction policy for a current compact slot.

参数
idCurrent slot; resolve stable identity again after any removal.
policyCopied policy with finite pushability in [0,1] and non-negative masks.
返回
Applied, InvalidArgument or NotFound; failure leaves the policy unchanged. @ownership Crowd owns a copy. @thread Simulation thread only. @reentrancy No callbacks or reentrant mutation.

在文件 CrowdInteraction.cpp 第 18 行定义.

引用了 agentRef(), eve::crowd::canonicalInteraction(), eve::Result< T >::failure(), reference , 以及 setInteractionPolicy().

◆ setAgentPosition()

bool eve::crowd::Crowd::setAgentPosition ( int  id,
float  x,
float  y 
)

直接放置单位。

在文件 Crowd.cpp 第 362 行定义.

引用了 x , 以及 y.

◆ setAgentRadius()

bool eve::crowd::Crowd::setAgentRadius ( int  id,
float  radius 
)

设置半径。

在文件 Crowd.cpp 第 333 行定义.

引用了 radius.

◆ setAgentSpeed()

bool eve::crowd::Crowd::setAgentSpeed ( int  id,
float  speed 
)

设置最大速度(世界单位/秒)。

在文件 Crowd.cpp 第 315 行定义.

◆ setAgentTarget()

bool eve::crowd::Crowd::setAgentTarget ( int  id,
float  tx,
float  ty 
)

设置世界目标点(seek 直接寻点,boids 作迁移偏置)。

在文件 Crowd.cpp 第 301 行定义.

◆ setAgentTurnRate()

bool eve::crowd::Crowd::setAgentTurnRate ( int  id,
float  radPerSec 
)

设置转向速率上限(弧度/秒)。

在文件 Crowd.cpp 第 327 行定义.

◆ setAlignmentWeight()

void eve::crowd::Crowd::setAlignmentWeight ( float  weight)

Boids 对齐力权重。

在文件 Crowd.cpp 第 400 行定义.

引用了 weight.

◆ setArriveRadius()

void eve::crowd::Crowd::setArriveRadius ( float  radius)

seek 到达减速半径。

在文件 Crowd.cpp 第 396 行定义.

引用了 radius.

◆ setBlocked()

void eve::crowd::Crowd::setBlocked ( int  cx,
int  cy,
bool  blocked 
)

设置/清除某格阻挡。

在文件 Crowd.cpp 第 52 行定义.

引用了 cx , 以及 cy.

◆ setCellCost()

void eve::crowd::Crowd::setCellCost ( int  cx,
int  cy,
float  cost 
)

设置地形代价(0=阻挡,>=1 可走)。

在文件 Crowd.cpp 第 56 行定义.

引用了 cost, cx , 以及 cy.

◆ setClampToField()

void eve::crowd::Crowd::setClampToField ( bool  enable)

是否把单位钳制在流场边界内(默认开)。

在文件 Crowd.cpp 第 405 行定义.

◆ setCohesionWeight()

void eve::crowd::Crowd::setCohesionWeight ( float  weight)

Boids 聚合力权重。

在文件 Crowd.cpp 第 401 行定义.

引用了 weight.

◆ setDefaultRadius()

void eve::crowd::Crowd::setDefaultRadius ( float  radius)

新单位默认半径。

在文件 Crowd.cpp 第 392 行定义.

引用了 radius.

◆ setDefaultSpeed()

void eve::crowd::Crowd::setDefaultSpeed ( float  speed)

新单位默认速度。

在文件 Crowd.cpp 第 391 行定义.

◆ setDefaultTurnRate()

void eve::crowd::Crowd::setDefaultTurnRate ( float  radPerSec)

新单位默认转向速率(弧度/秒)。

在文件 Crowd.cpp 第 393 行定义.

◆ setGoalWeight()

void eve::crowd::Crowd::setGoalWeight ( float  weight)

Boids 目标偏置权重。

在文件 Crowd.cpp 第 403 行定义.

引用了 weight.

◆ setInteractionPolicy()

Result< void > eve::crowd::Crowd::setInteractionPolicy ( AgentRef  reference,
InteractionPolicy  policy 
)

Atomically replace independent steering/contact rules by owner-qualified identity.

返回
Applied, InvalidArgument or NotFound; failure changes no state. @ownership Copies the policy. @thread Simulation thread only. @reentrancy No callbacks. @lifetime Stored until replaced or agent removal. Terrain constraints are never filtered.

在文件 CrowdInteraction.cpp 第 24 行定义.

引用了 eve::Applied, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::crowd::InteractionPolicy::holdPosition, index, eve::InvalidArgument, eve::NotFound, reference, slot, eve::Status::success(), eve::Result< T >::success() , 以及 eve::crowd::validInteraction().

被这些函数引用 createAgents() , 以及 setAgentInteraction().

◆ setMaxAgents()

void eve::crowd::Crowd::setMaxAgents ( int  maxAgents)

单位容量上限(默认 100000)。

在文件 Crowd.cpp 第 282 行定义.

◆ setPerceptionRadius()

void eve::crowd::Crowd::setPerceptionRadius ( float  radius)

对齐/聚合感知半径(Boids;默认 64,可大于分离半径)。

在文件 Crowd.cpp 第 398 行定义.

引用了 radius.

◆ setResolveOverlaps()

void eve::crowd::Crowd::setResolveOverlaps ( bool  enable)

是否做位置重叠消解 pass(默认开)。

在文件 Crowd.cpp 第 404 行定义.

◆ setSeparationRadius()

void eve::crowd::Crowd::setSeparationRadius ( float  radius)

分离/邻居查询半径。

在文件 Crowd.cpp 第 397 行定义.

引用了 radius.

◆ setSeparationWeight()

void eve::crowd::Crowd::setSeparationWeight ( float  weight)

Boids 分离力权重。

在文件 Crowd.cpp 第 399 行定义.

引用了 weight.

◆ setWanderWeight()

void eve::crowd::Crowd::setWanderWeight ( float  weight)

Boids wander 权重。

在文件 Crowd.cpp 第 402 行定义.

引用了 weight.

◆ setWorkScheduler()

Result< void > eve::crowd::Crowd::setWorkScheduler ( CrowdExecution  execution,
std::shared_ptr< CrowdWorkScheduler >  scheduler 
)

Select serial execution or inject a shared synchronous scheduler lease.

参数
executionExplicit mode; Parallel requires a nonempty lease.
schedulerOwned shared adapter lease, not ownership of its worker pool.
返回
InvalidArgument for missing provider, Conflict during advancement. @ownership Serial drops the old lease; snapshot restore preserves current execution configuration. @thread Crowd owner only. @reentrancy Must not be called by scheduler callbacks.

在文件 CrowdScheduler.cpp 第 4 行定义.

引用了 eve::Conflict, eve::Diagnostic::error(), eve::Result< T >::failure(), eve::InvalidArgument, eve::crowd::Parallel, eve::crowd::Serial , 以及 eve::Result< T >::success().

◆ step()

void eve::crowd::Crowd::step ( float  dt)

Compatibility-only stepping facade; delegates to advance and throws on rejected input. Use advance to inspect residual crowding and handle failure. @thread Simulation thread only. @reentrancy No callbacks or reentry.

在文件 CrowdStep.cpp 第 115 行定义.

引用了 dt.

◆ updateAgents()

Result< AgentBatchReceipt > eve::crowd::Crowd::updateAgents ( const AgentUpdateBatch &  batch)

Compatibility-only one-call facade over canonical prepareAgentUpdates/commitAgentUpdates. @ownership Borrows input for the call. @thread Owner thread. @reentrancy No callbacks. @cost Allocates/copies and sorts per batch; new transaction consumers prepare once before publication.

在文件 CrowdBatch.cpp 第 42 行定义.

引用了 commitAgentUpdates(), eve::Result< T >::failure() , 以及 prepareAgentUpdates().

友元及相关函数文档

◆ exposeNavigationRequests

void exposeNavigationRequests ( ssq::Class &  cls)
friend

Register generation-qualified transient navigation request bindings.

在文件 CrowdNavigationBindings.cpp 第 73 行定义.

◆ resolveFlowRequestLease

Result< FlowLease > resolveFlowRequestLease ( Crowd &  crowd,
const ssq::Table &  token 
)
friend

Resolve a checked request-owned lease without retaining script table references.

返回
Owning pin copy or structured invalid/stale failure. @ownership Copies only the lease. @thread Owner thread. @reentrancy No callbacks.

在文件 CrowdNavigationBindings.cpp 第 61 行定义.


该类的文档由以下文件生成: