Projectile is not replicating on clients at close range and at high projectile speed

Hello everyone,
I am working on a multiplayer third person shooting game which is using dedicated server. When the character shoots a bullet projectile, the server spawns it and replicates it to all clients but the problem is that it does not replicate projectile at close range to the hit target (anything) but when the projectile movement speed is below or at 1000 it replicates and shows collision.

  1. I have a character blueprint in which he has weapon, the character is able to shoot using a weapon.
  2. Weapon blueprint to calculates shooting eligibility, trajectory of the projectile, spawns of the projectile and updates of the ammo of the weapon.
  3. The bullet blueprint which is the projectile, checks if it is server then replicates it to all clients, spawns effects and do damage if the target hit is the character.

Following are what I have done so far to make it work correctly,

  1. Checked and verified execution paths by printing the strings
  2. Debugging all functions and nodes involved in the process of shooting the projectile.

I don’t know if I am missing something or doing something wrong which I am not able to identify. I am hoping that someone will help me in with this problem and points me in the right direction.

Screenshots are in the attachment. Thanks :slight_smile:

hey
is your projectile actor set on replicated in the class default? Replicates and Movement Replicates
or is the replication just not working on high speed and close range?

____.png

Yes projectile is set to replicate but not to replicate movement, but I have tried after checking both of them and still the problem persists.

okay if I understand you right you don’t get a hit when the projectile speed is too high so I think that maybe your projectile is at one frame before the collision in front of the collision (not hitting) and at the next frame behind the object/collision. So then I would recommend making a line trace or a bigger collision. If that is the case.
If that is not the problem then maybe how you set the speed. As long as it is set in the projectile component it should be fine.

Would you mind making a video showing us your problem? I found it hard to understad what it is.

By the way, why are you calling TakeDamage at the client?

If it’s a collision problem you may need to enable ccd on the collision. I have to do this in my game because the ball at high velocity will go through walls.

There is s cost with ccd.

Think of a high speed camera verses a slow speed camera and a object moving.

Each frame it checks for collision at high speed a physics object approaching a wall can be seen as not impacting then a frame later be passed it because no fear was capture in time.

Imaging moving your hand in front of you left to right with a wall in between. But you close your eyes before the wall and open after. There is that loss of collision due to speed verses checks.

I am using TakeDamage in the player blueprint

[video]https://drive.google.com/open?id=0BwaSFS_8e3uWekVUN3REcWhwaTQ[/video]

As shown in the video, server is taking more time to replicate(update location of the projectile to the clients) than the speed of the projectile.
In Projectile blueprint, checking “Update only if Rendered” under “Movement Component” is replicating projectile at client side with smooth movement as soon as it is spawned at the server but by making it true, hit event is not working on server. It is only working on the clients.

I’m still confused about the problem, but the TakeDamage should be called and handled on the server. As an example, if on TakeDamage you would like to change the value of Health you would be able to, since you’re on the server and the Health variable is replicated. Inside TakeDamage, you could also call your multicast (Executes On All) Custom Event to handle client-side particle effects and others.

In this [picture](

&stc=1&d=1490726563) you provided, TakeDamage is being called client-side in every client, which seems incorrect, since the server should have the authority on this matters. Try handling TakeDamage server-side.

EDIT: I’m not sure if this is the problem you’re talking about, but I couldn’t see any projectiles at the video. Try taking a look at your TakeDamage (which would also be a problem) and see If your problem persists.

[MENTION=228735]Muhammad Yousuf Khan[/MENTION]

Just a question. Does your projectile blueprint consist of a collision and a default scene component? Or is your collision the parent of the whole blueprint? I recall having problems with collisions, when the collision box or something wasn’t the parent of the whole actor.

Agreed the collision should be the root with whatever mesh etc as a no collision cosmetic.

can you maybe make a video where we can see the projectile just use a static sphere mesh with no collision and a red material?