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

Secret Lab System

From ModEnc
Jump to: navigation, search

The "Secret Lab" logic was introduced in Yuri's Revenge : when you captured a building, you gained the ability to build a semi-random object you otherwise couldn't. However nicely this sounded, the logic is dreadfully screwed up.

How it works

Needs Transcribing
Pseudocode relevant to this article is available at Please update this article with information revealed by the pseudocode.

  1. At map load time:
    1. The engine enumerates all the buildings with SecretLab=yes present on the map.
    2. The engine constructs a single list from objects specified in [General]SecretInfantry, [General]SecretUnits and [General]SecretBuildings and using pseudorandomness assigns each building one of the objects on this list. Note: this step only happens if the map contains less Secret Labs than potential bonuses.
  2. During gameplay:
    1. Each frame the game asks each of those SecretLab=yes buildings what object they can build.
      1. If the building has SecretInfantry, SecretUnit or SecretBuilding specified, it will report that it can build that, in that order (if SecretInfantry is set, it is reported, otherwise it falls back to SecretUnit and then to SecretBuilding).
      2. Otherwise, the building will report that it can build the object assigned to it by the pseudo-random process in step 1.
    2. The Rules(md).ini does contain a SecretHouses flag, which is parsed, but entirely unused.


The process has quite a few drawbacks:

  1. The bonus you get is determined at map load time rather than at building capture/acquisition time:
    1. A captures lab -> B captures lab -> A recaptures lab -> D captures lab : All get the same object.
    2. Libya captures lab -> gets Grand Cannon as bonus. France captures that same lab -> gets Grand Cannon which it already could build.
    3. You cannot have a buildable lab (well, technically SecretInfantry/Unit/Building on the lab itself will be granted, but that part is completely unrandomized, so it behaves like any run-of-the-mill prerequisite building).
  2. If you place more labs on the map than there are choices for bonuses, none of the labs will give any bonuses at all.
  3. You cannot define multiple labs with varying bonuses - all secret labs pick pseudorandom bonuses from the same pool of choices.
  4. The code for random bonus assignment is terribly quirky and not at all random: The closer an object is to the beginning of the combined bonus list, the more chances it has to be picked. For example, the very last object in the combined list will either be granted by the very first Secret Lab on the map (first in the [Structures] section of the map) or not at all.

See Also