mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
NetworkServer.Broadcast: TrackIdentityAtTick
This commit is contained in:
parent
9fbbcca347
commit
c52ab5ce74
@ -61,6 +61,19 @@ public abstract class NetworkConnection
|
||||
// different connections.
|
||||
public double remoteTimeStamp { get; internal set; }
|
||||
|
||||
// unreliable delta compression: we need to keep track of which identities were in which sent batch @ timestamp.
|
||||
// so when the ack comes back, we know which identities were acked.
|
||||
// this is necessary since we sync per-identity not per-worldstate.
|
||||
internal readonly SortedList<double, HashSet<uint>> identityTicks = new SortedList<double, HashSet<uint>>();
|
||||
|
||||
// unreliable delta compression: we need to know the last acked state for each connection.
|
||||
// currently we sync one entity at a time in batches, so we also need to store acks for one at a time.
|
||||
// <netId, timestamp>
|
||||
// TODO remove old when unspawned
|
||||
readonly Dictionary<uint, double> identityAcks = new Dictionary<uint, double>();
|
||||
|
||||
//
|
||||
|
||||
internal NetworkConnection()
|
||||
{
|
||||
// set lastTime to current time when creating connection to make
|
||||
|
@ -1986,6 +1986,10 @@ static void BroadcastToConnection(NetworkConnectionToClient connection)
|
||||
payload = serialization.ToArraySegment()
|
||||
};
|
||||
connection.Send(message, Channels.Unreliable);
|
||||
|
||||
// keep track of which entities we sent to the connection on this tick.
|
||||
// so when the connection sends back an ack, we know which entities were acked.
|
||||
AckDeltaCompression.TrackIdentityAtTick(NetworkTime.localTime, identity.netId, connection.identityTicks, tickHistorySize);
|
||||
}
|
||||
}
|
||||
// spawned list should have no null entries because we
|
||||
|
Loading…
Reference in New Issue
Block a user