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
Epic: #64 (AffinityEngine)
Depends on: #72 (SpatialIndex snapshot_entities)
What
Modify
ClusterManager::run_evaluation_cycle()incrates/arcane-infra/src/cluster_manager.rsto populateWorldStateView.playersandClusterInfo.player_idsfrom the spatial index.Current state (lines 87-92)
After
self.spatial_index.snapshot_entities()to get entity dataPlayerInfofor each entity (position via X/Z mapping, velocity=0, guild/party=None)ClusterInfo.player_idsper clusterplayerstoWorldStateViewNotes
velocitywill beVec2::new(0.0, 0.0)— SpatialIndex doesn't track velocityguild_idandparty_idwill beNone— requires SpacetimeDB integration (not in scope)playersfield, so this is backward-compatibleAcceptance criteria
WorldStateView.playersis populated with entity dataClusterInfo.player_idsis populated per clustercargo test --workspacepassesSpec
See
arcane-enginerepo:in_08_00_integration_report.md§2.5