i want to make my npcs pathfinding so that the target can be constantly changed and even though i managed to do it, the npcs movement is now choppy. is there a better way to do it that would prevent the npcs from being this choppy? here is the script for the pathfinding that is inside a RunService.Heartbeat loop.
Try setting the primary part of the NPC’s network ownership to nil.
didnt change anything. i think i managed to pinpoint the issue, i guess computing the path over and over again takes some time and thats why the npc is so choppy. i still have no idea how to improve the script though
Some optomization you could do to make this work faster is to manually set :MoveTo() whenever there is not a wall between the start and endpoint. you could probably get by with just a simple blockcast
Over long distances, you should also be able to change how often the path is recomputed: changing it maybe whenever your npc travels 32 studs closer at 512 studs, and 8 studs at 128
i just ended up making it so the npc follows the old route if a new one hasnt been created yet and i made it so it only creates a new route if the target has moved. probably not the best solution because sometimes it takes a lot of time for the npc to react, but hey, it works.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.