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.
I have a character blueprint in which he has weapon, the character is able to shoot using a weapon.
Weapon blueprint to calculates shooting eligibility, trajectory of the projectile, spawns of the projectile and updates of the ammo of the weapon.
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,
Checked and verified execution paths by printing the strings
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.
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.
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.
&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.
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.