What is the most efficient way to move NPCs

Hey all,
I’m building a mini-game with enemies that spawn on the server in batches of 20 each time.
The enemies move on-screen randomly (well, inside a defined square) asynchronously.
What is the most efficient way to move them around? As in the easiest on the server.

Thanks in advance

I think you could calculate npc positions on the server and fire it to all clients for less stress on the server.

I feel like this is a last resort

I mean if you have that many npc’s then you obviously would be stressing out the server.

1 Like

I’m gonna reply to myself because I found a solution.
USE BODY POSITION (+body gyro), I cannot stress this enough.
The way the physics are processed is way more efficient than anything I can do code-wise. No tweening, no cframing, no pathfinding. This has got the receive to be the lowest and I mean like 0-5 constantly moving the 20 NPCs around at the same time. Also, it moves smoothly on screen. For the possible client/server delay I just use a distance checker when they are hit.
Hopefully, if someone sees this in the future it will help them as well.

1 Like