You are viewing a potentially older version of this package. View all versions.
WUYACHIYU-WhySoLaggy-1.0.0 icon

WhySoLaggy

Find which mod causes lag. FPS tracking, plugin timing, patch profiling, and experimental room-bombing detection.

Date uploaded 3 months ago
Version 1.0.0
Download link WUYACHIYU-WhySoLaggy-1.0.0.zip
Downloads 132
Dependency string WUYACHIYU-WhySoLaggy-1.0.0

This mod requires the following mods to function

BepInEx-BepInExPack_PEAK-5.4.2403 icon
BepInEx-BepInExPack_PEAK

BepInEx pack for PEAK. Preconfigured and ready to use.

Preferred version: 5.4.2403

README

WhySoLaggy

A performance profiling and network abuse detection mod for PEAK. Identifies which mods and patched methods cause lag, tracks FPS spikes in real time, and monitors suspicious network activity that may indicate room bombing.

All output goes to dedicated log files in the BepInEx folder — never pollutes the game's own log.

Features

Performance Profiling (Tested & Verified)

FPS Tracker

  • Continuous frame-time monitoring with a 600-frame rolling window
  • Instant spike detection: any frame exceeding the configurable threshold (default 50 ms) is flagged
  • Periodic summary: average / min / max FPS and spike count

Plugin Profiler

  • Measures every loaded BepInEx plugin's Update / LateUpdate / FixedUpdate callback time
  • Dynamically injects timing via Harmony — no manual setup required
  • Per-plugin per-frame average cost, with ! / !!! warnings for heavy hitters
  • Spike-frame detail: when a frame lags, instantly shows which plugin(s) consumed the most time

Patch Profiler

  • Scans all Harmony-patched game methods and wraps them with timing hooks
  • Maps each method back to its owning mod via Patches.Owners
  • Top-N slowest methods report (configurable, default 10)
  • Spike-frame detail: top 5 slowest methods with their owner mod IDs

Network Abuse Detection (Experimental — Not Yet Tested)

Note: This feature hooks into Photon networking calls to detect potential room bombing. It has not been tested in a live environment and its effectiveness is uncertain. Use it as an early-warning tool and please report any false positives or issues.

Instantiate / Destroy Flood

  • Monitors PhotonNetwork.Instantiate and PhotonNetwork.Destroy call rates
  • Alerts when rate exceeds threshold (default: 15 instantiates/s, 20 destroys/s)
  • Logs top spawned prefab names and source players

RPC Flood

  • Monitors PhotonView.RPC call rates
  • Alerts when rate exceeds threshold (default: 50 RPCs/s)
  • Logs top RPC source players

Object Spike

  • Periodically counts PhotonView and MushroomZombie objects in the scene
  • Alerts when count increases sharply (default: +30 in one check interval)
  • Investigates PhotonView owner distribution on spike

Periodic Report (every 30 s)

  • Room info, object counts, cumulative rates, alert count, top prefabs, player list

Log Files

File Content
BepInEx/WhySoLaggy.log FPS reports, plugin timing, patch timing, spike details
BepInEx/WhySoLaggy_Abuse.log Network abuse alerts, object spike warnings, periodic abuse reports

Both files are overwritten on each game launch. Timestamps are in HH:mm:ss.fff format.

Config (ModConfig / BepInEx cfg)

General — Performance Profiling

Setting Default Description
SpikeThresholdMs 50 Frame time (ms) above which a spike is logged (16–200)
ReportIntervalSeconds 10 Seconds between periodic performance reports (5–60)
EnablePluginProfiling true Profile each BepInEx plugin's Update callbacks
EnablePatchProfiling true Profile all Harmony-patched game methods
TopMethodCount 10 Number of top slow methods in reports (3–30)

AbuseDetection — Network Monitoring

Setting Default Description
EnableAbuseDetection true Master switch for abuse detection
CheckIntervalSeconds 1.0 Seconds between rate checks (0.5–5)
ReportIntervalSeconds 30.0 Seconds between periodic abuse reports (10–120)
InstantiateRateThreshold 15 Instantiate calls/s to trigger alert (5–100)
DestroyRateThreshold 20 Destroy calls/s to trigger alert (5–100)
RpcRateThreshold 50 RPC calls/s to trigger alert (10–200)
ObjectSpikeThreshold 30 Object count increase per check to trigger alert (5–100)

Installation

  1. Install BepInExPack PEAK
  2. Place WhySoLaggy.dll into PEAK/BepInEx/plugins/

No other mod dependencies required.

Package Contents

  • WhySoLaggy.dll

Contact

  • Author: 乌鸦吃鱼
  • QQ Group: 1093172647

Notes

  • WhySoLaggy waits 5 seconds after game launch before activating profiling, to let all plugins finish loading
  • The mod automatically skips timing its own Harmony patches to avoid self-measurement noise
  • Performance profiling (plugin timing, patch timing, FPS tracking) has been tested and works reliably for diagnosing which mod causes lag — especially useful when multiple mods are installed simultaneously
  • Abuse detection is experimental: it hooks Photon network calls but has not been validated against actual room-bombing scenarios; thresholds may need tuning
  • All profiling overhead is minimal by design (Stopwatch-based, no allocations in hot paths)

