Authoritative approach - clients not updated

Hello,

I'm pretty new to unity and Photon networking, however I've been trying to implement multiplayer physics for few days now. I've come to a conclusion that it would be best to use authoritative masterclient approach and my implementation almost works as I intended.

Mostly I've been following this tutorial http://www.palladiumgames.net/tutorials/unity-networking-tutorial/ on authoritative server using Photon API and masterclient instead of server.

Current behaviour:
-client inputs are passed to masterclient properly
-masterclient receives other client inputs, sets their movement and is able to see that movement on his screen
-other clients are unable to see themselves moving
-other clients can see only masterclient and scene objects moving properly, but they can't see their own movement. (they even see objects moving after they hit them, so they are really moving - it is just not projected on their screen)

I think I've tried everyhing and I've been unable to solve this problem for days. I have no clue what might be causing this, even though I thought I finally knew how it works.

I would be very thankful if someone could clarify this situation for me or provide any kind of solution/suggestion.

Script that is being observed by photonView on player objects: http://pastebin.com/QkdPtSDh

EDIT: I think I need to have server send RPC messages to clients to update their positions. I can't get it to work though :?

Comments

  • I didn't read the tutorial yet so it's a bit hard to answer. Also, I don't know your (scene, PhotonView) setup that well...

    Each PhotonView belongs to someone and only this person will send updates in the way set in the "observe" field of the PhotonView. Anyone can send RPCs with that PhotonView though, so your regular clients might send their input as RPC and the Master Client applies it and modifies the GameObjects accordingly. Due to those changes, the Master Client would also send updates (no matter if it observes a script or just the Transform).
    This is the simplest setup I can imagine, if you want the Master Client has to handle everything for the clients. The Master Client should also instantiate everything. In best case via InstantiateSceneObject(). That way, some other Master Client can potentially take over if the current one drops out of the game.
  • Thanks, InstantiateSceneObject() did the trick :)