Cost and caps
RunicNPC has no caps by default. Instead, everything that adds NPCs answers with what the
server’s RunicNPC NPCs will then cost: /rnpc place, the site’s
placements screen, an event’s Place NPCs step, the API’s
RunicNpc_CostWarning, and the end of rnpc.status. A server’s owner knows their hardware and
their players; a number someone else picked would be wrong for most of them.
The cost warning
Section titled “The cost warning”It reads like this:
RunicNPC: 100 NPC(s) on this server. Measured on a test server, they add about 3 ms to everyserver frame while idle with a player near enough to wake them, and about 0.5 ms once they sleepwith nobody near. If all fight at once they add about 9 ms, and Rust's shared 2 ms AI budget thenlets each react only every 3 s. …What it means:
- Idle NPCs are cheap, and sleeping ones cheaper. NPCs that stand, wander or patrol with nobody to fight add a little to a frame. One with no player within its sleep distance — 160 m unless its profile says otherwise — walks home and sleeps, and then costs about a sixth of what it did awake.
- Fighting NPCs hit Rust’s AI budget before the frame rate. All of Rust’s human NPCs, its own
scientists included, share one AI budget of 2 ms a frame (
aithinkmanager.framebudgetms). With many fighting at once, each reacts less often. The server stays smooth, and the NPCs get slower to react. - Fighting other NPCs costs about what fighting players does. That is a faction setting, and off unless a profile opts in. On a map whose own AI is busy, each then reacts less often still; the warning says by how much once any profile fights NPCs.
Where the figures come from
Section titled “Where the figures come from”They are measured, not guessed: 100 of the released NPC on both frameworks, on a 6000 map, as what they add to the median server frame of the same session’s empty server. Beside them is Rust’s own scientist, measured the same day.
| 100 NPCs, over an empty server | RunicNPC on Oxide | RunicNPC on Carbon | Rust’s scientist (Oxide / Carbon) |
|---|---|---|---|
| Idle, a player near enough to keep them awake | +2.7 to +2.9 ms | +1.5 ms | +1.0 / +1.0 ms |
| Idle, asleep with nobody within 160 m | — | +0.5 ms | — |
| Fighting 20 players | +7.2 ms | +9.0 ms | +7.5 / +8.0 ms |
Fighting costs what Rust’s own AI costs. The warning uses the worst figure in each row, rounded up: 3 ms awake, 0.5 ms asleep and 9 ms fighting, per 100. The awake figure on Oxide is higher than it should be, and is being worked on in runicnpc-rust#13. Your server’s own figures depend on its CPU, its map and its players.
To cap them anyway, set any of these in config/RunicNPC.json (Carbon: configs/RunicNPC.json)
and reload RunicNPC. Every cap is 0, meaning none, until you set it.
| Key | What it limits |
|---|---|
caps.total | RunicNPC’s NPCs on the server |
caps.perOwner | NPCs of one owner: one placement, one event run, or one other plugin |
caps.perProfile | NPCs of one profile |
caps.spawnsPerSecond | How fast NPCs are spawned |
spawnBudgetMs | Milliseconds of each server frame placements may spend spawning; 8 by default. One NPC takes about 5 ms to spawn, so a large placement is spread over frames instead of stalling one |
These keys are checked against the plugin’s own source on every build.
A spawn over a cap is refused, naming the cap, whether it came from /rnpc, the site, an
event step or another plugin.
The bridge has its own bound too. On a Runic Gateway server, EventsMaxNpcs in the bridge
plugin’s RunicGateway.json limits how many NPCs one event step may
place — whatever RunicNPC’s caps allow.