Multiplayer icon indicating copy to clipboard operation
Multiplayer copied to clipboard

Scenarios are incorrectly handled in Multifaction

Open SokyranTheDragon opened this issue 3 months ago • 0 comments

Scenarios aren't handled on a per-faction basis, and as such the scenario data (besides starting data, like starting items) will be shared between all players.

Example of features that won't work properly, since they are tied to a scenario:

  • Automatic activation of the monolith (The Anomaly scenario)
  • Guaranteed ghoul drop pod (The Anomaly scenario)
  • Guaranteed any incident (custom scenarios)
  • Pursuing mechanoids (The Gravship scenario)
  • Disabled mechanoid signal quest (The Gravship Scenario)
  • Disabled any quest (custom scenarios)
  • Other ScenParts added by different mods

Long story short, since all the players will share the same scenario, it'll either disable specific ScenParts for players with specific scenarios, or force everyone else to be affected by them. Possibly it could break some other stuff instead.

The fix would require:

  • Add Scenario as a field in FactionWorldData, and save/load it (expose data)
  • Modify the faction creation to use the FactionWorldData for storing the scenario
  • Use FactionRepeater to make repeat all the relevant Scenario code for each player faction
    • For example, Scenario:TickScenario
  • Make sure only the relevant factions have their Scenario code called by using Push/PopFaction methods
    • For example, Scenario:GetStatFactor is called from StatWorker - we need to make sure it's called only by relevant faction, or all factions will be affected by those stat factors
  • Consider how to handle other methods that are even less obvious on how to handle them
    • For example, Pawn:Notify_PawnDied is used by ScenPart_OnPawnDeathExplode - do we want to only apply it to pawns of relevant faction? On all pawns that are on the map owned by such a faction? Both?

SokyranTheDragon avatar Sep 05 '25 22:09 SokyranTheDragon