From b5e7ecc4ed580f7843361c956696c3064b9c543c Mon Sep 17 00:00:00 2001 From: wtclaude Date: Tue, 6 Oct 2026 21:33:49 -0500 Subject: [PATCH] feat: the cost warning says what stage 9 measured (D306) Stage 9 measured the released NPC on both frameworks (6000 map): about 3 ms of median frame per 100 idle while a player keeps them awake, 0.5 ms once they sleep with nobody near, and 9 ms per 100 fighting, with each NPC reacting about every 3 s under Rust's shared AI budget. The warning now says idle twice (awake and asleep) and uses those figures, the worst of the two rigs rounded up. The awake-idle overhead over the bare swap is runicnpc-rust#13. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01E14m6SuuY6i1vASFeGDBeY --- plugin/RunicNPC.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/plugin/RunicNPC.cs b/plugin/RunicNPC.cs index f01c51e..c406d32 100644 --- a/plugin/RunicNPC.cs +++ b/plugin/RunicNPC.cs @@ -3661,9 +3661,11 @@ namespace Oxide.Plugins #region The cost warning (D227) /// - /// What NPCs cost the server, from stage 1's measurements on both - /// frameworks (PLAN.md §9, stage 1, Q5). The rig ran about 50 fps empty, so the warning - /// says what NPCs ADD to a frame, not an fps. + /// What NPCs cost the server, from stage 9's measurements of the + /// released NPC on both frameworks (PLAN.md §9, stage 9, D306; stage 1, Q5, first): the worst + /// of the two rigs, rounded up. Idle is said twice, because an NPC with no player within its + /// sleep distance sleeps (D235) and costs a sixth of an awake one. The warning says what NPCs + /// ADD to a frame, not an fps, since a server's own frame time varies far more than that. /// private static string CostWarning(int total) { @@ -3672,9 +3674,10 @@ namespace Oxide.Plugins float hundreds = total / 100f; string estimate = total > 100 ? " (measured up to 100; beyond that this is an estimate)" : ""; return $"RunicNPC: {total} NPC(s) on this server{estimate}. Measured on a test server, they add about " + - $"{Mathf.Max(0.1f, hundreds * 1.5f):0.#} ms to every server frame while idle. If all fight at once they add about " + - $"{hundreds * 5f:0.#} ms, and Rust's shared 2 ms AI budget then lets each react only every " + - $"{Mathf.Max(0.3f, hundreds * 2.5f):0.#} s. Fighting other NPCs (a faction setting) was measured to cost about " + + $"{Mathf.Max(0.1f, hundreds * 3f):0.#} ms to every server frame while idle with a player near enough to wake them, " + + $"and about {Mathf.Max(0.1f, hundreds * 0.5f):0.#} ms once they sleep with nobody near. If all fight at once they add about " + + $"{hundreds * 9f:0.#} ms, and Rust's shared 2 ms AI budget then lets each react only every " + + $"{Mathf.Max(0.3f, hundreds * 3f):0.#} s. Fighting other NPCs (a faction setting) was measured to cost about " + $"what fighting players does; on a map whose own AI is busy, each then reacts only every " + $"{Mathf.Max(0.5f, hundreds * 7f):0.#} s."; }