Shooting accuracy problem

Hello, I love this asset and it works great.

I am having some troubles with accuracy of the guns I have created when I am in a multiplayer session.
The animations and the positioning work fine - I can even assure you that the player is being shot in both instances of the game as I have turned tracers on to help me debug.
I have found what is happening is if :

Player A shoots Player B :
- 25% chance - The tracer appears to hit the enemy player on A instance, but completely misses on B instance
- 25% chance- The tracer appears to hit on both instances, but goes through the player and hitting the object behind the enemy player
- 50% chance - The tracer hits the enemy player and stops on the player in both instances and damage is dealt/he dies

Sometimes it seems that a player can become invincible and not take damage from bullets any more, as the tracers just phase through the player model on both instances - but then it will suddenly work again and receive/deal damage from one another.

I am also pretty sure that the bullet doesn't actually hit precisely where the aim-dot is either, even on the instance of the player who shot it

This results in most of the time players being unable to kill each other.
The box on both my players is attached to the capsule collider of the player just to see if it was moving funny or something.


Any help would be greatly appreciated.
Kind regards, Ben.
 

Attachments

  • problem.jpg
    problem.jpg
    674.2 KB · Views: 21
Here is an example of the shots landing on both instances of the game, but not doing damage.
 

Attachments

  • problem example 2.jpg
    problem example 2.jpg
    582.3 KB · Views: 17
It doesn't look like it, but is your character moving? The next update contains some improvements which improves the hit detection for moving characters. Beyond that are you able to tell me how to reproduce it within the demo scene? A video would also be helpful.

If you want to debug this the firing direction is synchronized within the PunLookSource component.
 
Thanks Justin, I actually think I managed to fix it last night.
The problem was occurring whether the enemy player was moving or not, but the problem was a lot worse when he was moving around.
I think by upping the Max Hitscan Collision Count the problem vanished.

I have no idea why this fixed the problem, as even when I would shoot at my character and the bullet with the tracer would pass through no object on its way to the enemy player, go straight through it and hit objects in the background instead.

My character is on the "Character" layer as well, I thought it may have had something to do with that but I am not so sure.
 

Attachments

  • colliders.png
    colliders.png
    23.2 KB · Views: 15
Hi Justin, I have come back around to this issue, as I mentioned above the Max Hitscan Collision Count seemed to be contributing to the problem, but I think what the problem actually is is that the shots/where the gunshots land isn't synchronized across the pun network?
 
I think the best way to see this is to just open the multiplayer demo scene and attach a tracer effect to one of the guns and play a multiplayer game with yourself.
One one screen, about 50% of the time the bullet tracer will hit the character and blood will appear, but on the other instance of the game the tracer has completely missed.
 
When the character shoots it sends an RPC to the Master Client telling that instance to shoot. During that time the Master Client has all of the client details such as the character location and camera location. It will fire the weapon based on those locations. If you have a faster paced game and there is also some lag then I could see the hit missing on the Master Client while it would land on the local client. You could try increasing the send rate of the PhotonView for the character to see if that helps at all.
 
When the character shoots it sends an RPC to the Master Client telling that instance to shoot. During that time the Master Client has all of the client details such as the character location and camera location. It will fire the weapon based on those locations. If you have a faster paced game and there is also some lag then I could see the hit missing on the Master Client while it would land on the local client. You could try increasing the send rate of the PhotonView for the character to see if that helps at all.
Nice I will be looking into this today.
By Increasing the send rate of the photonview, do you mean to change the Synchronization to something else other than Unreliable?
(Unreliable on change is the default selection)
 

Attachments

  • Capture.PNG
    Capture.PNG
    27.3 KB · Views: 15
Hi
We are having the exact same issue , the aim position is not correctly syncing in player 1 and player 2 screen. We tried in a blank scene with no objects other than 3d plane for ground ,if we are shooting the second player in head in screen 1,its not getting hit in screen 2. We also tried changing Max Hit Collision , but its not working .
 

Attachments

  • Screen 1.png
    Screen 1.png
    40.2 KB · Views: 3
  • screen2.png
    screen2.png
    90.1 KB · Views: 3
Have you tried increasing the send rate? If you debug the hitscane fire RPC are the directional vectors correct?
 
Hi thanks for quick reply ,I tried changing sendFrequency from 33 to 20 but still its not syncing correctly.When i shoot from close distance then it shoots correctly, but as i move farther and farther from target the difference between both screens becomes bigger.
also how do i debug hitscan fire RPC ?
 
Last edited:
You can look at PunCharacter.FireRPC and within the Fire method ensure the retrieved firePoint/fireDirection within ShootableWeapon.HitscanFire is consistent between instances.
 
Hi ,
We added a cube to see the firepoint direction , also we are firing at look direction. The look direction and firepoint direction are not syncing correctly.
 

Attachments

  • er2.png
    er2.png
    467 KB · Views: 7
  • er1.png
    er1.png
    447.3 KB · Views: 7
I have found a workaround solution for this. I am attaching these scripts. Just replace the scripts. also put the HitBugPatch script in Opsive/UltimateCharacterController/Scripts/Items/Action.
 

Attachments

  • HitBugPatch.cs
    716 bytes · Views: 7
  • INetworkCharacter.cs
    9.2 KB · Views: 7
  • PunCharacter.cs
    48.9 KB · Views: 6
Top