Announcement

Collapse
No announcement yet.

Multiplayer projectiles at high velocity problem

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Multiplayer projectiles at high velocity problem

    Hello,

    In multiplayer, projectiles that have "high" velocity, looks like are spawned later on client... Could someone help me how to solve this? I think its easy but i dont have idea how to do this...


    #2
    i have a velocity of 5k and dont have this problem . i guess there is something wrong with youre setup. maybe post some screenshots and we can help

    Comment


      #3
      Originally posted by EniGmaa View Post
      i have a velocity of 5k and dont have this problem . i guess there is something wrong with youre setup. maybe post some screenshots and we can help
      Hi, thanks for response, here is my BP:

      Comment


        #4
        What I did when I was working with projectiles in a game, is make a multicast event and create the bullets there(without replication). So basicly the bullet movement was handled by the clients based on the velocity and rotation I sent from the server. That way there were no laggy projectiles.

        Comment


          #5
          Originally posted by DjSt3rios View Post
          What I did when I was working with projectiles in a game, is make a multicast event and create the bullets there(without replication). So basicly the bullet movement was handled by the clients based on the velocity and rotation I sent from the server. That way there were no laggy projectiles.
          Hello,
          So i tried to transfer spawn projectile to multicast which works, projectiles looks like are almost spawned on muzzle location, but then damage event in projectile does not work (i know it runs only on remote and my damage event is server only but server RPCs in projectile didnt helped me)... Is this setup correct or something is missing?

          Last edited by Name368; 07-11-2016, 10:40 AM.

          Comment


            #6
            Well from this picture, it seems like no bullet is spawned in the server. Also, the damage, who is the owner etc is unnecessary for the clients, because only the server needs to check who is the owner, who got hit (for friendly fire etc). All you need to send the transform, and the client should handle the movement. I guess what's here is another projectile that spawns on the server. Also, I'd recommend not to add the Projectile on the multicast event for the server, because clients will also receive the data like the damage, owner, and they don't need to know this kind of information (it will decrease packet size). I hope I helped a little bit.

            Comment


              #7
              Originally posted by DjSt3rios View Post
              Well from this picture, it seems like no bullet is spawned in the server. Also, the damage, who is the owner etc is unnecessary for the clients, because only the server needs to check who is the owner, who got hit (for friendly fire etc). All you need to send the transform, and the client should handle the movement. I guess what's here is another projectile that spawns on the server. Also, I'd recommend not to add the Projectile on the multicast event for the server, because clients will also receive the data like the damage, owner, and they don't need to know this kind of information (it will decrease packet size). I hope I helped a little bit.
              I simplified it a bit, so if i understand correctly, this way i should to do it? Well it looks like it works but 2 projectiles are stacked on each other...

              (multicast rpc is set to multicast... before i taken image i forgot to switch it)

              Comment


                #8
                Seems like it should work, however make sure that the bullet does NOT replicate. And you can set the damage to 0, It's slightly better I think.

                Comment


                  #9
                  SOLVED

                  Originally posted by DjSt3rios View Post
                  make sure that the bullet does NOT replicate
                  Perfect! this works exactly as i wanted. Thank you a lot again.
                  Projectiles although looks like are not spawned at muzzle but it never mind, its still much better than it was

                  Comment


                    #10
                    Originally posted by Name368 View Post
                    SOLVED


                    Perfect! this works exactly as i wanted. Thank you a lot again.
                    Projectiles although looks like are not spawned at muzzle but it never mind, its still much better than it was

                    You are welcome As for the bullets, clients should see what the server sees, with a small delay. If the bullets do not spawn correctly on both client/server, then there must be a calculation problem. If you want to post some screenshots from where the bullet is getting created, how it gets the location it needs to be created etc, maybe we can help you some more

                    Comment


                      #11
                      Originally posted by DjSt3rios View Post
                      You are welcome As for the bullets, clients should see what the server sees, with a small delay. If the bullets do not spawn correctly on both client/server, then there must be a calculation problem. If you want to post some screenshots from where the bullet is getting created, how it gets the location it needs to be created etc, maybe we can help you some more
                      I think calculation is good because if you check my first post when i used 350 velocity, then projectile is spawned from muzzle, I think this looks like a problem of frame-rate, looks like first frame is projectile not rendered yet, distance between projectiles == distance from muzzle to first projectile rendered (when i run 2 clients, my FPS jumping from 40-60 FPS, mostly 35-40)

                      Comment


                        #12
                        There is a really easy way to solve this problem. Spawn the projectiles with 0 velocity. Keep them at this velocity for only 1 frame by using a very short delay like 0.01 Seconds. Then set the projectile velocity to the desired high value.
                        As the projectile will now appear for 1 frame right at the muzzle, your brain will automatically "fill" the gap to its next position. Obviously this trick can't compensate for very large lag spikes, but for my game it works all the time.

                        Comment


                          #13
                          Originally posted by XilenceX View Post
                          There is a really easy way to solve this problem. Spawn the projectiles with 0 velocity. Keep them at this velocity for only 1 frame by using a very short delay like 0.01 Seconds. Then set the projectile velocity to the desired high value.
                          As the projectile will now appear for 1 frame right at the muzzle, your brain will automatically "fill" the gap to its next position. Obviously this trick can't compensate for very large lag spikes, but for my game it works all the time.
                          Thanks i will definitely try this
                          edit: or maybe i can try to spawn "fake" projectile for 0,05s with no movement, only mesh
                          Last edited by Name368; 07-11-2016, 02:25 PM.

                          Comment


                            #14
                            Sorry wasn't at my computer but glad you have solved it. Yeah or if you don't want to mess with projectile velocity another way is to hide it with a muzzle flash effect coming from the gun muzzle so it looks like the projectiles is coming out of the flash .
                            Last edited by EniGmaa; 07-12-2016, 02:37 AM.

                            Comment

                            Working...
                            X