A class in Root.Township, Alta.Networking.Internal.
Sends and reads the regular state updates of every EntitySerializer in a network scene, packing as many as fit into each SceneSerialize message. The server writes per connection.
Constructors
Fields
| Member | What it is |
|---|
static AverageNumber MessagesPerConnection | Running average of messages sent per connection per pass. |
static AverageNumber SerializationTimeMs | Running average time spent preparing entity data. |
static AverageNumber SerializeToConnectionsMs | Running average time to write and send to all connections. |
static SerializingEntityHandler WritingEntity | Static debug hook called for every entity written. |
6 private and internal fields
| Member | What it is |
|---|
private List<Connection> connections | Reused list of the connections to send to this pass. |
private EntityManager entityManager | Where the serialized entities come from. |
private static Logger logger | Logger for this class. |
private INetworkSceneInternal networkScene | The scene being serialized. |
private int serializeFrameIndex | Counter that staggers which entities get an on frame. |
private static Stopwatch timer | Stopwatch for the serialization timing stats. |
Properties
| Member | What it is |
|---|
ConnectionChannel SerializationChannel { get; set; } | Channel the serialize messages go out on. |
Methods
| Member | What it is |
|---|
void InitialSyncEntities(Player target) | Server: sends a joining player a sync message for every embedded scene entity, then destroy messages for missing ones. |
void PrepareSerializeEntities(bool isServer) | Has each serializer capture its data for this pass, using the server or client set. |
void SendSerialized(ISocket socket) | Writes and sends entity data to every connection on the socket, split over messages (logs an error at 1000). |
void SerializeRead(Connection connection, StreamReader stream) | Reads a serialize message and hands each entity's bits to its serializer. Skips unknown entities and data the sender may not write. |
void SerializeWrite(StreamWriter stream, Connection connection, ref int startIndex) | Writes serializers into one message up to MaxBitsPerSerializationMessage. Sets startIndex to where the next message resumes, or -1 when done. |
1 private and internal method
| Member | What it is |
|---|
private void UpdateEntityData(IEnumerable<EntitySerializer> serializers) | Runs each entity serializer's SerializeData, with three passes in four counted as off frames so idle entities update less often. |
Used in
Members of other types that take, return or hold a SceneSerializer: