mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkIdentitySerialization: traditional + fast paced
This commit is contained in:
parent
2b3fbf290b
commit
b7e5a2aac4
@ -27,13 +27,21 @@ public struct NetworkIdentitySerialization
|
||||
{
|
||||
// IMPORTANT: int tick avoids floating point inaccuracy over days/weeks
|
||||
public int tick;
|
||||
public NetworkWriter ownerWriter;
|
||||
public NetworkWriter observersWriter;
|
||||
|
||||
// traditional reliable sync
|
||||
public NetworkWriter ownerWriterTraditional;
|
||||
public NetworkWriter observersWriterTraditional;
|
||||
|
||||
// fast paced unreliable sync
|
||||
public NetworkWriter ownerWriterFastPaced;
|
||||
public NetworkWriter observersWriterFastPaced;
|
||||
|
||||
public void ResetWriters()
|
||||
{
|
||||
ownerWriter.Position = 0;
|
||||
observersWriter.Position = 0;
|
||||
ownerWriterTraditional.Position = 0;
|
||||
observersWriterTraditional.Position = 0;
|
||||
ownerWriterFastPaced.Position = 0;
|
||||
observersWriterFastPaced.Position = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,8 +233,10 @@ public Visibility visible
|
||||
// => way easier to store them per object
|
||||
NetworkIdentitySerialization lastSerialization = new NetworkIdentitySerialization
|
||||
{
|
||||
ownerWriter = new NetworkWriter(),
|
||||
observersWriter = new NetworkWriter()
|
||||
ownerWriterTraditional = new NetworkWriter(),
|
||||
observersWriterTraditional = new NetworkWriter(),
|
||||
ownerWriterFastPaced = new NetworkWriter(),
|
||||
observersWriterFastPaced = new NetworkWriter(),
|
||||
};
|
||||
|
||||
// Keep track of all sceneIds to detect scene duplicates
|
||||
@ -1166,10 +1176,17 @@ internal NetworkIdentitySerialization GetServerSerializationAtTick(int tick)
|
||||
// reset
|
||||
lastSerialization.ResetWriters();
|
||||
|
||||
// serialize
|
||||
// serialize - traditional
|
||||
SerializeServer(false,
|
||||
lastSerialization.ownerWriter,
|
||||
lastSerialization.observersWriter);
|
||||
SyncMethod.Traditional,
|
||||
lastSerialization.ownerWriterTraditional,
|
||||
lastSerialization.observersWriterTraditional);
|
||||
|
||||
// serialize - fast paced
|
||||
SerializeServer(false,
|
||||
SyncMethod.FastPaced,
|
||||
lastSerialization.ownerWriterFastPaced,
|
||||
lastSerialization.observersWriterFastPaced);
|
||||
|
||||
// set tick
|
||||
lastSerialization.tick = tick;
|
||||
|
Loading…
Reference in New Issue
Block a user