I am creating an AI that needs to constantly pathfind to chase a target.
Besides trying to cache the position or only use pathfinding when there isn’t a direct line of sight, I am trying to see if I can take advantage of Parallel Lua to make the calculations faster.
Does anyone have any experience on how to go about this?
When I tried to it said that “Function Path.ComputeAsync is not safe to call in parallel”, does this mean it just can’t be done or I am doing it wrong?
You need a BindableFunction to accomplish this, in an actor. You can’t do the ComputeAsync in parallel, but you can send a table to the function and move to the points in parallel.
I ended up just doing my own pathfinding with a barebones A* (with nodes manually placed all over the map). From my benchmarks it was about 100x faster than using Roblox’s one, however it does not update to changing environments so it depends on what you need it for. It ran so fast I didn’t need to put it in parallel for my use case.