Client Broadcast: Traditional + FastPaced

This commit is contained in:
mischa 2024-07-15 13:26:57 +02:00
parent 5097d82707
commit cb816b58f7

View File

@ -1539,11 +1539,12 @@ static void Broadcast()
// NetworkServer.Destroy)
if (identity != null)
{
// 'Traditional' sync: send Traditional components over reliable.
using (NetworkWriterPooled writer = NetworkWriterPool.Get())
{
// get serialization for this entity viewed by this connection
// (if anything was serialized this time)
identity.SerializeClient(writer);
identity.SerializeClient(SyncMethod.Traditional, writer);
if (writer.Position > 0)
{
// send state update message
@ -1552,7 +1553,26 @@ static void Broadcast()
netId = identity.netId,
payload = writer.ToArraySegment()
};
Send(message);
Send(message, Channels.Reliable);
}
}
// 'Fast Paced' sync: send Fast Paced components over unreliable
// state is always 'initial' since unreliable delivery isn't guaranteed,
using (NetworkWriterPooled writer = NetworkWriterPool.Get())
{
// get serialization for this entity viewed by this connection
// (if anything was serialized this time)
identity.SerializeClient(SyncMethod.FastPaced, writer);
if (writer.Position > 0)
{
// send state update message
EntityStateMessage message = new EntityStateMessage
{
netId = identity.netId,
payload = writer.ToArraySegment()
};
Send(message, Channels.Unreliable);
}
}
}