aha
This commit is contained in:
80
Assets/Mirror/Examples/BenchmarkPrediction/BallMaterial.mat
Normal file
80
Assets/Mirror/Examples/BenchmarkPrediction/BallMaterial.mat
Normal file
@ -0,0 +1,80 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: BallMaterial
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ValidKeywords: []
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 0
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 1
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 1
|
||||
- _Mode: 0
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 1
|
||||
m_Colors:
|
||||
- _Color: {r: 0, g: 0, b: 0, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09fe33013804145e8a4ba1d18f834dcf
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 129321
|
||||
packageName: Mirror
|
||||
packageVersion: 96.0.1
|
||||
assetPath: Assets/Mirror/Examples/BenchmarkPrediction/BallMaterial.mat
|
||||
uploadId: 736421
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 26e96d86a94c2451d85dcabf4aff3551
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 129321
|
||||
packageName: Mirror
|
||||
packageVersion: 96.0.1
|
||||
assetPath: Assets/Mirror/Examples/BenchmarkPrediction/MirrorPredictionBenchmark.unity
|
||||
uploadId: 736421
|
@ -0,0 +1,50 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Mirror.Examples.PredictionBenchmark
|
||||
{
|
||||
[AddComponentMenu("")]
|
||||
public class NetworkManagerPredictionBenchmark : NetworkManager
|
||||
{
|
||||
[Header("Spawns")]
|
||||
public int spawnAmount = 1000;
|
||||
public GameObject spawnPrefab;
|
||||
public Bounds spawnArea = new Bounds(new Vector3(0, 2.5f, 0), new Vector3(10f, 5f, 10f));
|
||||
|
||||
public override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
// ensure vsync is disabled for the benchmark, otherwise results are capped
|
||||
QualitySettings.vSyncCount = 0;
|
||||
}
|
||||
|
||||
void SpawnAll()
|
||||
{
|
||||
// spawn randomly inside the cage
|
||||
for (int i = 0; i < spawnAmount; ++i)
|
||||
{
|
||||
// choose a random point within the cage
|
||||
float x = Random.Range(spawnArea.min.x, spawnArea.max.x);
|
||||
float y = Random.Range(spawnArea.min.y, spawnArea.max.y);
|
||||
float z = Random.Range(spawnArea.min.z, spawnArea.max.z);
|
||||
Vector3 position = new Vector3(x, y, z);
|
||||
|
||||
// spawn & position
|
||||
GameObject go = Instantiate(spawnPrefab);
|
||||
go.transform.position = position;
|
||||
NetworkServer.Spawn(go);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnStartServer()
|
||||
{
|
||||
base.OnStartServer();
|
||||
SpawnAll();
|
||||
|
||||
// disable rendering on server to reduce noise in profiling.
|
||||
// keep enabled in host mode though.
|
||||
if (mode == NetworkManagerMode.ServerOnly)
|
||||
Camera.main.enabled = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f96c236d30fd94a75a172a7642242637
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 129321
|
||||
packageName: Mirror
|
||||
packageVersion: 96.0.1
|
||||
assetPath: Assets/Mirror/Examples/BenchmarkPrediction/NetworkManagerPredictionBenchmark.cs
|
||||
uploadId: 736421
|
@ -0,0 +1,50 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &6080703956733773953
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5774152995658786670}
|
||||
- component: {fileID: 4958697633604052194}
|
||||
m_Layer: 0
|
||||
m_Name: PlayerSpectator
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5774152995658786670
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6080703956733773953}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &4958697633604052194
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 6080703956733773953}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
sceneId: 0
|
||||
_assetId: 2913940975
|
||||
serverOnly: 0
|
||||
visibility: 0
|
||||
hasSpawned: 0
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: feea51e51b4564f06a38482bbebac8fa
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 129321
|
||||
packageName: Mirror
|
||||
packageVersion: 96.0.1
|
||||
assetPath: Assets/Mirror/Examples/BenchmarkPrediction/PlayerSpectator.prefab
|
||||
uploadId: 736421
|
186
Assets/Mirror/Examples/BenchmarkPrediction/PredictedBall.prefab
Normal file
186
Assets/Mirror/Examples/BenchmarkPrediction/PredictedBall.prefab
Normal file
@ -0,0 +1,186 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &5646305152014201295
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5646305152014201299}
|
||||
- component: {fileID: 5646305152014201298}
|
||||
- component: {fileID: 5646305152014201297}
|
||||
- component: {fileID: 5646305152014201296}
|
||||
- component: {fileID: 1898357413811911178}
|
||||
- component: {fileID: 7187875016326091757}
|
||||
- component: {fileID: 1900383403885999746}
|
||||
- component: {fileID: 813163234907249251}
|
||||
m_Layer: 0
|
||||
m_Name: PredictedBall
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &5646305152014201299
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5646305152014201295}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 2.5, z: 0}
|
||||
m_LocalScale: {x: 0.35, y: 0.35, z: 0.35}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!33 &5646305152014201298
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5646305152014201295}
|
||||
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &5646305152014201297
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5646305152014201295}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 09fe33013804145e8a4ba1d18f834dcf, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!135 &5646305152014201296
|
||||
SphereCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5646305152014201295}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Radius: 0.5
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!54 &1898357413811911178
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5646305152014201295}
|
||||
serializedVersion: 2
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_UseGravity: 1
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 1
|
||||
m_Constraints: 0
|
||||
m_CollisionDetection: 1
|
||||
--- !u!114 &7187875016326091757
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5646305152014201295}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9b91ecbcc199f4492b9a91e820070131, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
sceneId: 0
|
||||
_assetId: 3958841676
|
||||
serverOnly: 0
|
||||
visibility: 0
|
||||
hasSpawned: 0
|
||||
--- !u!114 &1900383403885999746
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5646305152014201295}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: d38927cdc6024b9682b5fe9778b9ef99, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
syncDirection: 0
|
||||
syncMode: 0
|
||||
syncInterval: 0
|
||||
predictedRigidbody: {fileID: 0}
|
||||
mode: 1
|
||||
motionSmoothingVelocityThreshold: 0.1
|
||||
motionSmoothingAngularVelocityThreshold: 0.1
|
||||
motionSmoothingTimeTolerance: 0.5
|
||||
stateHistoryLimit: 32
|
||||
recordInterval: 0.05
|
||||
onlyRecordChanges: 1
|
||||
compareLastFirst: 1
|
||||
positionCorrectionThreshold: 0.1
|
||||
rotationCorrectionThreshold: 5
|
||||
oneFrameAhead: 1
|
||||
snapThreshold: 2
|
||||
showGhost: 0
|
||||
ghostVelocityThreshold: 0.1
|
||||
localGhostMaterial: {fileID: 2100000, guid: 411a48b4a197d4924bec3e3809bc9320, type: 2}
|
||||
remoteGhostMaterial: {fileID: 2100000, guid: 04f0b2088c857414393bab3b80356776, type: 2}
|
||||
checkGhostsEveryNthFrame: 4
|
||||
positionInterpolationSpeed: 15
|
||||
rotationInterpolationSpeed: 10
|
||||
teleportDistanceMultiplier: 10
|
||||
reduceSendsWhileIdle: 1
|
||||
--- !u!114 &813163234907249251
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 5646305152014201295}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 87a6103a0a29544ba9f303c8a3b7407c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
syncDirection: 0
|
||||
syncMode: 0
|
||||
syncInterval: 0
|
||||
force: 10
|
||||
interval: 3
|
@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 881505c283e224c4fbe4e03127f08b4a
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 129321
|
||||
packageName: Mirror
|
||||
packageVersion: 96.0.1
|
||||
assetPath: Assets/Mirror/Examples/BenchmarkPrediction/PredictedBall.prefab
|
||||
uploadId: 736421
|
52
Assets/Mirror/Examples/BenchmarkPrediction/RandomForce.cs
Normal file
52
Assets/Mirror/Examples/BenchmarkPrediction/RandomForce.cs
Normal file
@ -0,0 +1,52 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Mirror.Examples.PredictionBenchmark
|
||||
{
|
||||
public class RandomForce : NetworkBehaviour
|
||||
{
|
||||
public float force = 10;
|
||||
public float interval = 3;
|
||||
PredictedRigidbody prediction;
|
||||
Rigidbody rb => prediction.predictedRigidbody;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
prediction = GetComponent<PredictedRigidbody>();
|
||||
}
|
||||
|
||||
// every(!) connected client adds force to all objects(!)
|
||||
// the more clients, the more crazier it gets.
|
||||
// this is intentional for benchmarks.
|
||||
public override void OnStartClient()
|
||||
{
|
||||
// start at a random time, but repeat at a fixed time
|
||||
float randomStart = Random.Range(0, interval);
|
||||
InvokeRepeating(nameof(ApplyForce), randomStart, interval);
|
||||
}
|
||||
|
||||
|
||||
[ClientCallback]
|
||||
void ApplyForce()
|
||||
{
|
||||
// calculate force in random direction but always upwards
|
||||
Vector2 direction2D = Random.insideUnitCircle;
|
||||
Vector3 direction3D = new Vector3(direction2D.x, 1.0f, direction2D.y);
|
||||
Vector3 impulse = direction3D * force;
|
||||
|
||||
// grab the current Rigidbody from PredictedRigidbody.
|
||||
// sometimes this is on a ghost object, so always grab it live:
|
||||
|
||||
|
||||
// predicted locally and sync to server for others to see.
|
||||
// PredictedRigidbody will take care of corrections automatically.
|
||||
rb.AddForce(impulse, ForceMode.Impulse);
|
||||
CmdApplyForce(impulse);
|
||||
}
|
||||
|
||||
[Command(requiresAuthority = false)] // everyone can call this
|
||||
void CmdApplyForce(Vector3 impulse)
|
||||
{
|
||||
rb.AddForce(impulse, ForceMode.Impulse);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 87a6103a0a29544ba9f303c8a3b7407c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 129321
|
||||
packageName: Mirror
|
||||
packageVersion: 96.0.1
|
||||
assetPath: Assets/Mirror/Examples/BenchmarkPrediction/RandomForce.cs
|
||||
uploadId: 736421
|
24
Assets/Mirror/Examples/BenchmarkPrediction/Readme.md
Normal file
24
Assets/Mirror/Examples/BenchmarkPrediction/Readme.md
Normal file
@ -0,0 +1,24 @@
|
||||
Mirror's PredictedRigidbody is optimized for low end devices / VR.
|
||||
While not interacting with the object, there's zero overhead!
|
||||
While interacting, overhead comes from sync & corrections.
|
||||
|
||||
This benchmark has predicted objects which are constantly synced & corrected.
|
||||
=> This is not a real world scenario, it's worst case that we can use for profiling!
|
||||
=> As a Mirror user you don't need to worry about this demo.
|
||||
|
||||
# Benchmark Setup
|
||||
- Unity 2021.3 LTS
|
||||
- IL2CPP Builds
|
||||
- M1 Macbook Pro
|
||||
- vsync disabled in NetworkManagerPredictionBenchmark.cs
|
||||
|
||||
# Benchmark Results History for 1000 objects without ghosts:
|
||||
Not Predicted: 1000 FPS Client, 2500 FPS Server
|
||||
Predicted:
|
||||
2024-03-13: 500 FPS Client, 1700 FPS Server
|
||||
2024-03-13: 580 FPS Client, 1700 FPS Server // micro optimizations
|
||||
2024-03-14: 590 FPS Client, 1700 FPS Server // UpdateGhosting() every 4th frame
|
||||
2024-03-14: 615 FPS Client, 1700 FPS Server // predictedRigidbodyTransform.GetPositionAndRotation()
|
||||
2024-03-15: 625 FPS Client, 1700 FPS Server // Vector3.MoveTowardsCustom()
|
||||
2024-03-18: 628 FPS Client, 1700 FPS Server // removed O(N) insertion from CorrectHistory()
|
||||
2024-03-28: 800 FPS Client, 1700 FPS Server // FAST mode prediction
|
10
Assets/Mirror/Examples/BenchmarkPrediction/Readme.md.meta
Normal file
10
Assets/Mirror/Examples/BenchmarkPrediction/Readme.md.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef1cc472cf2141baa667b35be391340a
|
||||
timeCreated: 1710305999
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 129321
|
||||
packageName: Mirror
|
||||
packageVersion: 96.0.1
|
||||
assetPath: Assets/Mirror/Examples/BenchmarkPrediction/Readme.md
|
||||
uploadId: 736421
|
78
Assets/Mirror/Examples/BenchmarkPrediction/WallMaterial.mat
Normal file
78
Assets/Mirror/Examples/BenchmarkPrediction/WallMaterial.mat
Normal file
@ -0,0 +1,78 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: WallMaterial
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap:
|
||||
RenderType: Transparent
|
||||
disabledShaderPasses: []
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 10
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 3
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 1, b: 1, a: 0}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
@ -0,0 +1,15 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5afe569b0e1434398b94cf6c73e90c89
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 129321
|
||||
packageName: Mirror
|
||||
packageVersion: 96.0.1
|
||||
assetPath: Assets/Mirror/Examples/BenchmarkPrediction/WallMaterial.mat
|
||||
uploadId: 736421
|
Reference in New Issue
Block a user