I’m making a game where i need dynamic animations that are easy to cancel on certain events, and other things
The problem I’m running into is that my moves are running server side for ease of implementation when I make NPC enemies that need to use these attacks
My options here are:
1- Handle animations server side (bad)
2- Handle animations with lots of remote communication (not preferrable)
3- Handle animations with attributes or valuebases (seems kind of bad, there’s probably a better way)
4- Just handle NPCs on the client which I’ve never done and I’m not sure how to secure them
5- Handle moves on the client initially & have ai move logic handled separately fully server sided (not preferred, but if i handle ai on the client i wont need to have ai move logic server side)
I’m wondering if theres a better option than these, and if so how i should implement it. Thanks!
The reason I don’t want to use attributes is also each move has a set duration & its own subtrove from the character for easy cancellation. So if the move ends, but I need the animation to go longer, I need to do extra stuff to work around the animation instantly ending.
I recommend playing the animations individually for each client that needs to actually see the npc so it looks smooth for the players, and ai of npcs can be handled serverside, movement of npcs should also be handled (or mostly handled) serverside. You can use the timeposition property of animation tracks to skip keyframes, so all players can actually see the same animation at relatively the same time. This way, you can improve performance and optimize visuals.
Hi, this was originally what I had planned, but communicating to the client running the animation to do certain things (stop, speed up, etc) seemed like a pretty big issue to get done right & in the best way I can do it considering my past solutions to this have been pretty unoptimized using lots of client - server events for each animation.
Using a setup like this, or this setup, can reduce the amount of RemoteEvents you have. You can also reuse something like this setup to reduce the amounts of RemoteEvents you use for other stuff too!
I agree that this is probably the best way to start the animations, but how do you think I should handle ending them from the client as well, I’d assume just firing the remote again, but I also feel like this might be less optimized than other possible routes, what do you think?
Then you can just use AnimationTrack:Stop(), or you can use Humanoid.Animator:GetPlayingAnimationTracks() and loop through them to find an animationName and stop it like that.
Yeah, but how should I tell the client to do this, I want the animations to be client side, but I feel like firing a remote for every animation event on the client would be kinda of bad for my game considering its heavily based on combat involving these moves, and parrying moves to cancel them, so that remote would be fired a lot.
I’m not too educated on how expensive this would really be but I know generally you shouldn’t over fire remotes when you don’t need to. If this isn’t that bad of a solution I will probably just do this.
Conclusion:
Events are not that expensive, as long as you don’t spam it. You can have anti-spam on server and client side too. Also, you can manage what client needs to play what animation where, so you can get the best performance. If handling the animations serverside is too laggy, then just use a server → client side animation handler. As long as you limit how many animations are playing for each player, or for the whole server in general, you should be absolutely fine!
Ok, thanks. I know to handle animations client side, it was just my previous projects either handled this kind of poorly or didnt involve npc animations like this.