Vixen
02b45cc4
csharp
public sealed class SceneInterestRule

Hides what is in a scene a player has not loaded.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The first rule in [16](../../../docs/plan/16-networking.md)'s chain, and the one that does the most for the least: a player in the lobby is not sent the contents of a level they are not in, whatever the distance grid would have said about it.

It hides, and never shows. Being in the right scene is not a reason to be told about something — it is only the absence of a reason not to be — so an object in a scene the player has loaded comes back Undecided and the distance grid after it gets its say. A rule that voted Observed here would make itself the last word on every object in the level, which is precisely what an ordered chain is for avoiding.

An entity in no scene is left to everybody. Not an oversight — an object created outside a scene belongs to the session rather than to a level, and the failure mode of the other choice is objects silently invisible because nobody remembered to tag them. A rule whose default is "vanish" is one that is debugged by everybody who uses it.

Methods (5)

  • public void Enter(PlayerId player, SceneHandle scene)

    Records that a player has a scene loaded.

  • public bool Leave(PlayerId player, SceneHandle scene)

    Records that a player no longer has a scene loaded.

  • public void Forget(PlayerId player)

    Forgets a player who has gone.

  • public int CountFor(PlayerId player)

    How many scenes a player has loaded.

  • public Interest Decide(World world, PlayerId player, Entity entity)

    Decides, or declines to.

Used by (1)

  • NetworkSpawnTestsVixen.Net.Engine.Tests