Announcement

Collapse
No announcement yet.

Replicating projectiles

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

    Replicating projectiles

    hi guys anyone please can tell me how to replicate projectiles. i just dont get why it is not working. the projectile is being spawned by the server but no matter what i try the clients never see each others projectiles only there own.

    thanks

    #2
    Is your Projectile set to Replicate?

    If it doesnt Replicate itself it wont be visible to other Players.
    Im an Moderator on UnrealSlackers Discord! Which is a Community driven group of likeminded people here to discuss UE4! Join UnrealSlackers on Discord!

    Comment


      #3
      You need to Set Replicates on the return value of SpawnActor OR set the actor to replicate in the blueprint

      Click image for larger version

Name:	tng6CuM.png
Views:	1
Size:	322.2 KB
ID:	1099585

      Comment


        #4
        Click image for larger version

Name:	0RmNE53.png
Views:	1
Size:	77.7 KB
ID:	1099596

        tried that still doesnt work

        besides i had already done that in the editor
        Click image for larger version

Name:	tVdhdYC.png
Views:	1
Size:	13.9 KB
ID:	1099597

        Comment


          #5
          Have you set the owner of the gun? and you also need an instigator on the projectile spawn

          The gun also needs to replicate in my experience. Also needs an owner and instigator or the server doesn't know who stuff belongs to. You can set owner on pickup or on spawn.

          Click image for larger version

Name:	22JdFCJ.png
Views:	1
Size:	172.0 KB
ID:	1099615

          Replication is a *****, miss one checkmark and stuff stops working. Variables are the fun ones because you need to figure out what needs replication and what doesn't
          Last edited by DEDRICK; 01-30-2016, 11:41 AM.

          Comment


            #6
            Hmm I had an imstigator but not owner ok thanks ill give it a shot and get back to you thanks

            Comment


              #7
              Ok so after a lot of playing around I think the problem is the bullet mesh is too small and moving too fast to be seen. When I changed the mesh to a giant rock I was able to see it flying through the air.

              instead im going to just use a bullet trail emitter and then one again at the impact point. I have it spawning at the muzzle point but then how do I attach it to the bullet or do I just move it the same as the bullet .

              and then the replication. At the moment the bullet is spawned server side the emitter is spawned server side so obv it is only showing up on the server and not the clients so what would I have to do to replicate the bullet trajectory and emitter trail to all clients?? make a multicast event and spawn amd move the emitter as well??

              Thanks
              Last edited by EniGmaa; 02-04-2016, 07:12 AM.

              Comment


                #8
                Can you do Event BeginPlay Spawn Emitter Attached (Projectile mesh) in the projectile itself? Because the projectile is replicated the emitter should automatically be replicated.

                Multicast is good for when you are doing a Hitscan(Linetrace) weapon and need the emitter to spawn on both the client and server. Server does Linetrace and Emitter, Client just does emitter

                Comment


                  #9
                  okso after hours of frustration it turns out the answer was easier than i thought you do not even need to spawn it or nothing. in you're projectile blueprint just add the particle system as a component like so

                  Click image for larger version

Name:	rb6UVSB.png
Views:	1
Size:	163.8 KB
ID:	1099873


                  and then select the particle effect in the editor.

                  Click image for larger version

Name:	0ODI8G1.png
Views:	1
Size:	16.7 KB
ID:	1099874

                  and voila you now have a particle effect that attaches and follows the bullet.
                  Last edited by EniGmaa; 02-04-2016, 04:28 PM.

                  Comment


                    #10
                    That tracer reminds me of beta Planetside 2 NC tracers

                    One question though. Why are you not using a projectile movement component? It provides a lot of functionality like Gravity, muzzle velocity and bouncing
                    Last edited by DEDRICK; 02-04-2016, 06:36 PM.

                    Comment


                      #11
                      Originally posted by DEDRICK View Post
                      That tracer reminds me of beta Planetside 2 NC tracers

                      One question though. Why are you not using a projectile movement component? It provides a lot of functionality like Gravity, muzzle velocity and bouncing
                      Well to be completetly honesst im still quite new to unreal and also shooting games so far ive only made melee combat and rpg systems etc so at the time I didnt even know about the projectile movment component so I ended up writing my own custom functions to move the bullet , add wind etc .

                      also not sure if anyone else does this but instead of using collisions to detect if the bullet has hit or not i do a tiny line trace from the bullet if it doesnt hit what i want it keeps calling the move function to move itself and if it does hit It calls the impact function and applies decals, damage etc .
                      Last edited by EniGmaa; 02-05-2016, 02:29 AM.

                      Comment


                        #12
                        That is actually quite clever of you.

                        Comment


                          #13
                          ok so everything seemed to be fine but i was getting wierd kind of tracer lag when fireing. i am going to try to use the projectile movment component instead of manually moving the projectile myself. Can someone tell me how to set it up please i keep getting wierd results where the projectile now doesnt fire where im aiming etc thanks

                          Comment


                            #14
                            Projectile movement uses Local Space X for muzzle velocity or direction and converts it to world space when the projectile is spawned. So if you want your projectile to have a 80m/s muzzle velocity put 8000 in X.

                            Click image for larger version

Name:	RfFO575.png
Views:	1
Size:	59.8 KB
ID:	1100025

                            When doing math calculations to initial muzzle velocity, like momentum inheritance(TRIBES), you need to use Set Velocity in Local space. When you put these 2 images together you can see how my weapons handle speed and inheritance and pass it to the projectile



                            Click image for larger version

Name:	CvBp1tC.png
Views:	1
Size:	252.4 KB
ID:	1100026



                            Wind you should be able to to use the world space velocity, which can be pulled from Projectile Movement or Get Actor Velocity
                            Last edited by DEDRICK; 02-07-2016, 01:41 PM.

                            Comment

                            Working...
                            X