Variables that guide animation in my game have not been updating properly and in an attempt to replicate animations I followed a tutorial where setting up blueprints in the following manner allowed for animations to player properly when initiated by a client.
This is quite bulky however and also quite a repetitive pattern that while functional will take quite some time to update the many dozens of variables i currently have (and the few hundred i will eventually have). Even after the initial phase of development making changes to the system will become time consuming and be prone to error.
I feel as though i am missing something that would simplify this. Some sort of “clientInitiated” flag for variables on a blueprint that would more or less function like the blueprint listed above.
Can anyone point me in the right direction? Thank you for reading.
I ask before if organize ‘animation states in the boolean array’ is better approach, but nobody answer. After thinking array is still bigger and update it every time should increase net load, but all depend how much initial data must be set to start transfer information. So more tests
BTW: change replication mode to multicast after ‘authority nodes’ at this screen. That will work at last.
That screenshot makes no sense. IsAttack is a replicated variable. You shouldn’t be modifying it in a multicast. Set it once on the server and use an OnRep if you need to.
Also, SwitchHasAuthority is redundant coming out of a server RPC, it can not be run anywhere except the server.
You can do a bit better network optimization by making your actions/inputs deterministic. This will reduce the load per packet, therefore bandwidth consumption and network saturation. It’ll also reduce cheating in multiplayer. The setup posted above has the client “tell” the server what to do. So technically the client is the authority.
Each input by client should be scrutinized to determine “if” the action of can be done. The same should happen on the server.
e.g. Sprinting…
Input → switch has authority (remote) → func Can I Sprint → set Is Sprinting → Server Sprint [run on server]
Event Server Sprint → switch has authority (Auth) → func Can I Sprint → set Is Sprinting
There’s no need to pass a bool here. If it’s possible to sprint, the server will reach the same result.
You can also do a bit more to make a large portion of your client actions/inputs responsive… not having to wait on the server to respond or execute the action logic.
By adding the actual sprint logic to the above chain you can eliminate the inherited ping and server processing delays. For example a player with a 150ms ping will have a 150ms + srv processing delay before the action is carried out locally.
e.g.
Input → switch has authority (remote) → func Can I Sprint → set Is Sprinting → Do Sprint → Server Sprint [run on server]
Event Server Sprint → switch has authority (Auth) → func Can I Sprint → set Is Sprinting → Do Sprint
Appreciate the answer @Re0verDrive and I agree with the approach. I’ve been getting ramped up quickly with Unreal Engine and have improved a ton since even a few days ago when i posted this but this image of a proper setup will still go a long ways towards me learning the correct way to do things in this tool. Thank you.