Need help with optimizing NPC's

These aren’t regular NPC’s they are meant to perform jumps using physics/body movers, constantly changing target destinations (not static). This would be fine if it was on the server, however as we all know it is not as smooth and may overload the server with too many.

I want the client to handle the movement, usually you would use :MoveTo() however with the addition of bodymovers and constant changing of the CFrame (during combat moves) I have no idea how I would go about achieving this. Sure I could send packets over the client every frame but wouldn’t that be too expensive in terms of latency?

Do games like bloxfruits do client sided NPCs as well? Any tips would be greatly appreciated

2 Likes

Yes, you are right, server-side processing of NPC movement may not be completely smooth and may create unnecessary load. I would recommend using client-side interpolation. Instead of transmitting data every frame, you can transmit data about the target(position/orientation) of the NPC every few frames. The client can interpolate the movements between these points, creating a smooth animation transition. This will significantly reduce the number of packets transmitted over the network.

I decided to go for a method in which I just SetNetworkOwner to the player that is being attacked by the NPC and try minimize every other humanoid preset such as their states, clothing ect