Skip to main content

StreamEntityExtensions

A static class in Root.Township, Alta.Networking.

Extension methods on Stream for checking which side is reading or writing, and for sending entities, entity ids and chunks.

Fields​

1 private and internal field
MemberWhat it is
private static Logger loggerNLog logger for chunk errors.

Methods​

MemberWhat it is
static bool IsReadingOnRemoteClient(Stream stream)True when reading on a client (not the server).
static bool IsReadingOnServer(Stream stream)True when reading on the server.
static bool IsReadingOnServerNonLocalTest(Stream stream)True when reading on the server, outside local test.
static bool IsServerToClient(Stream stream)True when the server writes (outside local test) or a client reads.
static void SerializeChunk(Stream stream, ref Chunk chunk)Writes or reads a chunk by index in 13 bits; a null chunk is sent as the global chunk.
static void SerializeEntityIdentifier(Stream stream, ref uint identifier)Writes or reads an entity identifier, which must be 0 to 100000.
static void SerializeNetworkEntity(Stream stream, ref NetworkEntity entity, INetworkScene scene)Writes or reads an entity by identifier, looking it up in the scene on read.
1 private and internal method
MemberWhat it is
private static bool IsWritingOnServerOnly(Stream stream)True when writing on the server, outside local test.