public sealed class InterestGridWhat is near enough to each player to be worth telling them about.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
A source rather than a rule, and that is the entire point. Written as a rule it would be asked "is this within range" once per object per player — ten thousand objects and two hundred players is two million distance tests a tick, which is the cost the feature exists to remove. As a source it buckets the world once and then answers each player from the cells around them.
It leaves with hysteresis, and that is not a polish detail. Leaving interest and being destroyed are deliberately the same thing to a client, so an object hovering at the boundary does not flicker — it is destroyed and recreated, on every tick, complete with whatever the game hangs off a spawn. So an object already being observed stays observed until it passes Radius plus Hysteresis, and the band between the two is what a player walking a boundary spends their time in.
An object with no position is told to everybody. A match timer, a scoreboard, a team's shared state: a distance rule has nothing to say about a thing that is not anywhere, and the alternative reading — no position, no interest — makes those vanish for reasons nobody can see. Same argument the scene rule makes about an object in no scene.
A player whose position nobody has set sees everything, and it is counted. They are loading, or spectating, or the game has not wired SetViewpoint up yet — and of the two ways to be wrong, showing too much is the one that gets noticed.
Fields and properties (7)
public float CellSizeHow large a cell is, in world units.
public float RadiusHow far a player is told about things.
public float HysteresisHow much further something already being watched has to go before it is dropped.
public int CellCountHow many cells hold anything.
public int PositionedCountHow many objects were bucketed by the last rebuild.
public int UnpositionedCountHow many had no position and go to everybody.
public long ViewpointlessCountQueries answered for a player whose viewpoint nobody had set.
Methods (4)
public void SetViewpoint(PlayerId player, in Vector3 at)Says where a player is looking from.
public bool Forget(PlayerId player)Forgets a player who has gone.
public void Rebuild(World world)Buckets the world. Once a tick, before any player is resolved.
public void Candidates(World world, PlayerId player, List<Entity> into)Fills with the entities worth asking about.
Used by (1)
- InterestTestsVixen.Net.Tests