mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 19:10:32 +00:00
Billiards (not predicted): add latency simulation and improve explanation
This commit is contained in:
parent
cded6bc736
commit
a0bb738705
@ -213,7 +213,9 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
height: 150
|
height: 150
|
||||||
|
offsetY: 40
|
||||||
maxLogCount: 50
|
maxLogCount: 50
|
||||||
|
showInEditor: 0
|
||||||
hotKey: 293
|
hotKey: 293
|
||||||
--- !u!1001 &250045978
|
--- !u!1001 &250045978
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
@ -746,6 +748,7 @@ GameObject:
|
|||||||
- component: {fileID: 1282001519}
|
- component: {fileID: 1282001519}
|
||||||
- component: {fileID: 1282001521}
|
- component: {fileID: 1282001521}
|
||||||
- component: {fileID: 1282001522}
|
- component: {fileID: 1282001522}
|
||||||
|
- component: {fileID: 1282001523}
|
||||||
m_Layer: 0
|
m_Layer: 0
|
||||||
m_Name: NetworkManager
|
m_Name: NetworkManager
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
@ -796,12 +799,14 @@ MonoBehaviour:
|
|||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
dontDestroyOnLoad: 1
|
dontDestroyOnLoad: 1
|
||||||
runInBackground: 1
|
runInBackground: 1
|
||||||
autoStartServerBuild: 1
|
headlessStartMode: 1
|
||||||
autoConnectClientBuild: 0
|
editorAutoStart: 0
|
||||||
sendRate: 120
|
sendRate: 120
|
||||||
|
autoStartServerBuild: 0
|
||||||
|
autoConnectClientBuild: 0
|
||||||
offlineScene:
|
offlineScene:
|
||||||
onlineScene:
|
onlineScene:
|
||||||
transport: {fileID: 1282001521}
|
transport: {fileID: 1282001523}
|
||||||
networkAddress: localhost
|
networkAddress: localhost
|
||||||
maxConnections: 2
|
maxConnections: 2
|
||||||
disconnectInactiveConnections: 0
|
disconnectInactiveConnections: 0
|
||||||
@ -814,6 +819,7 @@ MonoBehaviour:
|
|||||||
spawnPrefabs:
|
spawnPrefabs:
|
||||||
- {fileID: 3429911415116987808, guid: d07e00a439ecd46e79554ec89f65317b, type: 3}
|
- {fileID: 3429911415116987808, guid: d07e00a439ecd46e79554ec89f65317b, type: 3}
|
||||||
- {fileID: 3429911415116987808, guid: 0100f0c90700741b496ccbc2fe54c196, type: 3}
|
- {fileID: 3429911415116987808, guid: 0100f0c90700741b496ccbc2fe54c196, type: 3}
|
||||||
|
exceptionsDisconnect: 1
|
||||||
snapshotSettings:
|
snapshotSettings:
|
||||||
bufferTimeMultiplier: 2
|
bufferTimeMultiplier: 2
|
||||||
bufferLimit: 32
|
bufferLimit: 32
|
||||||
@ -825,7 +831,8 @@ MonoBehaviour:
|
|||||||
dynamicAdjustment: 1
|
dynamicAdjustment: 1
|
||||||
dynamicAdjustmentTolerance: 1
|
dynamicAdjustmentTolerance: 1
|
||||||
deliveryTimeEmaDuration: 2
|
deliveryTimeEmaDuration: 2
|
||||||
connectionQualityInterval: 3
|
evaluationMethod: 0
|
||||||
|
evaluationInterval: 3
|
||||||
timeInterpolationGui: 1
|
timeInterpolationGui: 1
|
||||||
--- !u!114 &1282001521
|
--- !u!114 &1282001521
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -852,7 +859,7 @@ MonoBehaviour:
|
|||||||
MaxRetransmit: 40
|
MaxRetransmit: 40
|
||||||
MaximizeSocketBuffers: 1
|
MaximizeSocketBuffers: 1
|
||||||
ReliableMaxMessageSize: 297433
|
ReliableMaxMessageSize: 297433
|
||||||
UnreliableMaxMessageSize: 1195
|
UnreliableMaxMessageSize: 1194
|
||||||
debugLog: 0
|
debugLog: 0
|
||||||
statisticsGUI: 0
|
statisticsGUI: 0
|
||||||
statisticsLog: 0
|
statisticsLog: 0
|
||||||
@ -872,6 +879,24 @@ MonoBehaviour:
|
|||||||
padding: 2
|
padding: 2
|
||||||
width: 180
|
width: 180
|
||||||
height: 25
|
height: 25
|
||||||
|
--- !u!114 &1282001523
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1282001517}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 96b149f511061407fb54895c057b7736, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
wrap: {fileID: 1282001521}
|
||||||
|
latency: 50
|
||||||
|
jitter: 0.02
|
||||||
|
jitterSpeed: 1
|
||||||
|
unreliableLoss: 2
|
||||||
|
unreliableScramble: 2
|
||||||
--- !u!1001 &1633978772
|
--- !u!1001 &1633978772
|
||||||
PrefabInstance:
|
PrefabInstance:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -4,11 +4,15 @@ Mouse drag the white ball to apply force.
|
|||||||
Billiards is surprisingly easy to implement, which makes this a great demo for beginners!
|
Billiards is surprisingly easy to implement, which makes this a great demo for beginners!
|
||||||
|
|
||||||
Hits are sent to the server with a [Command].
|
Hits are sent to the server with a [Command].
|
||||||
There will always be some latency for the results to show.
|
Server simulates physics and sends results back to the client.
|
||||||
|
|
||||||
To solve this, there's another BilliardsPredicted demo which uses prediction & reconciliation.
|
While simple, this approach has a major flaw: latency.
|
||||||
This demo however is meant for complete beginners to learn Mirror!
|
The NetworkManager has a LatencySimulation component to see this on your own computer.
|
||||||
|
Client actions will always feel a bit delayed while waiting for the server.
|
||||||
|
|
||||||
|
The solution to this is called Prediction, which we implemented in our BilliardsPredicted demo.
|
||||||
|
See the Prediction article in our documentation!
|
||||||
|
|
||||||
Notes:
|
Notes:
|
||||||
- Red/White ball Rigidbody CollisionMode needs to be ContinousDynamic to avoid white flying through red sometimes.
|
- Red/White ball Rigidbody CollisionMode needs to be ContinousDynamic to avoid white flying through red sometimes.
|
||||||
even 'Continous' is not enough, we need ContinousDynamic.
|
even 'Continuous' is not enough, we need ContinuousDynamic.
|
Loading…
Reference in New Issue
Block a user