Skip to content

Populate WorldStateView.players in ClusterManager #73

@rebelmachina

Description

@rebelmachina

Epic: #64 (AffinityEngine)
Depends on: #72 (SpatialIndex snapshot_entities)

What

Modify ClusterManager::run_evaluation_cycle() in crates/arcane-infra/src/cluster_manager.rs to populate WorldStateView.players and ClusterInfo.player_ids from the spatial index.

Current state (lines 87-92)

let view = WorldStateView {
    timestamp: 0.0,
    evaluation_budget_ms: 50,
    clusters,
    players: vec![],    // ← always empty
};

After

  • Call self.spatial_index.snapshot_entities() to get entity data
  • Build PlayerInfo for each entity (position via X/Z mapping, velocity=0, guild/party=None)
  • Populate ClusterInfo.player_ids per cluster
  • Pass populated players to WorldStateView

Notes

  • velocity will be Vec2::new(0.0, 0.0) — SpatialIndex doesn't track velocity
  • guild_id and party_id will be None — requires SpacetimeDB integration (not in scope)
  • X/Z position mapping matches existing centroid mapping on line 82
  • RulesEngine ignores players field, so this is backward-compatible

Acceptance criteria

  • WorldStateView.players is populated with entity data
  • ClusterInfo.player_ids is populated per cluster
  • cargo test --workspace passes
  • RulesEngine behavior is unchanged

Spec

See arcane-engine repo: in_08_00_integration_report.md §2.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions