Skip to content

Fix non-deterministic cell death in preview mode by resetting lastUpdate on load#566

Merged
chrxh merged 4 commits intofeatures/CreatureCheckfrom
copilot/fix-cell-state-dying-preview
Mar 21, 2026
Merged

Fix non-deterministic cell death in preview mode by resetting lastUpdate on load#566
chrxh merged 4 commits intofeatures/CreatureCheckfrom
copilot/fix-cell-state-dying-preview

Conversation

Copy link
Contributor

Copilot AI commented Mar 21, 2026

Cached phenotype data carries non-zero lastUpdate values from previous preview runs. Combined with arbitrary _currentTimestep % 100 alignment relative to the head update cycle, cells can accumulate lastUpdate > 201 before receiving a head update propagation, triggering CellState_Dying at CellProcessor.cuh:143. The non-determinism stems from variable timestep phase and frame-dependent cache extraction timing.

Changes

  • EngineWorker::setPreviewData: Reset lastUpdate = 0 for all cell objects in the TO before GPU upload, ensuring 202 timesteps of headroom for head update propagation regardless of cached state
  • DataTransferTests.objectsWithEmptyGenomes_preview: Adjust expected lastUpdate to 0 in preview roundtrip comparison, reflecting the intentional reset
auto numObjects = *dataTO.numObjects;
for (uint64_t i = 0; i < numObjects; ++i) {
    if (dataTO.objects[i].type == ObjectType_Cell) {
        dataTO.objects[i].typeData.cell.lastUpdate = 0;
    }
}

⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI self-assigned this Mar 21, 2026
Copilot AI changed the title [WIP] Fix incomplete creature preview in simulation mode Fix non-deterministic cell death in preview mode by resetting lastUpdate on load Mar 21, 2026
Copilot AI requested a review from chrxh March 21, 2026 22:01
@chrxh chrxh marked this pull request as ready for review March 21, 2026 22:05
@chrxh chrxh merged commit e96170e into features/CreatureCheck Mar 21, 2026
@chrxh chrxh deleted the copilot/fix-cell-state-dying-preview branch March 21, 2026 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants