I want to achieve NPC animations that show up for all clients, but I want them to be optimized. I know that server-sided animations allow NPC animations be replicated across clients, but will they lag in the long term, and I know that client-sided animations are optimized, but will not replicate for multiple clients. How can I make NPC animations be both optimal and replicate across clients?
That’s right, local animations do feel like a good choice. Manage animations individually on each client. The workflow depends on what type of NPC it is.
- Static dialogue NPC:
This one can be completely reliant on local scripts, while anything that concerns the server is communicated via remotes.
- More “evolved” NPC:
An NPC that relies on server authority and movement can provide the client with states. Suppose the server uses an attribute called “State” which the client can read and connect a listener to. Regardless, the client responds by stoping and playing appropriate animations. You can define transitions, for instance, if previous state was jumping and the new one is running, adjust animation weights and transition into the new animation.
- Locally rendered NPC:
Games involving lots of non-player characters (like in tower defense genre) can benefit a lot from only controlling movement and states on the server, while the client is assigned with rendering. Humanoids are expensive instances, so those characters oftentimes have AnimationControllers. There are some discussions and resources on the forum around this topic.