- What do you want to achieve? Keep it simple and clear!
I currently have a system setup where NPC data is communicated between the server and client which includes the current position and goal position. I need to determine the best way to move the NPC on the client with regard to performance and optimization.
- What is the issue? Include screenshots / videos if possible!
I need a smooth and performant way to move enemies from A to B. Just to clarify, I’m only looking for someone who is experienced on this topic to point me in the right direction, I don’t need any code.
After completing the NPC replication system I struggled to figure out a good movement system. The current system works by setting the model’s pivot on the client at every pathfinding node reached. This was great as a placeholder to test my replication system but of course the movement is choppy and positions only update every 4 studs (this was never meant to be a solution).
I just need to know what solution is optimal. I already have a few options, but it’s very difficult to choose one because they seem to negate the performance benefits of rendering NPCs on the client. I could be entirely wrong though and that’s why I’m here.
- What solutions have you tried so far? Did you look for solutions on the Developer Hub?
To my surprise I was unable to find any help after an hour of looking through developer forum posts surrounding NPC movement. Most of the posts I read through gave similar, lackluster answers or disregarded memory usage/performance. The following is what I found, but after researching each on the developer hub I, was still not confident in their capabilities:
- TweenService. Creating a new tween object at this rate seems very costly to me and I want to keep performance in mind.
- BulkMoveTo (connected to Heartbeat). I haven’t tried it but I am worried smooth movement would be difficult to achieve, and just as costly as TweenService.
- AlignPosition and AlignOrientation. I used these for a previous game actually, and they work well. The problem for me is the use of physics parts, seems unnecessary.
I feel like these are really the only options, so, I believe I’m misguided on the performance impact of each or how to properly implement them. Please give me some guidance!