Spawn Projectile Client Side

Why in the client side spawn 2 projectils? in the server side only spawn one

Hi, I assume your projectile is set to replicate and you’re spawning it on the server and the client. Therefore the server will see one projectile (the one it has spawned) but the client will see two projectiles (the one the client spawned and the one that the server spawned that gets replicated to the client).

Therefore spawn the projectile only on the server and not on the client or don’t replicate the projectile and spawn it on server and client (depends on your setup which way to use but unless you try saving network bandwidth I would recommend you use the first way, so just spawn it on the server and keep it replicating).

hi, thx for reply, how can i do this? i spawn a “multicast” event, i try a event “run on server” but only the server see the shoot (and projectile) and i try “run on client” but only the client see the shoot, in the last two examples, only spawn one projectile, i try slow the event whit “time dilation” and i can see one projectile, and 0,5 seconds before a second projectile

Server replication needs to exclude the instigating client.

e.g. Client 1 fires -> server excludes replicating the shot to client 1.

how can i do this? i need some help, i have the same “two spawn actors” in all my “spawn an actor from class” actions

PAY ATTENTION, projectiles should be spawned on the server
WHY? because then the server creates a proxy for all clients,
DO YOU UNDERSTAND? DO YOU KNOW HOW TO SPAWN ACTOR SERVER SIDE? and do you know what bReplicates does?

i try, multi, run on server and run on client, only work whit multicast, but spawn two actors, now i try multicas, but no replicating the projectile, for the moment aparently work fine, thx for come here to SAY THIS in this gentle way, I wish more veterans were wish you

No problem, all I want is HELP lol : D, make a video if you want, and ill try to point it out, ill make a video as well, for you if you want. I know its complicated at the beginning.

Make a has authority check on the Projectile spawn function

Dead horse here…

Anyway, Client can spawn a local projectile, then RPC the server to spawn a server only projectile (no replication). Then multicast the servers projectile spawn velocity (or speed and transform etc).

The multicast needs to run a check to only continue execution if the local role is a Sim proxy.

e.g.


This is a Client-Fakey / Server Auth model. Shooting clients can spawn local only shots for responsiveness, hit fx etc. The server spawns its own projectile for its sim to determine authoritative hits/dmg.

The multicast to sims only ensures that the shooters simulated proxy on all other clients fires a shot for their fx etc.

When the servers projectile hits it multicasts the hit location to all sims. Remember the clients projectile handles its own local fx.

This is a simplified example of course. Point being we are only replicating small bits of data, thus making the process as bandwidth and network friendly as possible.

2 Likes