Benchmark: monsters move with 10% probability to make sure we can detect change detection in NT

This commit is contained in:
mischa 2024-10-28 11:16:58 +01:00
parent df7a343d7e
commit 68c7d14a16
2 changed files with 8 additions and 2 deletions

View File

@ -148,5 +148,5 @@ MonoBehaviour:
syncMode: 0 syncMode: 0
syncInterval: 0.1 syncInterval: 0.1
speed: 1 speed: 1
movementProbability: 0.5 movementProbability: 0.1
movementDistance: 20 movementDistance: 20

View File

@ -5,7 +5,13 @@ namespace Mirror.Examples.Benchmark
public class MonsterMovement : NetworkBehaviour public class MonsterMovement : NetworkBehaviour
{ {
public float speed = 1; 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; public float movementDistance = 20;
bool moving; bool moving;