Skip to main content

NetworkEntityLink

A class in Root.Township, Alta.Networking.

One slot in the entity manager's fixed table of 100,000 entity identifiers. On the server, slots are also chained into linked lists of empty, full and serialized slots so free identifiers and synced entities can be walked quickly.

Constructors​

MemberWhat it is
NetworkEntityLink(uint index)Creates a NetworkEntityLink from index, previous and next.
NetworkEntityLink(uint index, NetworkEntityLink previous)Creates a NetworkEntityLink from index, previous and next.
NetworkEntityLink(uint index, NetworkEntityLink previous, NetworkEntityLink next)Creates a NetworkEntityLink from index, previous and next.

Fields​

MemberWhat it is
uint IndexThe entity identifier this slot stands for.
bool IsEmptyTrue if no entity holds this slot.
bool IsFakeTrue for the placeholder slots set up every 50 entries, probably so list walks never run long.
bool IsSerializedTrue if the entity in the slot has a serializer and is in the serialized list.
static int LinksWithEntitiesCount of slots that hold an entity, across all tables.
NetworkEntity NetworkEntityThe entity in the slot, or null.
NetworkEntityLink NextEmptyNext empty slot (server).
NetworkEntityLink NextFullNext full slot (server).
NetworkEntityLink NextSerializedNext serialized slot (server).
NetworkEntityLink PreviousEmptyPrevious empty slot (server).
NetworkEntityLink PreviousFullPrevious full slot (server).
NetworkEntityLink PreviousSerializedPrevious serialized slot (server).
EntitySerializer SerializerThe entity's serializer, once marked serialized.
1 private and internal field
MemberWhat it is
private static Logger loggerNLog logger for this class.

Methods​

MemberWhat it is
void Empty(bool isServer, NetworkEntityLink[] links)Clears the slot. On the server it also unlinks it from the full and serialized lists and adds it to the empty list.
bool Fill(bool isServer, NetworkEntity entity, NetworkEntityLink[] links)Puts an entity in the slot. On the server it moves the slot from the empty list to the full list; refuses if already full.
void MakeFake(bool isEmpty, NetworkEntityLink[] links)Turns the slot into a placeholder, empty or full.
void MarkFirstFakeAsSerialized()Marks slot 0 as the head of the serialized list. Only valid on a fake slot.
void MarkSerialized(bool isServer, EntitySerializer serializer)Records the entity's serializer. On the server it also links the slot into the serialized list.
2 private and internal methods
MemberWhat it is
private static void DeregisterEntity(NetworkEntity entity)Decrements LinksWithEntities when a link is emptied of a real entity.
private static void RegisterEntity(NetworkEntity entity)Increments LinksWithEntities when a link is filled with a real entity.

Used in​

Members of other types that take, return or hold a NetworkEntityLink: