How can I sync random bullet spread between client/server?

I need clients to be able to locally predict random spread. I know I could just replicate the seed, but I’m guessing there’s already a way to do this without extra network overhead. Is there any sort of timestamp or built in synced RNG I could use to do this?

#Solution

  1. have a function on the server that takes in the direction and initial speed and such, and spawns a bullet on the server using that data
  2. have a USTRUCT that encapsulates all the data needed for a single bullet
  3. make an array of the above USTRUCTS that is replicated, as well as a boolean to trigger the replication
  4. Generate the array of USTRUCT on the server, and pass it to the client.
  5. Given the importance of this functionality in your game its not a lot of network overhead.

Just replicating the random seed may not be precise / reliable enough.

Rama

Replicating the seed is plenty reliable, the server knows the client’s orientation to 0.0055 degrees on each axis. What you’re doing is a massive waste of space, you’re sending a 96 bit FVector for every bullet.

What I’m going to do is use the timestamp already sent with moves to seed the RNG.

If you found a solution you like better, congrats!

Don’t forget to share your solution :slight_smile:

Rama