From 68c7d14a16c0d4857c5d8498d6bb15b772c58214 Mon Sep 17 00:00:00 2001 From: mischa Date: Mon, 28 Oct 2024 11:16:58 +0100 Subject: [PATCH] Benchmark: monsters move with 10% probability to make sure we can detect change detection in NT --- Assets/Mirror/Examples/Benchmark/Prefabs/Monster.prefab | 2 +- .../Mirror/Examples/Benchmark/Scripts/MonsterMovement.cs | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Assets/Mirror/Examples/Benchmark/Prefabs/Monster.prefab b/Assets/Mirror/Examples/Benchmark/Prefabs/Monster.prefab index af21590ec..5af7fc2a0 100644 --- a/Assets/Mirror/Examples/Benchmark/Prefabs/Monster.prefab +++ b/Assets/Mirror/Examples/Benchmark/Prefabs/Monster.prefab @@ -148,5 +148,5 @@ MonoBehaviour: syncMode: 0 syncInterval: 0.1 speed: 1 - movementProbability: 0.5 + movementProbability: 0.1 movementDistance: 20 diff --git a/Assets/Mirror/Examples/Benchmark/Scripts/MonsterMovement.cs b/Assets/Mirror/Examples/Benchmark/Scripts/MonsterMovement.cs index 60a9abdc2..f5fcc294b 100644 --- a/Assets/Mirror/Examples/Benchmark/Scripts/MonsterMovement.cs +++ b/Assets/Mirror/Examples/Benchmark/Scripts/MonsterMovement.cs @@ -5,7 +5,13 @@ namespace Mirror.Examples.Benchmark public class MonsterMovement : NetworkBehaviour { public float speed = 1; - public float movementProbability = 0.5f; + + // movement probability: + // 0.5 is too high, monsters are moving almost all the time. + // only-sync-on-change shows no difference with 0.5 at all. + // in other words: broken change detection would be too easy to miss! + [Header("Note: use 0.1 to test change detection, 0.5 is too high!")] + public float movementProbability = 0.1f; public float movementDistance = 20; bool moving;