Uploaded image for project: 'Minecraft (Bedrock codebase)'
  1. Minecraft (Bedrock codebase)
  2. MCPE-41092

Northwest Bias in Mob Movement

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • 1.17.10
    • 1.16.220.52 Beta, 1.16.220.50 Beta, 1.16.210.58 Beta, 1.16.0.66 Beta, 1.14.1 Hotfix, 1.8.1, 1.14.0, 1.14.60 Hotfix, 1.16.201 Hotfix
    • Confirmed
    • Multiple
    • 368404

      Update by GoldenHelmet

      Steps to reproduce

      1. Make a reasonably large enclosure with a flat floor made of a single block type.
      2. Spawn mobs that have a wandering behavior at the center of the enclosure.
      3. Observe the mobs over a period of time.

      Expected result

      Mobs drift in all directions with equal probability. A group of mobs spreads out evenly in all directions.

      Actual result

      Mobs drift toward the north (-Z) and west (-X) over time. A group of mobs ends up bunched in the northwest corner of an enclosure.

      Test world

      See this comment.

      Note: This bug existed in Java edition years ago and was fixed. See MC-10046 for details including code analysis. The issue seems to have been that using a floor function on a random number generated between maximum and minimum values results in a bias toward the minimum (e.g. the effective range is -10 to +9, instead of -10 to +10).



      Original description
      I've noticed that animal mobs tend to migrate to the northwest in my survival worlds. I've seen it in Bedrock on Windows 10 and iOS (iPhone).  It seems similar to an old Java version bug.

      To test it, I created a flat world in my Bedrock Windows 10 version 1.8, and put a 2-block high barrier around an 11x11 chunk region.  I killed off everything, turned natural spawning off, then spawned 121 sheep in the center chunk.  After an hour and a half of waiting in the center chunk, I put fences around every chunk.  Code Connection helped with all this.

      I then counted the sheep in each chuck. If the sheep spread out evenly, you would expect about one per chunk.  Instead, I got the counts shown in the attached image.  As you can see, there is a pretty strong bias towards the northwest.

      Thanks.

        1. 1260C0E3-7000-4E6A-A649-7F26AAFBACFC.png
          1.36 MB
          Steven J. Haker
        2. Mob wandering.mcworld
          69 kB
          [Mod] GoldenHelmet
        3. Mob wandering tracked.mp4
          4.45 MB
          [Mod] GoldenHelmet
        4. Screenshot from 2020-06-14 21-28-19.png
          1.99 MB
          Reed Cartwright
        5. SheepCounts.GIF
          6 kB
          Steven J. Haker

            SteveMadisonWI Steven J. Haker
            Votes:
            44 Vote for this issue
            Watchers:
            15 Start watching this issue

              Created:
              Updated:
              Resolved:
              CHK: