Network object ownership

I've been thinking about how to handle in game object ownership transfers. (I'm using the Photon Cloud beta)

Let's say player 1 creates an object A, and sells it to player 2 who should now own it and can destroy it or make modifications to its properties. Is there anyway for me to change the owner of the network object?

Comments

  • in both cases the owner should be the server as its just an item on the actor, not a self existant thing under the players control

    and no you cant transfer ownership. you would have to destroy and recreate it
  • Ok, since I'm using Photon Cloud and you can't run server side code in Photon Cloud, I'm planning on creating a separate server and running master clients from that server to perform authoritative tasks in the game rooms.

    I have a few questions though. There doesn't seem to be an opcodes in the Unity plugin that allows a master client change request. Say I need to take the machine that runs the master clients down, instead of booting everyone from the room, can I have a second machine take over and transfer the master client status? The current code seems to pick master clients based on lowest client ID. Is it possible to designate a backup master client in case the master client disconnects?

    It it better for me to implement a socket server on the machine that runs the master clients and have the players make requests directly over TCP to the master client server, or to use player messaging to the master client to make requests?
  • The current code seems to pick master clients based on lowest client ID.
    Right. The logic for this is completely client side and arbitrary.
    You could implement a check who's master in any way you like. If you wanted to, you could drop or ignore the whole isMasterClient part in the plugin.
    You're able to transfer any data needed, so you are also able to transfer to another master you elect. Just keep in mind that if your original master is gone, it can't transfer anything anymore.
    It it better for me to implement a socket server on the machine that runs the master clients and have the players make requests directly over TCP to the master client server, or to use player messaging to the master client to make requests?
    I don't really understand what you're asking. In best case, your authoritative clients should run in the same local network as Photon. Then TCP would be the best solution. As you are using Photon Cloud, you should probably also use UDP like in any other client. It's reliable where needed and unreliable where possible.
  • My understanding is that when a client disconnects, all the objects owned by that player gets destroyed. This creates a problem. Suppose I implement a master client for each game room, and the game room has persistent objects like buildings which are owned by the master client. If the master client disconnects, then all the buildings are gone. I was trying to think of a way where the ownership of the master client's objects can be transferred to a designated backup master client so that there's some failover.

    For the second question, I was asking if it's better to create a separate side connection to the server running the master client (independent of the connection to Photon Cloud). So for example, if the player is trying to construct a building, which needs to be persistent in the game room, he would request that the master client instantiate a building. Would it be better to send this request via a side TCP request or do it via Photon RPC? Since the master client can't run in the same local network as the Photon server since I'm using Photon cloud, I was wondering if this solution would have lower latency than routing everything through photon cloud. (In this scenario, there is 1 client and 2 servers, the photon cloud server, and a separate server hosting the master client)
  • The new package (v1.4) allows you to not auto-clean the objects of users.
    This should help but it means everything of all users stays buffered. This is mostly a problem, if games run for a long time and many players get their stuff in the buffer.
    Let us know if this might work.

    About the "dedicated MasterClient": There is no p2p for Photon, so you would have to solve "connecting to my master" yourself, if you don't use Photon in between. That's usually quite some effort.
    You could safe a few ms of delay but aside from opening up the complete "i have to do networking" topic, you also would have to get things in order with everyone else in your game. You lose the per connection sequencing Photon gives you.


    I wonder if it would be so much extra trouble for you to host Photon in conjunction with your dedicated masters. You gain performance as the headless instances are in the same network and you could potentially offload work to Photon itself and customize it's logic. Most likely, the instances of Unity will use more resources than Photon, so scaling is not really solved for you by the cloud anyways (you would have to scale for unity instances).