(Let “passive” means Tech with Research Location=-1, and Game will automatically activates it if dependencies are met, and without user input)
The Problem:
- Some Tech Effects cannot be applied during early stage of game start, and they must be deferred.
e.g. read/write Resource.32 (Population Cap); Apply “Spawng Unit”; – cannot be applied in TechTree or other “passive” Techs with already satisfied dependencies. - Since Resource/Attribute modification is not fully fledged scripting or expressions, sometimes ordering between TechEffects is wanted. (e.g. to resolve not-commutative operations)
As as result, triggering events (as Tech dependencies) are necessary to ensure that Tech Effects are applied at the correct time, or in correct order.
However now it is overwhelming tricky (if possible) to setup a Tech that activates both “deferred” and automatically. (and probably impossible to ensure order)
Proposal:
Introduce triggering Techs as “init stage event callback” to ensure TechEffects are applied at correct timing or order during game start.
- Add hardcoded Resource values: [Triggering_Tech_For_InitEvent_XXXX] = “TechID of the triggering Tech”
Or further extend “Full Tech Mode” to register any number of Techs as “callback” for each initialization stage. - Set the triggering Tech as researched on the specific initialization stage, ignoring all dependencies.
- (Ensuring triggering Tech disabled might be unnecessary, because Techs can be disabled by adding dependencies to itself)
At least two events are needed, but more events are always better:
- One event for “before Starting Age”, which should be fired after game applies TechTree/TeamBonus/initial “passive” Techs, and before game applies “Starting Age”.
This event is can be used to “finalize” passive bonuses and ensuring TechEffects’ math order. - One event for “after Game start”, when every Resource or TechEffect is expected to be ready.
(I don’t know the order of above two events because it is difficult to measure now, but it does not matter as long as the order is consistent)
Notes:
Building’s “Initiate Technology” does not meet the requirement because:
- It requires a specific Building. (cannot be for Nomad etc.)
- A triggering Tech when the game applies “Starting Age” is useful, which cannot be simulated by “Initiate Technology”.
- If the “Initiate Technology” has no deps, or its deps is satisfied at begining, the behavior is really surprising.
Apparently Game does not keep it disabled until Building built, but activates it early because its deps are already satisfied.
The “Initiate Technology” behavior is really surprising. (Pompeii mode)
(Tech activation is counted by updating Villager’s attack/armor/etc.)
- (Method A) If TownCenter.InitiateTechnology = TechA:
TechA is activated 1 times.- (Method B) If TownCenter.AnnexUnit[0] = BuildingB; BuildingB.HP = -1, BuildingB.InitiateTechnology = TechB:
(in short, trigger Initiate Technology by dying annex unit)
- TechB is activated 2 times at game start: 1st time early, 2nd time deferred (Spawning Unit is possible).
- TechB is infinitely repeatable (re-activate every-time when a Town Center is built).
- If TechB.ResearchTime > 0, it is triggered once, but no longer deferred…
- (Method C) If TownCenter.AnnexUnit[0] = BuildingC1; BuildingC1.HP=-1, BuildingC1.DeadUnit=UnitC2; UnitC2 is decayable (set resource and decay rate), UnitC2.DeatUnit = BuildingC3; BuildingC3.InitiateTechnology = TechC:
(in short, a dying and decaying annex, (after decay) spawns another dying unit to trigger Initiate Technology)
- TechC is activated 2 times – 1 time at game start, and 2nd time deferred.
- TechC is infinitely repeatable (re-activate every-time after a Town Center is built).
- If TechC.ResearchTime > 0, it is triggered once, and deferred.
- In case of Method B/C, TechB/C does not work reliably as a deps: it often fails to activate other Techs depending on it (it seems to work as deps only when it is the last unsolved deps)
I don’t know if this behavior is expected or not, but the proposal will not break Initiate Technology’s compatibility.
(Initiate Technology’s repeating behavior could be useful, but I would guess that no one wants the extra duplicated activation during game start.)
Current Partial Workaround:
NA.
From what I experimented, it seems impossible to implement it in Rome mode.
@Felizon89 @StepS7578
Could you please took a look? Thanks a lot.
(I thought it should be easy to implement and does not break existing things.)