NPC wandering system

As you might be able to tell from other recent posts from me, I am making an open world adventure game. I plan to have an open world for the player to explore, which also means that I need NPCs to wander around to make the game less boring.

Currently, I am not sure what way I should approach this. I have thought of using nodes and ObjectValues and randomizers to randomly move the NPC to a nearby node, but it’s not easy to setup.

On the other hand, I have seen many topics talking about the A* method, which I also don’t want to aim for because just placing nodes would take a long time.

So, I would like to ask:

How should I approach this kind of AI NPCs?
Pathfinding is also not really wanted because of it’s unreliability.

How should I do it?
Just placing nodes isn’t ideal, it takes a long time to populate an entire city in roblox with nodes. I’ve seen topics of people saying they were using raycasting, although i’m not sure how raycasting is related to nodes.

Thanks for reading, and whoever replies, thanks for helping out!
-bryancololee

3 Likes

Perhaps create a ton of big nodes (So you don’t need to make small nodes all over the place) you want NPCs to travel in. Then you can have an NPC travel within the node area (Have more than one perhaps so NPCs can move to different locations). About the raycasting thing it may be used to stop the NPC from running into walls so I recommend a LookVector.

The thing is, I want NPCs to wander around the entire map instead of just 1 area. Wandering just in 1 area is kind of weird, as if the player looks closely, the same NPC keeps crossing the same area/path. I also want to prioritize user experience in this case, so i’m not sure how you would handle that.

1 Like

I wonder if you could make an NPC want to go to a certain location so they will proceed to go off and look for it. Once they arrive they can do what ever before looking for a new location. You could maybe tie this to what time it is in the world or the NPC’s occupation.

That actually sounds pretty reasonable, I’ll go try it out and let you guys know how it works out.

Edit: Actually, I think your method could be improvised. In the real world, people sometimes just stand at an area and look out, such as from a bridge. This would once again use nodes, which might make it harder again.

2 Likes

Good luck, I hope it works out for you!

Like I said in my edit, your method didn’t really work quite well for me. Sometimes, Roblox pathfinding just wants to noclip through stairs. Also, people don’t just wander around, they also sometimes stand in one specific spot to enjoy the view.

Personally, I would use a node system but its too complicated. A* isn’t necessarily what I want, because A* computes a path instead of just wandering.