Author Topic: Host owned network objects and transferring ownership of network objects  (Read 6393 times)


  • TNP Alpha
  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
I am a heavy Photon users and one of the features I use that is preventing me from truly considering TNet right now is the ability for host owned network objects, no matter who they are instantiated from (which user/client) and the ability for ownership of network objects to be transfered between players.

Photon allows for objects to be instantiated as Scene owned objects (that basically are owned by who ever is the current Master Client) and if the MC drops connection, Photon automagically passes the token to the next player, so the game can continue, and all network objects that were either owned by the MC or the scene, get transfered to the new MC, with out a hiccup during gameplay.

The other thing it allows for is general transfer of ownership of network objects to other players, so if a player drops connection, another player can control that players units, without having both the Objects and any RPC's destroyed or lost.

Sure, all of this happens in the game logic (who gets what etc) but the ability is there to do it, and I cant see how that would work in TNet at the moment.

So here is my use case in Cubemen with Photon. Example is a 2+ player game, with AI (lets say 3 network players + 3 AI players )

The MC has his own units, but also owns all of the AI units (all AI player logic is done on the MC) and it also owns all Mobs - all as scene objects.

Player 1 is also MC in this example.

Half way through the game, Player 2 (FRED) quits/drops out. The "player" class for that player becomes AI instead. All of their mobs stay alive as they are scene objects owned by the current MC. All of heir units are now controlled by the MC as they are now AI.

The other players in the game get notified that Player 2 (FRED) is now AI controlled, and the game continues, without a hitch and there are still 6 players in the game.

Then, Player 1 (the MC) drops connection. Photon automatically passes the token of MC to the next (and in this case the only other player left) and they automatically inherit ownership of all scene objects. All of Players 1's units are now AI controlled and the game continues still with 6 players in the game, but now just one human and 5 AI.

The key here is that it solves the problem of Players dropping/quitting and the game breaking or the players units being killed off. It's about continuity.

So what I am looking for in TNet is the ability to :

1. Have Scene/Host (not player specific) owned network objects, so if the current HOST drops, the next HOST assigned automatically takes ownership.

2. Have the ability to have a dropped players RPCs/Objects NOT destroyed on their exit, so they can be transfered to another player in the game.

I hop this makes sense :-)


  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Host owned network objects and transferring ownership of network objects
« Reply #1 on: February 02, 2013, 05:33:14 PM »
1. In TNet, every instantiated object is owned by the server (not the host!), so there is nothing to transfer. You can determine who created the object (check TNManager.isThisMyObject in the object's Awake function).

2. See above. Since all scripts get the player left notification, you can check -- is this object owned by the player that just left? Yes? Well, now it's the host that owns it. That's assuming you even need to keep track of this stuff locally. If not -- don't worry about it.

3 & 4. Seamless in TNet. In the update check TNManager.isHosting -- if yes, do AI logic.

5. The cubemen example should already be answered by my clarifications of the points above, I think. :P