x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to pull off Client side projectile hit detection

Hello when i fire my weapon i let the server know that he needs to spawn a projectile and replicate it to all the clients, and that is working. My problem is that i want to use client side detection and i only want to tell the server about the hit when the hit is processed by the client that fired the projectile. I have a OnHit callback that is called on the OnComponentHit event of the Sphere component, and i'm running the game with 2 clients and a dedicated server. When i hit the target with a client, each client triggers the OnHit callback 3 times (i assume that it is one for the projectile instance in the server, another for the original client and another for the current client). If i put the condition Owner->IsLocallyControlled() then i can filter 2 cases (ther server and the current client instances), but i still need another filter condition to allow me to only execute the hit code on the client that shot the projectile and not the replicated versions in the other clients.

Product Version: Not Selected
Tags:
more ▼

asked Jul 28 '14 at 11:54 PM in C++ Programming

avatar image

xlar8or
6k 161 129 304

avatar image dzeligman Jul 30 '14 at 05:47 PM

Why do you want to do client side detection?

The server should have authority over what the projectile hits. It is the true version of the game world. The client replicated versions of the projectile are just simulated copies of the server projectile. The client projectile afaik really should have no need to talk back to the server.

avatar image xlar8or Aug 03 '14 at 09:12 AM

From what i've read, more modern shooters are resorting to client side hit detection, for example this link tells that Red Orchestra 2 default hit detection method is client side and not server side. I assume that is something related to be more fair to lagged players and also to make the feel of the gunplay be more responsive, i.e you don't have to wait for the communication and verification of the server to register the hit. Cheating is not a problem in my game so i'm not worried about that.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hello xlar8or,

After doing a bit of digging I was able to find a page in the documentation that appears to handle the type of issue that you are facing and I have provided a link below. If you look under the "Run on owning client" section I believe you will find what you are looking for. I hope that this information helps.

Link: https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/Networking/ReplicateFunction/Blueprints/

Make it a great day

more ▼

answered Dec 29 '15 at 08:56 PM

avatar image

Rudy Q ♦♦ STAFF
47.5k 545 132 522

avatar image xlar8or Dec 29 '15 at 09:40 PM

Thanks for the info, do you know the C++ equivalent?

avatar image Ben Halliday STAFF Jan 04 '16 at 03:50 PM
avatar image xlar8or Jan 04 '16 at 05:03 PM

Thanks for the info :)

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question