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
- 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
- have a USTRUCT that encapsulates all the data needed for a single bullet
- make an array of the above USTRUCTS that is replicated, as well as a boolean to trigger the replication
- Generate the array of USTRUCT on the server, and pass it to the client.
- 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
Rama