Making an NPC AI System

I am making an open world game, similar to a city. I need an NPC AI, which is able to wander around the map properly similar to many games such as GTA5, and WatchDogs. I have seen a few posts around the devforum showing similar systems, but i’m not sure how they did it.

My game will consist of a large city, and I want the NPCs to walk around like pedestrians. I’m not sure how I would do this, as I am fairly new to roblox pathfinding and NPCs.

Any help would be greatly appreciated, thanks!

6 Likes

Using weighted navmeshes/nodemaps alongside an A* algorithm (or D* if your map is more versatile) is probably best, compared to PathfindingService because you cannot specify to follow a general path with it. Using weighted navmeshes (crossing a street “costs” more than crossing a crosswalk) is how you get pedestrians to “follow” certain guide paths.

6 Likes

How would I get that working in studio? Your way sounds like it would fit in perfectly, but i’m not sure how I would implement it in my game?

2 Likes

There are MANY resources for this. Here’s my favorite:
Amit’s A* Pages – Grid based, you should start with this one.
Introduction to the A* Algorithm – Navmesh based, do this after the first one.

5 Likes

Do you know any other articles navmesh based? The seocnd article you provided doesn’t explain navmesh that well.