SimplePath - Pathfinding Module


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.

To get started with using SimplePath visit: Getting Started - SimplePath

Links:



474 Likes
AI stuttering Help
Pathfinding AI running back and forth HELP
Pathfinding on terrain
How to update pathfinding?
C stack overflow?
How to make npc follow player anywhere?!
How to script AI
NPC won't move for some reason
How to fix npc moving to waypoint behind them?
Best way of implementing pathfinding/AI for my purposes and where can I learn about how to do it?
Smart NPC Chase
NextPath: Next gen script for Nextbots
Making Zombie gameplay better
Help with npc Ai
Humanoid.MoveToFinished fires before humanoid reaches part
{SimplePath} NPC Pathfinding AI Breaks Randomly
How do i fix this?
Project Delta Credits
Why is my npc move like that
AI unable to catch up to player
How do I stop NPCs from stacking onto other npcs heads?
Npc keeps jumping while following player
SimplePath module: Trouble with cancelling a path
Help making enemy leader system
What should I add to my zombie defense game?
(Legacy) SimplePath - Pathfinding Module
General Combat NPC Tutorial
Pathfinding issue
How to make NPC's avoid obstacles (and themselves too)
AI isn't moving but the jumpscare plays meaning the script runs with no errors
SimplePath or Write my own?
Fixing a script about pathfinding from YouTube. (help)
Whats the best way to do pathfinding chase?
Faster, smarter and more efficient AI pathfinding needed
Choppy Humanoids: Target Position updating too quick for the server?
AI keeps moving towards goal even though it no longer exists? (Pathfinding, SimplePath)
Alternatives to moving enemies in my tower defense game
SimplePath module help
Non-humanoid Npc Pauses at Waypoint
Granny NPc AI Question
Stop Npc moving to attack
Have an NPC stop walking when target is seen
Roblox pathfinding can only compute path within limited range
NPC with Pathfinding service gets hung up on terrain
How do i make something like this?
SimplePath Pathfinding Links
Can PathfindingService fail?
Raycast not detecting obstacles
How to Move an Object with pathfinding service and lerping?
:MoveTo() making my character jittery because I'm using it every task.wait()
Unusually high rate on AI and memory leak
Pathfinding Gradually FAILING, NPC Stops Moving After 2 Minutes! HUGE DEAL
CFrame Math Problem
AI unable to catch up to player
Issues related to Custom AI Behavior
Halo's Arena Update Post
PathFindService will stuck in part
(Legacy) SimplePath - Pathfinding Module
My NPC isn't pathfinding how I want it to
(Legacy) SimplePath - Pathfinding Module
NPC makes stops while chasing target
IA Path is dont work correctly
Looking for a way NPCS can constantly follow player AND avoid obstacles
Tide Rush Update Logs
Issue with Pathfinding service/nav mesh
How would you make pathfinding work with Collision Groups?
Make Npc Pathfinding More smooth
Pathfinding causes massive lag
Anything wrong with my NPC spawning script?
How can I make a follower AI not jittery
Depth Spelunking Information
Help with pathfinding script
PathfindingService is pretty garbage
Pathfinding has issues with elevation?
How would I CFrame a character to look towards a point
Pathfinding literally does not work
Inconcinnity Credits
How to go about learning Pathfinding
Script Planning Questions for Performance
Pathfinding Problem on Terrain
Pathfinding service not finding a good path
Pathfinding NPC not moving(simple path)
Npc Getting stuck on walls
Pathfinding NPC struggles to move while in midair
NPC sometimes twiches
AI enemies vanishing on death
Need help with making a pathfinding system for my game
Pathfinding NPC twiching, and not applying knockback correctly
How to make a custom pathfinder?
AI doesn't get around walls and instead walks into them (unsolved)
NPC Pathfinding jittery/stuttering walk animation solution
Entire script not running
Script not working after cloned
Why is my pathfinding causing my game to lag?
Pathfinding AI stuck in the walls
Help With Pathfinding Constantly Updating
Pathfinding not pathfinding
How would I go about creating a pathfinding module using raycasting?
How can I have this EVIL PUMPKIN chase around players in a maze? (PATHFINDER?)
[Solved] Pathfinding Problem
Improve pathfinding without using loop?
My 5 year open world rpg 3m+ visits is failing due to server lag and crashes over time
Pathfinding Module keeps spewing out "Attempting to Index nil on PrimaryPart"
Why doesn't npc constantly chase player?
NoobPath | Easy Pathfinding
First time using behavior trees, any tips for serverside pathing?

nice pathfinding lol
this is cool

16 Likes

Update 1.01:

  • Fixed a velocity jump issue.
  • Added three new static methods (see API).
11 Likes

Nice module! You can create something like this with it lol

22 Likes

Update 1.02:

  • Fixed issues when rigs had HipHeight of 0.
  • Enabled the usage of Path:Stop() for non-humanoids. See API for more info.
9 Likes

I love the system. But for how I use it, when I stand on top of a part, the NPC is clueless on how to get to me.

6 Likes

i don’t think npc can jump or jump good

6 Likes

He jumps when he wants, I was on top of a truss and he didn’t know what to do.

5 Likes

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.

10 Likes

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

6 Likes

It still gives me an error that the hip height is zero. And i am moving a model.

5 Likes

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.

5 Likes

It doesn’t support truss climbing
image
(it just stops at bottom)

Also some others bugs https://gyazo.com/5758cf7fae185b557314c66c6c75ff54

3 Likes

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.

3 Likes

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

4 Likes

That’s a very good idea. I will make sure to implement it in the upcoming update. Thank you for the suggestion.

1 Like

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:

4 Likes

How do I make it so the npc’s animations will activate when walking.

3 Likes

You can download the provided example which includes a dummy with animations.

Edit: If using the example above, make sure to use the latest version of SimplePath.

1 Like

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?
image

EDIT: Turns out I was using the old version of the module. I believe the issue is fixed!

1 Like