So I recently read a topic on how to optimize npcs when I read these 2 parts I got kinda confused:
This is a suggestion that gets thrown around a lot, but it’s true. The server should handle all the NPC logic . You shouldn’t waste resources animating or handling other visuals of your humanoid on the server. It’ll get expensive really fast!
The idea here is that the visualization of an NPC’s movement can be done on the client
Does this mean I have to do moveRemote:FireClient(player, pos) on the server, and then when the client receives it, it will move the npc to that position? Or am I not understanding something here?
No. I believe visualization of movement refers to the like animations that show movement. You handle all the movement logic on the server and then animate on the client.
In this case, movement is referring to visualising their movement (animations, effects and the like), not actually moving around the NPC. Actually moving the NPC is logic and should be done on the server, but their animations can be done on the client.
You can handle actual NPC movement on the client though. In the case that you have an implementation where a server-side NPC is just pure data, then the client would also need to hold the responsibility of moving the NPC towards the position the server has down.
Not necessarily, since this is a more niche optimisation idea and isn’t observed by a lot of games since it’s much more convenient to have the server handle them. It’s not as hard as you think: you’ll just need a handler that applies animations across registered NPCs. For example, CollectionService can register NPCs (tag them) and a function can go over tagged NPCs to set up their animations.
By niche I mean that it’s not something widely done. Ideally the client should be handling anything and everything visual, including animating other objects. The optimisation benefit is that the server isn’t spending resources trying to do intermediate movements and has more to spend on more important tasks.