Help with more realistic npcs?

Ok so I have npcs that can move to locations on my map, the problem is that I want them to act more like a real player. As of right now they take the shortest possible path to the location, and never take curves. I was wondering how could I make them more “realistic” and more like a actual player? Thanks in advance!

AI is kind of a whole topic of its own and is pretty context heavy. What do you mean by “and never take curves”?

he probably means by them turning around randomly or moving side to side.

I mean I use pathfinding so if their is a straight path to its objective it will take it, it always takes the most efficient path. I want it to be more like a human and take less efficient paths, as humans are not perfect.

Adding onto this I am using it in a horror game, basically right now it’s very easy to tell who is a bot and who is not as the bots move robotically and their movement looks fake, I’m trying to make them more realistic.

So it’s the type of game where a player needs to hide among NPCs? Being as convincing as a real player is pretty tough.

For pathing, you can add offsets for a somewhat less efficient route, or perhaps giving it mandatory points to redirect the pathfinding to take a different route. But that doesn’t take into account random player movements. There’s a lot you’ll have to put into this if you want it to appear as a player.

You could also try recording (via code) previous players and replicating similar movements, but that’s not a great approach unless you’re using machine learning.

Not hide among them, but yes your right it requires the bots to trick the player and that is very hard to do. Would it lag the game to create like 20 offsets at a slight curve or could I use that to make the npc take turns?

You can do something sort of like this:

1 Like

Yes! I’m guessing this was done with Bézier curves?

Yes, although I’d recommend using a dynamic node count rather than a set amount to maintain a consistent amount of smoothness at a distance while keeping things simplistic for shorter distances.

1 Like