Progress on an NPC that watches and tries to stay by the nearest player

I’m eventually going to have to make some follower and enemy NPCs for my game, so I started working on the bones of making an NPC try and keep up the pace with whichever player is nearest to it.

So far, I’ve done just enough to make it watch and follow the nearest player.

I’m using the pathfinding service to make it move within a target range, which works pretty consistently, but begins to stutter after a while. I’m assuming it has to do with the pathfinding being done on the server, so later I’ll try changing network ownership of the NPC to the nearest player and having the client move it around.


Testing some eyesight markers for later raycasting

They do nothing yet lol. I’m just using them to help visualize where to raycast for line of sight on players and other NPCs in the future.

5 Likes

This is good progress! Nice job on this NPC!

1 Like