From ffe8303494ffc0259d31016ff159b1e3fe5bcd1a Mon Sep 17 00:00:00 2001 From: mischa Date: Thu, 31 Aug 2023 17:56:39 +0200 Subject: [PATCH] PredictionNetworkManager (disables Physics.autoSimulation --- .../BilliardsPredicted.unity | 2 +- .../PredictionNetworkManager.cs | 19 ++++++++++++++ .../PredictionNetworkManager.cs.meta | 11 ++++++++ ProjectSettings/QualitySettings.asset | 25 ++++++++++++++----- 4 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 Assets/Mirror/Examples/BilliardsPredicted/PredictionNetworkManager.cs create mode 100644 Assets/Mirror/Examples/BilliardsPredicted/PredictionNetworkManager.cs.meta diff --git a/Assets/Mirror/Examples/BilliardsPredicted/BilliardsPredicted.unity b/Assets/Mirror/Examples/BilliardsPredicted/BilliardsPredicted.unity index 29a836c3d..33c2effb9 100644 --- a/Assets/Mirror/Examples/BilliardsPredicted/BilliardsPredicted.unity +++ b/Assets/Mirror/Examples/BilliardsPredicted/BilliardsPredicted.unity @@ -776,7 +776,7 @@ MonoBehaviour: m_GameObject: {fileID: 1282001517} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 8aab4c8111b7c411b9b92cf3dbc5bd4e, type: 3} + m_Script: {fileID: 11500000, guid: bd0effdb85c1c400387afcc39e630acd, type: 3} m_Name: m_EditorClassIdentifier: dontDestroyOnLoad: 1 diff --git a/Assets/Mirror/Examples/BilliardsPredicted/PredictionNetworkManager.cs b/Assets/Mirror/Examples/BilliardsPredicted/PredictionNetworkManager.cs new file mode 100644 index 000000000..b8053b90f --- /dev/null +++ b/Assets/Mirror/Examples/BilliardsPredicted/PredictionNetworkManager.cs @@ -0,0 +1,19 @@ +// prediction needs some custom setup. +// for example, we need to ensure Physics 'Auto Simulation' is disabled +// because we want to call Physics.Simulate() manually. +using UnityEngine; + +namespace Mirror.Examples.BilliardsPredicted +{ + public class PredictionNetworkManager : NetworkManager + { + public override void Awake() + { + // Ensure Physics 'Auto Simulation' is disabled when starting this scene + Physics.autoSimulation = false; + Debug.Log($"Prediction: disabled Physics Auto Simulation to prepare for manual Simulation steps."); + + base.Awake(); + } + } +} diff --git a/Assets/Mirror/Examples/BilliardsPredicted/PredictionNetworkManager.cs.meta b/Assets/Mirror/Examples/BilliardsPredicted/PredictionNetworkManager.cs.meta new file mode 100644 index 000000000..e930ec961 --- /dev/null +++ b/Assets/Mirror/Examples/BilliardsPredicted/PredictionNetworkManager.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bd0effdb85c1c400387afcc39e630acd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/QualitySettings.asset b/ProjectSettings/QualitySettings.asset index 9b5845542..1c58333a4 100644 --- a/ProjectSettings/QualitySettings.asset +++ b/ProjectSettings/QualitySettings.asset @@ -18,7 +18,7 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 0 - blendWeights: 1 + skinWeights: 1 textureQuality: 1 anisotropicTextures: 0 antiAliasing: 0 @@ -27,6 +27,7 @@ QualitySettings: realtimeReflectionProbes: 0 billboardsFaceCameraPosition: 0 vSyncCount: 0 + realtimeGICPUUsage: 25 lodBias: 0.3 maximumLODLevel: 0 streamingMipmapsActive: 0 @@ -40,6 +41,7 @@ QualitySettings: asyncUploadBufferSize: 4 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} excludedTargetPlatforms: [] - serializedVersion: 2 name: Low @@ -53,7 +55,7 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 0 - blendWeights: 2 + skinWeights: 2 textureQuality: 0 anisotropicTextures: 0 antiAliasing: 0 @@ -62,6 +64,7 @@ QualitySettings: realtimeReflectionProbes: 0 billboardsFaceCameraPosition: 0 vSyncCount: 0 + realtimeGICPUUsage: 25 lodBias: 0.4 maximumLODLevel: 0 streamingMipmapsActive: 0 @@ -75,6 +78,7 @@ QualitySettings: asyncUploadBufferSize: 4 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} excludedTargetPlatforms: [] - serializedVersion: 2 name: Medium @@ -88,7 +92,7 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 0 - blendWeights: 2 + skinWeights: 2 textureQuality: 0 anisotropicTextures: 1 antiAliasing: 0 @@ -97,6 +101,7 @@ QualitySettings: realtimeReflectionProbes: 0 billboardsFaceCameraPosition: 0 vSyncCount: 1 + realtimeGICPUUsage: 25 lodBias: 0.7 maximumLODLevel: 0 streamingMipmapsActive: 0 @@ -110,6 +115,7 @@ QualitySettings: asyncUploadBufferSize: 4 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} excludedTargetPlatforms: [] - serializedVersion: 2 name: High @@ -123,7 +129,7 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 1 - blendWeights: 2 + skinWeights: 2 textureQuality: 0 anisotropicTextures: 1 antiAliasing: 0 @@ -132,6 +138,7 @@ QualitySettings: realtimeReflectionProbes: 1 billboardsFaceCameraPosition: 1 vSyncCount: 1 + realtimeGICPUUsage: 50 lodBias: 1 maximumLODLevel: 0 streamingMipmapsActive: 0 @@ -145,6 +152,7 @@ QualitySettings: asyncUploadBufferSize: 4 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} excludedTargetPlatforms: [] - serializedVersion: 2 name: Very High @@ -158,7 +166,7 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 1 - blendWeights: 4 + skinWeights: 4 textureQuality: 0 anisotropicTextures: 2 antiAliasing: 2 @@ -167,6 +175,7 @@ QualitySettings: realtimeReflectionProbes: 1 billboardsFaceCameraPosition: 1 vSyncCount: 1 + realtimeGICPUUsage: 50 lodBias: 1.5 maximumLODLevel: 0 streamingMipmapsActive: 0 @@ -180,6 +189,7 @@ QualitySettings: asyncUploadBufferSize: 4 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} excludedTargetPlatforms: [] - serializedVersion: 2 name: Ultra @@ -193,7 +203,7 @@ QualitySettings: shadowCascade2Split: 0.33333334 shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowmaskMode: 1 - blendWeights: 4 + skinWeights: 4 textureQuality: 0 anisotropicTextures: 2 antiAliasing: 2 @@ -202,6 +212,7 @@ QualitySettings: realtimeReflectionProbes: 1 billboardsFaceCameraPosition: 1 vSyncCount: 1 + realtimeGICPUUsage: 100 lodBias: 2 maximumLODLevel: 0 streamingMipmapsActive: 0 @@ -215,6 +226,7 @@ QualitySettings: asyncUploadBufferSize: 4 asyncUploadPersistentBuffer: 1 resolutionScalingFixedDPIFactor: 1 + customRenderPipeline: {fileID: 0} excludedTargetPlatforms: [] m_PerPlatformDefaultQuality: Android: 2 @@ -223,6 +235,7 @@ QualitySettings: PS4: 5 PSM: 5 PSP2: 2 + Server: 0 Standalone: 3 Tizen: 2 WebGL: 3