Search Unity

Photon scene objects not players!

Discussion in 'Connected Games' started by brandonhotdo, Jul 10, 2014.

  1. brandonhotdo

    brandonhotdo

    Joined:
    Jul 26, 2013
    Posts:
    3
    I am using Photon View to make my game multiplayer but when ever an object gets instantiated trough photon view it thinks that the object is a new player, so that I can only instantiate 1000 objects in a server (The game I'm making you can build thing a bit like minecraft and if you can only have 1000 blocks you cant have any more . . .) Is it possible for a block to be seen on every ones game but not registered as a player?
     
  2. Cjreek

    Cjreek

    Joined:
    Apr 23, 2013
    Posts:
    33
    For non-player objects you need to call PhotonNetwork.InstantiateSceneObject or a normal Instantiate + RPC (depending on what you are instantiating)
     
  3. brandonhotdo

    brandonhotdo

    Joined:
    Jul 26, 2013
    Posts:
    3
    I have done that but it still only lets me spawn in a 1000 sence blocks
     
  4. Oliver-Eberlei

    Oliver-Eberlei

    Joined:
    Jun 12, 2011
    Posts:
    110
    Hm, to be honest, I would do it a little bit differently. Since each block only needs very few updates (when it's created and when it's destroyed) its complete overkill to have a PhotonView for each block. Here is a suggestion:

    Create a BlockManager object which will be the only one who gets a PhotonView. And then use RPCs to send events to create or destroy blocks to all clients. The BlockManager will then create the blocks on each client without having to instantiate a new PhotonView for each one.

    I've created a tutorial series about Photon and explain how RPCs work here:


    Also, it sounds like you are using a new GameObject for each block (I assume a basic cube). This is also very expensive when you want to have millions of blocks. There is a very good tutorial series on how to create an efficient block engine:

    Part 1: http://www.blockstory.net/node/56
    Part 2: http://www.blockstory.net/node/57
    Part 3: http://www.blockstory.net/node/58
    Part 4: http://www.blockstory.net/node/59

    These tutorials get quite complex very quickly. But this just shows that a good minecraft clone is not very easy to make :)
     
  5. brandonhotdo

    brandonhotdo

    Joined:
    Jul 26, 2013
    Posts:
    3
    thx bro your the best :D
     
unityunity