Need help understanding networking code(Shooter Demo)
I came across a code pattern many times while going through the shooter project. But I am not sure yet what exactly does it do.
Basically a as much as I could understand, this functions verifies from the server and calls a server version of that function.
But after a chain of functions, it calls this
I am really confused about what exactly does this do.
Whay does the ServerHandleFiring_Implementation() change the ammo and burst counter?
asked Dec 17 '14 at 01:59 PM in C++ Programming
Role==ROLE_Autority means that this code executing on server, otherwise on client. Therefore, when you press fire (on client) you execute StartFire function on client that call ServerStartFire. ServerStartFire initiate remote procedure calling of ServerStartFire_Implementation on server part. If you want to spawn actor on all clients you should spawn it on server. (If you spawn on client, you will have instance of this actor only on this client). That why all projectiles spawns on server. What about HandleFiring it is function to start all firing effects (animation, muzzles, etc.)
Replication is a very large question and it cannot been covered in answer. If you would like to know a little more about replication, please take a look at the post below. https://docs.unrealengine.com/latest/INT/Gameplay/Networking/Replication/index.html https://docs.unrealengine.com/latest/INT/Gameplay/Networking/Replication/index.html
Hope it helps!
answered Dec 17 '14 at 05:06 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here