How to sync random incidents?

Options
Hi,

In my Photon powered game, I have a shotgun weapon and when a player fires a bullet, I call an RPC on other clients and it's bullets get direction from a random function, Random.Range, and on different clients it acts differently.

How can I sync this so in every client, the bullets behave the same, i.e. in this case they would have same directions?

I tried setting the same seed via Random.Seed but it didn't help.

Thanks.

Comments

  • mavasher
    Options
    Random seed isn't going to work.

    So whenever you need to have random events (which happens lots in games) the best course of action is to have the originator create the Random data then pass that data along with the RPC. I use this all the time. I need to have unique names for the large character objects in my game. The originator of the object (the player who is creating them, generates a random name and passes that name to the other players in the RPC.)

    You could easily pass the Vector3 direction. I assume you already need to pass the Vector3 origin of the bullet (the shotgun) .