CHANGELOG

Changelog

[1.0.3] - 2026-04-26

⚠ Testing status — client-side only. Every 1.0.3 feature in this changelog was exercised from a non-host (client) install. A subset of the new diagnostics can only do real work when the install is on the Master Client — specifically:

  • OnRemoteRpcEvent Hashtable unpack (capturing real client-side RPC senders after Master relay)
  • Master-side Instantiate requester correlation (SuspectedRequesterActor/Name/Rpc)
  • PhotonView Ownership audit (EventCode 210/211/215)
  • Actor×Method hotspot detector

These Master-only paths compile cleanly and self-check, but have not yet been validated in an actual hosted session. Expect potential edge-case bugs there until a host-side capture is recorded. Client-side features (FPS / RPC monitor / Instantiate rate / FieldProbe etc.) are unaffected.

Quiet-by-default

  • EnablePluginProfiling / EnablePatchProfiling default changed to false — profilers are opt-in now
  • LogVerbosity default changed to Minimal — text logs only carry abuse alerts; CSV/JSONL still capture everything
  • Fix: abuse alerts now bypass the verbosity filter, so Minimal = "alerts only, but definitely alerts"
  • Fix: removed orphan continuation lines when a report header was filtered but its follow-up lines weren't

New features

  • Structured logging: whysolaggy_data.csv (58 cols) + whysolaggy_events.jsonl, auto-rotated at MaxLogFileSizeMB
  • Startup Harmony conflict scan: harmony_patches.csv + alerts when the same method is patched by multiple mods
  • Opt-in method stack tracer ([MethodTracer]): name methods, get filtered call stacks per hit
  • FieldProbe: JSON-driven reflective snapshots of any field / parameter / return value at any method
  • On-screen dashboard (opt-in): live FPS, frame time, GC KB/s, watched-RPC summary, last abuse alert
  • GC allocation rate + Photon ping are attached to FPS / periodic reports
  • InstantiateTrace: every PhotonNetwork.Instantiate captures a filtered caller stack (3 samples per prefab + 1 per 5s window, auto-forced on flood) — finally answers "which script / mod is spawning this?"
  • Watched-method library expanded from 27 to 65+ RPC names across feeding / healing / status / death / revive / grab-kick-carry / inventory / prefab spawn / end-game / ownership / tornado / campfire
  • Master-side Relay Diagnostics (beta, Master-only): RemoteRpcTrace unpacks EventCode=200 Hashtable to recover the real client sender; Instantiate rows gain SuspectedRequesterActor/Name/Rpc/AgeMs; OwnershipChange decodes EventCode 210/211/215; OwnershipGrab and ActorMethodHotspot alarms layer on top

Performance & robustness

  • PatchProfiler throttling via MinReportMs — ~70–90% lower self-overhead on busy scenes
  • IgnorePluginGuids / IgnorePatchMethods / ExtraWatchMethods config keys
  • RPC hot path moved fully to main-thread pump (ConcurrentQueue + PumpBatchSize)
  • Lower GC pressure across all periodic report paths; better exception reporting; null-safe patch hooks

Docs

  • README: new Real-world case section with redacted dual-client lantern lit-sync + warmth diagnostics, pulled straight from a live session ([LitSync] / [HuddleWarmth] / [FuelMath] / [WARMTH_LOG] / BugleRestore)
  • README: reworked How to analyse the logs into a tag-first workflow — grep/jq by tag now recommended, CSV pivot second, AI third (with "curate the slice first" recipe), plain-text reading fourth
  • README: added six copy-paste commands (3 PowerShell Select-String, 3 jq) covering abuse alerts, lit-sync, failed warmth ticks, top RPC senders, FieldProbe hits, frame spikes

Upgrade note: BepInEx only applies new defaults to missing keys. Delete com.wuyachiyu.WhySoLaggy.cfg or flip the three keys manually to pick up the quieter defaults.

[1.0.2] - 2026-04-23

  • Full RPC monitor hooks PhotonNetwork.ExecuteRpc; counts calls, senders and payload bytes
  • Feeding-chain tracing: SendFeedDataRPC → RemoveFeedDataRPC → GetFedItemRPC → Consume
  • 27 watched high-risk methods record sender / target / parsed args / payload size
  • Per-method 32-entry ring buffer so floods can't drown out rare events
  • Abuse alerts now include the current top RPC methods
  • Hot path <500ns per RPC, no allocs, no locks

[1.0.1] - 2026-04-20

  • Room-bombing detection now correctly identifies the remote suspect
  • Real-time on-screen alert banner (auto-fades after 12s), auto EN/中 based on system locale
  • Fixed wrong attribution to the local player; fixed a thread-safety crash

[1.0.0] - 2026-04-07

  • Initial release: FPS tracker, plugin / patch profilers, room-bombing detection, dual text logs