SimplePath is an open-source pathfinding module that gives you the ability to quickly create a pathfinding script for humanoids and non-humanoids with just a few lines of code. Pathfinding is done using Roblox’s PathfindingService.
This module works by using a “repetitive” approach to pathfinding. The pathfinding agent moves a more efficient path when computed repetitively instead of just once. Part of the reason why is because computing the path once doesn’t guarantee that the agent reaches the goal as expected. Taking the repetitive approach accounts for any obstructions or obstacles blocking the path at the current time. This guarantees that the agent will reach its goal no matter what as long as it’s traversable within the scope of PathfindingService. Although you can still use SimplePath normally, it is strongly suggested that you take a repetitive approach to pathfinding as this was the primary concept kept in mind during the development of this module. However, in some scenarios, it might be better to compute the path just once. For example, if the agent does not interact with moving objects, you should consider changing the structure of your pathfinding code by reducing the number of repetitions between path computations to improve performance.
The NPC cannot always reach you. It can only walk to your location if there is a clear pathway available for the NPC. Sometimes in rare cases, the path may not be generated even though it’s possible for the NPC to reach the goal. Unfortunately, this is one of the limitations associated with pathfinding service and in this case, there’s nothing I can do.
Im not sure if im doing something wrong but this character is jumping randomly https://gyazo.com/eeacd47c9ad32603a6ac47713906a9e1 i used path:run() and nothing else also i have no clue why the gyazo is so laggy
When there is something blocking the path or if there is some kind of an interference, it gets detected by when the humanoid does not reach the next waypoint within the set amount of time. After the timeout, the RetryPath method is executed which assumes that there’s something blocking the path so this is why the humanoid jumps and due to the way the script works, the humanoid more or lese doesn’t move while in the air so there’s a velocity applied to it. I’m aware that .Velocity is depreciated and I plan to update the module soon.
This uses the Roblox pathfinding system (as any other pathfinding module does). If the Roblox pathfinding system doesn’t support climbing (I doubt it does) then it would require a whole rework of the module to make that possible, if there are any other stable pathfinding methods out there.
I suggest creating a state property so we can check it with an if statement. While I was making my own NPC with your system, I found it would be helpful to check the status and change it to what I want if it isn’t already. Example: if path.Status == "Running" then path:Stop() end
or the opposite
I built a controller like this awhile ago for a friend, but I noticed that when doing obstacle courses that the pathfinder wasn’t finding paths / creating jump links, avoiding dangerous objects, respecting timed events, or able to provide advanced maneuvering like walking sideways. Sometimes it couldn’t even jump on pillars because it would return waypoints in the opposite direction before a jump.
These issues are impossible to fix in a controller like this, so I’m working on a new pathfinder. I’ll likely build on and submit PR for this controller and use that.
If anyone is interested in contributing to the list of do’s and don’ts for the new pathfinder, I’m building a community to discuss those issues. Here is a discord invite:
I’m running into behavior with this module. Here’s how I run it.
if ClosestObject then
local Combat_NpcStates = CharacterModel:WaitForChild("Combat_NpcStates")
--[Trigger States]
local TriggerStates = Combat_NpcStates:WaitForChild("TriggerStates")
local Aggro = TriggerStates:WaitForChild("Aggro")
local RandomX = Universal_Checks.TrueRandom(-ClosestObject.Size.X/2, ClosestObject.Size.X/2)
local RandomZ = Universal_Checks.TrueRandom(-ClosestObject.Size.Z/2, ClosestObject.Size.Z/2)
local PathfindPosition = (ClosestObject.CFrame * CFrame.new(RandomX, 0, RandomZ)).Position
local CalculatedPath = Pathfind_Module.new(CharacterModel, {AgentHeight = 5, AgentRadius = 3, AgentCanJump = true,})
CalculatedPath:Run(PathfindPosition)
Connections["PathCompleteConnect"] = CalculatedPath.Completed:connect(function(Status)
CalculatedPath:Stop()
CalculatedPath:Destroy()
--check distance of all players to aggro
end)
Connections["AggroChangeConnect"] = Aggro:GetPropertyChangedSignal("Value"):connect(function()
if Aggro.Value ~= nil then
CalculatedPath:Stop()
CalculatedPath:Destroy()
end
end)
end
Here’s what happens. This causes a HUGE lag spike. Do you notice anything wrong in my code that could cause this?