Skip to content

Detection and Compatibility

Tsu edited this page Jun 5, 2026 · 2 revisions

This page covers how other mods should detect Stratum and what Stratum is doing to stay compatible with other code.

Source of Truth

  • Identity keys set in sources/VintagestoryLib/Vintagestory.Server/ServerSystemStratum.cs
  • Runtime/config entry points in sources/VintagestoryLib/Vintagestory.Server/StratumRuntime.cs and StratumConfig.cs
  • Compatibility-sensitive behavior in patches/ and runtime helpers under sources/VintagestoryLib/Vintagestory.Server/

Detecting Stratum

Use World.Config keys:

  • api.World.Config.GetAsBool("stratum")
  • api.World.Config.GetAsString("stratumVersion")
  • api.World.Config.GetAsString("stratumBaseGameVersion")

These are available to both server and client mods because they are written during server startup.

ServerSystemStratum.OnBeginRunGame stamps those values into World.Config:

server.World.Config.SetBool(StratumInfo.Id, true);
server.World.Config.SetString(StratumInfo.Id + "Version", StratumInfo.Version);
server.World.Config.SetString(StratumInfo.Id + "BaseGameVersion", StratumInfo.BaseGameVersion);

Runtime Layout

Stratum behavior is split across:

  • config models in StratumConfig
  • startup/runtime wiring in StratumRuntime and ServerSystemStratum
  • source patches under patches/
  • focused helpers like StratumPacketLimiter, StratumPacketBackPressure, StratumBlockBreakGuard, StratumPlayerPrivacy, and StratumNametags

Detection should use World.Config keys above, not internal type checks.

Version Checks

If behavior or types do not match expectations, verify client/server binary alignment first.

Example checks:

  • base game version vs stratumBaseGameVersion
  • deployed DLL versions/hashes on both sides

Compatibility Guidance

When integrating other mods with Stratum:

  • gate optional behavior behind api.World.Config.GetAsBool("stratum")
  • use stratumVersion for version-aware behavior toggles
  • avoid relying on internal Stratum classes unless you control both server and mod deployment

Related References

Clone this wiki locally