ModEnc is currently in Maintenance Mode: Changes could occur at any given moment, without advance warning.
Secret Lab System
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
- At map load time:
- The engine enumerates all the buildings with SecretLab=yes present on the map.
- 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.
- During gameplay:
- Each frame the game asks each of those SecretLab=yes buildings what object they can build.
- 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).
- Otherwise, the building will report that it can build the object assigned to it by the pseudo-random process in step 1.
- The Rules(md).ini does contain a SecretHouses flag, which is parsed, but entirely unused.
- Each frame the game asks each of those SecretLab=yes buildings what object they can build.
Drawbacks
The process has quite a few drawbacks:
- The bonus you get is determined at map load time rather than at building capture/acquisition time:
- A captures lab -> B captures lab -> A recaptures lab -> D captures lab : All get the same object.
- Libya captures lab -> gets Grand Cannon as bonus. France captures that same lab -> gets Grand Cannon which it already could build.
- 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).
- If you place more labs on the map than there are choices for bonuses, none of the labs will give any bonuses at all.
- You cannot define multiple labs with varying bonuses - all secret labs pick pseudorandom bonuses from the same pool of choices.
- 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.