mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 02:50:32 +00:00
clientdelta wip
This commit is contained in:
parent
d1a922bae9
commit
c6633bccbe
@ -688,11 +688,11 @@ void UpdateClientBaseline(double localTime)
|
|||||||
|
|
||||||
void UpdateClientDelta(double localTime)
|
void UpdateClientDelta(double localTime)
|
||||||
{
|
{
|
||||||
// TODO
|
// only sync on change:
|
||||||
}
|
// unreliable isn't guaranteed to be delivered so this depends on reliable baseline.
|
||||||
|
// if baseline is dirty, send unreliables every sendInterval until baseline is not dirty anymore.
|
||||||
|
if (onlySyncOnChange && !baselineDirty) return;
|
||||||
|
|
||||||
void UpdateClientBroadcast(double localTime)
|
|
||||||
{
|
|
||||||
// send to server each 'sendInterval'
|
// send to server each 'sendInterval'
|
||||||
// NetworkTime.localTime for double precision until Unity has it too
|
// NetworkTime.localTime for double precision until Unity has it too
|
||||||
//
|
//
|
||||||
@ -715,14 +715,14 @@ void UpdateClientBroadcast(double localTime)
|
|||||||
// received successfully.
|
// received successfully.
|
||||||
if (localTime >= lastClientSendTime + sendInterval) // CUSTOM CHANGE: allow custom sendRate + sendInterval again
|
if (localTime >= lastClientSendTime + sendInterval) // CUSTOM CHANGE: allow custom sendRate + sendInterval again
|
||||||
{
|
{
|
||||||
// send snapshot without timestamp.
|
// perf: get position/rotation directly. TransformSnapshot is too expensive.
|
||||||
// receiver gets it from batch timestamp to save bandwidth.
|
// TransformSnapshot snapshot = ConstructSnapshot();
|
||||||
TransformSnapshot snapshot = ConstructSnapshot();
|
target.GetLocalPositionAndRotation(out Vector3 position, out Quaternion rotation);
|
||||||
|
|
||||||
CmdClientToServerSync(
|
CmdClientToServerSync(
|
||||||
// only sync what the user wants to sync
|
// only sync what the user wants to sync
|
||||||
syncPosition ? snapshot.position : default(Vector3?),
|
syncPosition ? position : default(Vector3?),
|
||||||
syncRotation ? snapshot.rotation : default(Quaternion?)//,
|
syncRotation ? rotation : default(Quaternion?)//,
|
||||||
// syncScale ? snapshot.scale : default(Vector3?)
|
// syncScale ? snapshot.scale : default(Vector3?)
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -766,7 +766,7 @@ void UpdateClient()
|
|||||||
double localTime = NetworkTime.localTime;
|
double localTime = NetworkTime.localTime;
|
||||||
|
|
||||||
UpdateClientBaseline(localTime);
|
UpdateClientBaseline(localTime);
|
||||||
UpdateClientBroadcast(localTime);
|
UpdateClientDelta(localTime);
|
||||||
}
|
}
|
||||||
// for all other clients (and for local player if !authority),
|
// for all other clients (and for local player if !authority),
|
||||||
// we need to apply snapshots from the buffer
|
// we need to apply snapshots from the buffer
|
||||||
|
Loading…
Reference in New Issue
Block a user