Skip to content

crash fixes of tiberium spread & grow in long games and a new tag - #2400

Open
FS-21 wants to merge 3 commits into
Phobos-developers:developfrom
FS-21:feature/tiberium-crashfixes-and-ramps-expansion-support
Open

crash fixes of tiberium spread & grow in long games and a new tag#2400
FS-21 wants to merge 3 commits into
Phobos-developers:developfrom
FS-21:feature/tiberium-crashfixes-and-ramps-expansion-support

Conversation

@FS-21

@FS-21 FS-21 commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

What kind of change is this?

  • New feature, vanilla bugfix or enhancement of a released feature - changelog, docs and credits entries are needed.
  • Improvement to a new (unreleased) feature - docs and credits entries are needed; no changelog entry (Skip Changelog).
  • Bugfix to a new (unreleased) feature - credits entry is needed; no changelog or docs entries (Skip Changelog, Skip Docs).
  • Bugfix to an old (released) feature - changelog and credits entries are needed; no docs entry (Skip Docs).
  • Completely minor change (e.g. a typo fix) - no entries are needed (Skip Changelog, Skip Docs, Skip Credits).

Description (all the technical explanation of the problems & vanilla crashes is done with AI, I already made tests and the crashes when the tiberium spreaded a lot in the map is gone, finally).

This PR fixes two longstanding vanilla engine issues with Tiberium growth/spread queues, and introduces an opt-in flag to allow resources to expand onto slopes/ramps.

1. Long-game Heap Overflow Crash (0x005657A5 / 0x00723005)

  • In matches with active Tiberium spread on large maps, GrowthLogic and SpreadLogic eventually overflow their preallocated PriorityQueueClassNode buffers (PriorityQueueClassNode::SurfaceDataCount()), corrupting heap headers and crashing the game.
  • Added capacity safety checks and proactive queue re-indexing before buffer boundaries are breached (0x7235CE, 0x722B48, 0x722586, 0x72302E).

2. Tiberium Growth / Spread Queue Stall

  • When a queued cell fails to spread/grow (e.g. due to temporary blocking or invalid neighbor tiles), Westwood popped the cell from the priority queue but forgot to reset CellIndexesWithTiberium[surfaceIdx] = false.
  • This permanently marked the cell as "already queued", preventing subsequent passes and eventually freezing resource expansion map-wide. Properly cleared at 0x722574.

3. Ramp Expansion Support (AllowRamps)

  • In vanilla, several hardcoded checks actively prevented Tiberium on slopes:
    • CellClass::RecalcAttributes (0x0047D36E) forcibly wiped OverlayTypeIndex = -1 and OverlayData = 0 whenever SlopeIndex != 0.
    • CellClass::Can_Tiberium_Germinate checked IsometricTileTypeClass->AllowTiberium, which is false for ramp tiles across all theater INIs.
    • Slope checks in Can_Tiberium_Grow, Can_Tiberium_Spread, Spread_Tiberium, and Increase_Tiberium rejected slope indices.
    • Draw_Overlay and GetContainingRect could divide by zero when slope overlays were rendered without initialized slope counts.
  • AllowRamps=yes under individual Tiberium sections allows cardinal ramps (slopes 1..4) to germinate, grow through stages, and spread naturally to/from ramp cells, setting NumSlopes = 8 and adding division-by-zero guards.

In rulesmd.ini:

[SOMEORE]        ; Tiberium
AllowRamps=false ; boolean

- Fix long-game heap overflow crash in Tiberium growth priority queue
- Prevent Tiberium expansion queue stalls with proactive compaction
- Support Tiberium spread, growth, and germination onto cardinal ramps via AllowRamps
- Fix division by zero crashes when rendering Tiberium overlays on slopes
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@Coronia
Coronia requested a review from NetsuNegi September 10, 2026 03:46
@Coronia Coronia mentioned this pull request Sep 10, 2026
6 tasks
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.

1 participant