ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.

Build Anywhere Bug

From ModEnc
Revision as of 12:11, 11 July 2023 by Crimsonum (talk | contribs) (Added some examples.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This rare yet severe bug has a myriad of symptoms, including:

  • Buildings can be placed anywhere within the build radius, on any terrain, even on top of other objects. This is perhaps the most obvious and immediate symptom, hence the bug is named after this.
  • Buildup animations stop working - buildings are erected instantly (although if sold, the reverse buildup anim still plays)
  • AI vehicles will exit the factory through any direction (not just through the door).
  • On some buildings when built, the animations are layered incorrectly.
  • The AI becomes unable to build any new buildings, only rebuild lost ones.
  • The AI may deploy units directly on the factory bib, causing production to get stuck.
  • FreeUnit stops working.
  • Units can cross the visible edge of the map, but they get deleted when doing so.

and more.

Examples

Cause

This bug is caused when an AI aggressive armed transport team is attacked while moving over a high bridge.

Technical Explanation

This bug is caused by failure to reset ScenarioInit, a mutual exclusion (mutex) lockcount for low-level actions. Normally, when the game has to perform certain actions, it temporarily increments this lockcount to bypass normal gameplay checks, then decrements/resets it after the action is performed.

When an aggressive AI team includes an armed transport (vehicle or aircraft) loaded with passengers, if the transport is attacked by an enemy, it will attempt to unload its passengers. If that transport is engaged while moving over a high bridge, this action fails, as transports cannot unload while on the high bridge overlay. Because the unload action fails, the passengers are stuck in a sort of limbo, and ScenarioInit is increased to allow them to return to the the transport (to the player it appears as if the passengers never exited the transport). At this point the game forgets to reset ScenarioInit, causing it to go haywire.

Solution

Make sure transport teams have Aggressive=no. Suicide=yes is also recommended. Alternatively, use transports with no weapons.