LearnNewsExamplesServices
Frontmatter
id8676
titleFix Cluster Drift Bias & Boundaries
stateClosed
labels
bugaiperformance
assigneestobiu
createdAtJan 15, 2026, 4:29 AM
updatedAtJan 15, 2026, 9:37 AM
githubUrlhttps://github.com/neomjs/neo/issues/8676
authortobiu
commentsCount1
parentIssue8661
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJan 15, 2026, 9:37 AM

Fix Cluster Drift Bias & Boundaries

Closed v11.22.0 bugaiperformance
tobiu
tobiu commented on Jan 15, 2026, 4:29 AM

Objective

Fix the "Top-Left Drift" bias and constrain the Swarm to the viewport center.

Issues

  1. Drift Bias: The Flow Field or Ambient Drift calculations likely accumulate rounding errors or have a directional bias (negative coordinates?), causing the swarm to migrate off-screen over time.
  2. Unreachable Nodes: Once nodes drift into corners, the "Force Push" (Shockwave) cannot bring them back because the user can't click outside the viewport.

Tasks

  1. Debug Flow Field: Visualize or audit the vector field to ensure it is centered (0,0 is center of rotation).
  2. Implement "Containment Field": Add a physics force that gently pushes all nodes towards the center if they exceed a certain radius (e.g., 70% of screen width).
    • Force should be exponential: weak near center, strong near edges.
  3. Dynamic Padding: Calculate bounds based on screen size to ensure the swarm looks good on mobile vs desktop.
tobiu assigned to @tobiu on Jan 15, 2026, 4:29 AM
tobiu added the bug label on Jan 15, 2026, 4:29 AM
tobiu added the ai label on Jan 15, 2026, 4:29 AM
tobiu added the performance label on Jan 15, 2026, 4:29 AM
tobiu added parent issue #8661 on Jan 15, 2026, 4:29 AM
tobiu referenced in commit 1f77ea2 - "fix: Implement containment field to correct Neural Swarm drift (#8676)" on Jan 15, 2026, 9:37 AM
tobiu
tobiu Jan 15, 2026, 9:37 AM

Input from Gemini 3 Pro:

✦ Implemented a "Containment Field" in updatePhysics.

  • Logic: Calculates distance from center (cx, cy). If dist > min(w,h) * 0.4, applies a soft restoring force (dist - limit) * 0.001 towards the center.
  • Target: Applied to Parent nodes (Children follow parents via existing cohesion).
  • Outcome: Fixes the "Top-Left Drift" and prevents nodes from getting stuck in corners while maintaining organic flow.
tobiu closed this issue on Jan 15, 2026, 9:37 AM