Uploaded image for project: 'Minecraft: Java Edition'
  1. Minecraft: Java Edition
  2. MC-198840

Entities do pathfinding on the main Thread

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • None
    • 1.16.2
    • None
    • Unconfirmed
    • (Unassigned)

      Currently all the entities do all their pathfinding on the main thread which causes significant issues. Pathfinding can easily be multi-threaded using a chunkcache without causing any issues.

      (As an example below our own async pathfinding implementation
      https://github.com/ldtteam/minecolonies/tree/version/1.15/src/main/java/com/minecolonies/coremod/entity/pathfinding).

      Examples: Villager entities use pathfinding EVERY single tick to find POI like their block to work on. Around 10 villagers doing that can cause significant lag spikes already.

      This information is not required to be there at right this moment and does not have to be searched every single tick.

      This is also a problem for zombies, skeletons etc, that try to find a path every tick instead of doing it a) Async and b) Less often.

      We do have hostile entities in the mod linked above that are significantly more smarter than vanilla mobs and players can't notice any difference in terms of pathing reaction compared to the vanilla mobs but they do ALL their pathfinding on the off-thread and don't invoke it every tick.

            Unassigned Unassigned
            raycoms Ray Neiheiser
            Votes:
            3 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: