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

Is your Projectile set to Replicate?

If it doesnt Replicate itself it wont be visible to other Players.

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

tried that still doesnt work

besides i had already done that in the editor
tVdhdYC.png

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.

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

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

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

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

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

and then select the particle effect in the editor.

0ODI8G1.png

and voila you now have a particle effect that attaches and follows the bullet.

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 .

That is actually quite clever of you.

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

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.

RfFO575.png

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

&d=1454118410

Wind you should be able to to use the world space velocity, which can be pulled from Projectile Movement or Get Actor Velocity

ok this is good and all but in my game that i am working on only the server’s projectiles replicate, i would also like to replicate the clients projectiles and how do i do that please explain?