feat!: RunicNPC v1.0.0, edge → main (runicnpc 9e step 3, merge 1 of 3) #19

Merged
whitlocktech merged 39 commits from edge into main 2026-10-09 07:20:03 +00:00
Showing only changes of commit b5e7ecc4ed - Show all commits

View File

@@ -3661,9 +3661,11 @@ namespace Oxide.Plugins
#region The cost warning (D227)
/// <summary>
/// What <paramref name="total"/> 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 <paramref name="total"/> 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.
/// </summary>
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.";
}