From db71635f166d3c4655eaf7f586612adc07c8cb16 Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Wed, 15 Mar 2023 13:46:58 -0500 Subject: [PATCH] delay between mob actions to reduce synchronized appearance --- src/engine/ai/MobileFSMManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/engine/ai/MobileFSMManager.java b/src/engine/ai/MobileFSMManager.java index a0458546..8d8d0189 100644 --- a/src/engine/ai/MobileFSMManager.java +++ b/src/engine/ai/MobileFSMManager.java @@ -16,6 +16,8 @@ import engine.server.MBServerStatics; import engine.util.ThreadUtils; import org.pmw.tinylog.Logger; +import java.util.Random; + public class MobileFSMManager { @@ -70,8 +72,9 @@ public class MobileFSMManager { long mobPulse = System.currentTimeMillis() + MBServerStatics.AI_PULSE_MOB_THRESHOLD; while (alive) { - - ThreadUtils.sleep(1); + //assign random range of delay between 1ms and 2000ms so mob actions don't appear synchronized + Random r = new Random(); + ThreadUtils.sleep(r.nextInt(2000-1) + 1); if (System.currentTimeMillis() > mobPulse) {