Alright, so a seemingly simple issue has me stumped for three days. I use a line trace system to shoot (like call of duty, no projectile), and the server is more than happy to damage the client, yet the client is unwilling to damage the server. i’ve tried multiple variations to try and get it to work but to no avail. the simple “Apply Damage” does not work, i tried making a custom event set to Run on Server but the client won’t go through it, so i’m not really sure what to do. Let me know if you guys have any suggestions! More than willing to supply screenshots and/or my project if that will help fix the issue. Thanks!
All game logic (like damage etc) should be server side. So you send event to server telling it that player #n got hit by projectile.
Then servers decides if that player was really hit, or client shoot at some ghost (because ogf lag).
After that SERVER does damage and replicates it back to all clients.
If you allow client to cause damage on server you may forget all anti cheating.
how would i go about doing it for a line trace system? (apologies for not knowing, i’m still pretty new)
how would the client tell the server that they hit the player, then have the server decide? Thanks for the quick reply btw this has been killing me for the past few days and im glad you know what you’re talking about haha
this is great reference: http://cedric.bnslv.de/unreal-engine-4-network-compendium-released/
You also can see youtube tutorials, and unreal documentation.
Start with making execute on server event, any event will do like for eg print “hello”
Yeah i’ve read that PDF and watched a ton of tutorials, i got all the replication and everything working perfectly for animations and such, my only issue is damage. Could you give me a specific idea of what to do? I can give you some screenshots of what i have and maybe you could tell me what i need? I’ve tried all i can think of and i can’t figure it out /:
In this picture, the client shot the server and it says it has authority, but the apply damage does not activate. This kind of confuses me… if it has authority, and it tells the damage to be applied, shouldn’t it work?
Only events can be replicated from client to server. Replicating variables works only from server to clients.
In case of damage you make all damage logic on server , then replicate results to clients.
Make sure that actor exists on client and on server. This code works for some actors (ones that run on server) and will not work for actors that are clients side only.
Also you may try to make server side event instead of that switch authority and apply damage nodes.
On remote branch you call event that is execute on server. Then you apply damage.