mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00: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
|
// IMPORTANT: int tick avoids floating point inaccuracy over days/weeks
|
||||||
public int tick;
|
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()
|
public void ResetWriters()
|
||||||
{
|
{
|
||||||
ownerWriter.Position = 0;
|
ownerWriterTraditional.Position = 0;
|
||||||
observersWriter.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
|
// => way easier to store them per object
|
||||||
NetworkIdentitySerialization lastSerialization = new NetworkIdentitySerialization
|
NetworkIdentitySerialization lastSerialization = new NetworkIdentitySerialization
|
||||||
{
|
{
|
||||||
ownerWriter = new NetworkWriter(),
|
ownerWriterTraditional = new NetworkWriter(),
|
||||||
observersWriter = new NetworkWriter()
|
observersWriterTraditional = new NetworkWriter(),
|
||||||
|
ownerWriterFastPaced = new NetworkWriter(),
|
||||||
|
observersWriterFastPaced = new NetworkWriter(),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Keep track of all sceneIds to detect scene duplicates
|
// Keep track of all sceneIds to detect scene duplicates
|
||||||
@ -1166,10 +1176,17 @@ internal NetworkIdentitySerialization GetServerSerializationAtTick(int tick)
|
|||||||
// reset
|
// reset
|
||||||
lastSerialization.ResetWriters();
|
lastSerialization.ResetWriters();
|
||||||
|
|
||||||
// serialize
|
// serialize - traditional
|
||||||
SerializeServer(false,
|
SerializeServer(false,
|
||||||
lastSerialization.ownerWriter,
|
SyncMethod.Traditional,
|
||||||
lastSerialization.observersWriter);
|
lastSerialization.ownerWriterTraditional,
|
||||||
|
lastSerialization.observersWriterTraditional);
|
||||||
|
|
||||||
|
// serialize - fast paced
|
||||||
|
SerializeServer(false,
|
||||||
|
SyncMethod.FastPaced,
|
||||||
|
lastSerialization.ownerWriterFastPaced,
|
||||||
|
lastSerialization.observersWriterFastPaced);
|
||||||
|
|
||||||
// set tick
|
// set tick
|
||||||
lastSerialization.tick = tick;
|
lastSerialization.tick = tick;
|
||||||
|
Loading…
Reference in New Issue
Block a user