Search Unity

Photon Unity Networking

Discussion in 'Connected Games' started by tobiass, Aug 23, 2011.

  1. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
    @DuvE: Sorry about the confusing doc and comparison. That's not our intention but things are a bit complicated to explain. Let me try.

    1: Games done in Bolt make the clients of a match connect to the host, which is also done in Unity / Bolt. All communication goes through this one instance, be it on a user's machine or on a server. If run on a server, we talk about hosting dedicated Bolt instances, which Exit Games does not provide. This doesn't define how authority is handled. It's only how clients connect.
    For PUN, there is no "host" instance. The clients connect to a server, which distributes their messages. It's also a star-topology but a "dedicated" server in the middle that always only enables players to communicate. The server for PUN is an "advanced relay", which means it can send some message to "all other" players in a room (and more).

    1.B: You pay for CCUs in Bolt because Bolt uses our servers for matchmaking and relay, if that's needed. Also, you fund production of Bolt with a somewhat fair share, based on your success. It's not a upfront fee that may never pay out.

    1.C: Bolt Dedicated Server cannot be hosted on Photon Cloud because that particular cloud is built to run Photon Servers, not arbitrary software.

    2: Hosted on clients side is fine for many games and it's affordable. A lot of games use this model, although you're right: The dedicated server is the optimum. It depends on your ambitions and funding, if a dedicated hosting is feasible. You can host the heck out of Bolt instances at will.

    3: PUN is less good for shooters, because the integrated features are different from Bolt. It's a different solution with different features and targets. Bolt was developed with action games / shooters in mind, PUN not.
     
  2. DuvE

    DuvE

    Joined:
    May 22, 2016
    Posts:
    107
    @tobiass:

    Thanks for a quick and detailed answer. But I need to ask some more questions to make this perfectly clear for me.

    4. In my previous post, I also asked about CCU and gave an example. Could you please check it too. Basically, I asked if there is 1000 player playing a game and only 50 of them used some special item to enable "Searching for a Duel" state. Other 950 player playing offline (until they decided to activate this item in the game), so the CCU will be only 50?

    5. About Photon Bolt Host Migration (for 4-5 players room for example), are there tools to implement this in Bolt? Or I need to write this migration system myself?

    6. If I decided to make a game using Bolt with one Player-as-Server variant, will it be possible (I mean not extremely hard) to convert this to a Dedicated server system? Or I need to rewrite all Bolt code in my game?

    7. And last and most silly question of all. I can't find some basic info about differences of the relay server and actual Dedicated or Client server/host? I need to understand which operations happen on Host Server and wich on the relay server? Relay server creates rooms and connects players to each other, but all the objects syncs happen on the actual Host server, right?
     
  3. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    331
    Hi,

    Ok, I could reproduce, you are talking about the roomInfos not being updated right? In my tests I do get the callbacks but the roominfos is not updated. it will be fixed in the next update.

    if it's a different issue, can you explain?

    Bye.

    Jean
     
  4. onurerler

    onurerler

    Joined:
    Apr 10, 2013
    Posts:
    12
    Hi,
    I mean if i set custom properties of currentRoom, CustomProperties hashtable stay empty

    I modified SetCustomProperties method in the room.cs file temporarily to work in offline mode

    my modified method is:

    public virtual void SetCustomProperties(Hashtable propertiesToSet, Hashtable expectedProperties = null, WebFlags webFlags = null)
    {
    Hashtable customProps = propertiesToSet.StripToStringKeys() as Hashtable;

    if (this.isOffline)
    {
    // invoking callbacks
    this.LoadBalancingClient.InRoomCallbackTargets.OnRoomPropertiesUpdate(propertiesToSet);
    this.CustomProperties.Merge(customProps);
    this.CustomProperties.StripKeysWithNullValues();
    }
    else
    {
    // merge (and delete null-values), unless we use CAS (expected props)
    if (expectedProperties == null || expectedProperties.Count == 0)
    {
    this.CustomProperties.Merge(customProps);
    this.CustomProperties.StripKeysWithNullValues();
    }

    // send (sync) these new values if in online room
    this.LoadBalancingClient.LoadBalancingPeer.OpSetPropertiesOfRoom(customProps, expectedProperties, webFlags);
    }
    }
     
  5. Jean-Fabre

    Jean-Fabre

    Joined:
    Sep 6, 2007
    Posts:
    331
    Hi,

    yes, that's what we have now in our code base and will be shipped in the next update.

    Bye,

    Jean
     
  6. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    8,057
    Where/how do I limit the number of players that will be placed in a room by JoinRandomRoom?

    And if I don't set it, what limit applies by default?
     
  7. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,218
    You use the RoomOptions when you create the room.

    Code (CSharp):
    1.      
    2.         var ro = new RoomOptions();
    3.         ro.MaxPlayers = 24;
    4.         PhotonNetwork.JoinOrCreateRoom("RoomName", ro, null);
    5.         // Could also use PhotonNetwork.CreateRoom("RoomName", ro, null);
    6.         //if you don't want to try joining an existing room first
    7.  
    From memory I think the default is 8, but I could be wrong, I always specifically set the amount.
     
    JoeStrout likes this.
  8. BrandonF_doghead

    BrandonF_doghead

    Joined:
    Apr 17, 2018
    Posts:
    5
    Hello!

    My team is using PUN 2 and Photon Voice 2 in a project of ours. We are currently having issues with v2.6 for both PUN and PUN Voice 2.

    Here is a reference to both assets on the Unity Asset Store, just to make sure we are referencing the same ones:
    PUN 2- https://assetstore.unity.com/packages/tools/network/pun-2-free-119922
    Photon Voice 2 - https://assetstore.unity.com/packages/tools/audio/photon-voice-2-130518

    We are having an inconsistent bug occurring when users are the same room. Even though the Photon.Voice.Unity.Recorder is created properly and receiving local input (verified using the Debug echo), the other users cannot hear each other. This issue does not always occur and is somewhat random. In testing this, the issue occurs about 20-30% of the time.

    When this issue occurs, we have traced the stack and found Photon.Voice.VoiceClient's delegate RemoteVoiceInfoDelegate OnRemoteVoiceInfoAction is not being invoked. When this delegate is invoked, the issue does not occur and the users can hear each other.

    I'm posting this in hopes someone can guide us in the right direction if there is in fact something we are doing incorrectly when initializing the Photon voice components. Does anyone have an idea what we may be doing wrong?

    Thank you!
     
  9. nikix22

    nikix22

    Joined:
    Jan 16, 2015
    Posts:
    20
    Hi to all :) I have one issue with using Youtube player inside application and PhotonNetworking together.
    I am getting after some short time DisconnectByClientTimeout and player LeaveRoom and it disconnects in the middle of the game, while there is no Youtube player all works perfect.
    So far I founded that cause can be that something is activating OnApplicationPause method and that causes PhotonNetworking to do disconnects without reason because it thinks that is minimized mobile application? I am running on PC so I don't need that :).
    This is only happening when I am using Youtube player plugin in the level and run multiplayer.

    So I am wondering how I can prevent PhotonNetworking to not receive DisconnectByClientTimeout event? I need only when user press some key.
     
  10. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    1,218
  11. nikix22

    nikix22

    Joined:
    Jan 16, 2015
    Posts:
    20
    Yes, it is enabled, and even photon itself is setting it to enabled, from code. It is just confusing that photon is receiving event to disconnect withou players explicit command, can't find the cause.
     
  12. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
    Does Unity call OnApplicationPause, when you run the Youtube player?
    Check if Update() is being called by Unity, while you play videos. If not, the PUN client will stay connected for a while but ultimately timeout to prevent users from being connected indefinitely.
     
  13. JohnTube

    JohnTube

    Joined:
    Sep 29, 2014
    Posts:
    61
    Hi @BrandonF_doghead,

    I replied on our forum here.
    Let's continue the discussion there.
     
    BrandonF_doghead likes this.
  14. nikix22

    nikix22

    Joined:
    Jan 16, 2015
    Posts:
    20
    Hi :) there is a method inside YoutubePlayer class - OnApplicationPause. That could be a cause. I think I tried before to disable it somehow, but it looks like it is called again etc.
    Update is called in many places, I don't think that is a issue.
    ... Also, I will try next situation. Maybe this is happening if there is just one player in room? Sounds logical that this can be cause disconnecting because there is no need to transfer anything through network?
    Will try with more players in meantime...
    Thanks for fast reply! :)
     
    Last edited: Feb 11, 2019
  15. nikix22

    nikix22

    Joined:
    Jan 16, 2015
    Posts:
    20
    I tried on other computer, older one :) all is perfect!!! It looks like there is problem on my local machine.
     
    tobiass likes this.
  16. DavidSWu

    DavidSWu

    Joined:
    Jun 20, 2016
    Posts:
    113
    We do mobile, but whenever we want to play something external, like an ad, we set PhotonHandler.Instance.KeepAliveInBackground to 5*60*1000 (5 min)
     
    nikix22 and tobiass like this.
  17. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
    We just released a minor update to PUN 2 and PUN Classic.

    v2.7 (13. February 2019) (download)

    Fixed: Offline mode. Custom properties are now set properly.
    Renamed: PhotonNetwork.BackgroundTimeout is now PhotonNetwork.KeepAliveInBackground.
    Fixed: PhotonNetwork.KeepAliveInBackground now sets the ConnectionHandler.KeepAliveInBackground, which actually affects the background keep-alive.
    Fixed: A crash problem on Nintendo Switch. Setting a Thread.Name caused a crash in some Unity exports. We work around this by simply not naming internal threads.
    Updated: Photon3Unity3d.dll library to 4.1.2.9, rev4985.
    Photon Chat:
    Added: Client API for Max Subscribers and Publish Subscribers features inside public channels.

    v1.93 (17. January 2019) (download)
    Fixed: Support for 2018.3 and newer prefab editing workflow.
    Fixed: SetInterestGroup() for Offline mode. If offline, it can simply skip the call to OpChangeGroups and avoid some log spamming.
    Fixed: RPG Movement Demo. It was all-black in the last version, it seems.
    Updated: To Photon3Unity3d.dll v4.1.2.6, which is the same as used in PUN 2 with several performance improvements. See plugins\release_history.txt.
    Added: PhotonPing classes for the Best Region feature. They are not part of the used dll anymore (see below).
    Updated: SocketWebTcp.cs to match the new photon dll. It's now only compatible with Unity 5.3 and up.
    Photon Chat:
    Added: Client API for Max Subscribers and Publish Subscribers features inside public channels.
     
  18. Vagrod

    Vagrod

    Joined:
    Aug 4, 2017
    Posts:
    63
    (see UPD first)

    Hi! I just started using PUN2, and I cannot figure out where I am wrong:
    I am doing this:

    1. From LoadBalancingClient:
    Code (CSharp):
    1. AppId = PhotonAppId;
    2. AppVersion = Application.version;
    3. ConnectToRegionMaster(region);
    4.  
    5. PhotonNetwork.LocalPlayer.NickName = $"Player-{Guid.NewGuid()}";
    6. PhotonNetwork.PhotonServerSettings.AppSettings.AppVersion = Application.version;
    7. PhotonNetwork.ConnectUsingSettings();
    8. PhotonNetwork.GameVersion = Application.version;
    on every Update
    Code (CSharp):
    1. Service();
    From MonoBehaviourPunCallbacks:

    2. On OnConnectedToMaster:
    Code (CSharp):
    1. if (!PhotonNetwork.InLobby)
    2. {
    3.     PhotonNetwork.JoinLobby(MultiplayerClient.Instance.Lobby);
    4. }
    where MultiplayerClient.Instance.Lobby is
    Code (CSharp):
    1. private TypedLobby _lobby;
    2.  
    3. public TypedLobby Lobby => _lobby ?? (_lobby = new TypedLobby("swo default", LobbyType.Default));
    3. On OnRoomListUpdate I have simple "write every item to console"
    4. When player clicks New Room:
    Code (CSharp):
    1. var options = new RoomOptions();
    2. var rules = new Hashtable();
    3.  
    4. rules["dummy"] = "1";
    5.  
    6. options.CustomRoomPropertiesForLobby = new[] {"dummy"};
    7. options.CustomRoomProperties = rules;
    8. options.MaxPlayers = 2;
    9. options.IsVisible = true;
    10. options.IsOpen = true;
    11.  
    12. var player= new Hashtable
    13. {
    14. };
    15.  
    16. var success = PhotonNetwork.CreateRoom(Guid.NewGuid().ToString().Substring(0, 5), options, MultiplayerClient.Instance.Lobby);
    17.  
    18. if (success)
    19. {
    20.     Debug.Log("Room created");
    21. }
    5. When on one device I am creating new room, I see my debug "Room created" message (so everything is fine), and OnJoinedRoom is called right after. But when I launch second game instance, on other device, OnRoomListUpdate is always called with empty list. It returns empty list of rooms no matter what. I'm not seeing room I just created on other device.
    Where is my mistake?

    And how to re-request rooms? OnRoomListUpdate is called only when PhotonNetwork.JoinLobby is happened, so now on my Refresh Rooms button I am leaving lobby, and re-entering same lobby to make OnRoomListUpdate to trigger again.


    UPD: On the next day, on another network, at work, all worked. I'll check later at home -- why is it not working on a home wifi.
     
    Last edited: Feb 18, 2019
  19. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    292
    was the price of "Realtime" changed ??
     
  20. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
  21. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    292
    Ok I thought prices for bolt and realtime were higher than PUN but as I checked the site today they all have the same pricing, maybe I was thinking about Quantum.
     
  22. roka

    roka

    Joined:
    Sep 12, 2010
    Posts:
    451
    @tobiass Do you have renew some of your ssl certificate recently? because sometime, if as exemple i play 1 hours on europe server and then move on the USA East , the first try i get "WebSocket connection to 'wss://gcash015.exitgames.com:19090/' failed: Error in connection establishment: net::ERR_SSL_VERSION_INTERFERENCE". If i try to connect again , then i can connect without any problem.
    Thank you
     
  23. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
    @roka : There was no recent certificate change. It would be interesting to know if you can reproduce this or how frequent this happens.

    Edit: Please mail us: developer@exitgames.com. We would like to know the appid and see if we can find related logs on the server.
     
    Last edited: Feb 25, 2019
  24. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    292
    This might been answered before:

    -as I understand, the user can select a region and then lobby will have rooms only for that region, I can't find an option for a "worldwide" region, so user can freely select any room from any region that he wants to join (usually games will allow that option beside the option to filter out certain region)... my pun version is a bit old by the way not sure if this added on updates or not??
     
  25. pjccccc

    pjccccc

    Joined:
    Oct 7, 2015
    Posts:
    36
    'OnRoomPropertiesUpdate' never be called on other peers (works on local)

    I'm sure that class doesn't have 'OnEnable' or 'OnDisable' method.

    Unity 2018.3.6 and Photon 2.7

    bbwww.PNG
     
  26. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
    @pjccccc: Make sure to implement IInRoomCallbacks and to call AddCallbackTarget(this) for this class.
    Without that, no callback :(
     
  27. pjccccc

    pjccccc

    Joined:
    Oct 7, 2015
    Posts:
    36
    Yes I did, Even it works perfect in local (I mean, who executed the SetCustomProperty method)
     
  28. pjccccc

    pjccccc

    Joined:
    Oct 7, 2015
    Posts:
    36
    Nevermind, I think this is my fault too


    Another question:
    Do you think this is a valid implementation?
    It's not working for now with very strange behaviors.

    qqw.PNG


    Here's a full logs and sourcecode:
    https://gist.github.com/pjc0247/7cabc699e603c2f6c529c3c4d35a7848

    Serializer.ObjectToByteArray (System.Object obj) (at Assets/Scripts/Serializer.cs:61)
    Serializer.Serialize (System.Object customType) (at Assets/Scripts/Serializer.cs:51)
    ExitGames.Client.Photon.Protocol18.WriteCustomTypeBody (ExitGames.Client.Photon.CustomType customType, ExitGames.Client.Photon.StreamBuffer stream, System.Object value) (at <5b2c7915d6ca43908ac03c52eb97ef22>:0)


    Check this out, Photon executes totally wrong serializer method.
     
    Last edited: Feb 28, 2019
  29. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
  30. pjccccc

    pjccccc

    Joined:
    Oct 7, 2015
    Posts:
    36
    Yeah, I already tried it,
    I'll make a small reproducible project.
     
  31. pjccccc

    pjccccc

    Joined:
    Oct 7, 2015
    Posts:
    36
  32. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    292
    no answer for me? :(
     
  33. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
    Sorry, @Smart-hawk1! Missed your question.

    The regions are completely independent from one another and there is no built-in global matchmaking, sorry.
     
  34. kqmdjc8

    kqmdjc8

    Joined:
    Jan 3, 2019
    Posts:
    76
    Hey, I'm totally new into networking, but ok with programming - I've chosen photon, however most tutorials create really complicated games. For begging I just wanted to create a scene on which 2 clients control 2 cubes and it kind of worked. On client1 there are 3 cubes and on client 2 there are 2 cubes. On client2 game looks perfectly fine, on client1 there is 1 extra cube which never moves.

    Way I did this is:
    LOBBY: PhotonLoadLevel(game)
    GAME: at start - PhotonInstantiate(player)

    Am I missing something? PhotonLoadLevel loads scene with existing players on it, right?
     
  35. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
    Did you have a look at the Basics Tutorial?
    I need to understand what you mean by Lobby and Game. Photon uses "Lobby" in the sense that it's listing "Games" or more precisely in our terms: "Rooms". When a client is connected to the lobby, it's not in a Room (and vice versa).
     
  36. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,005
    Hello everybody! If I buy a game on the asset store that uses photon, will I be forced into photon's payment system, or can I compile server code and put it on a server of my choice?
     
  37. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
    @yuriythebest: Photon is not for free, if that's your question. As you "squeeze into the game dev industry", as your signature says, you probably also want to enjoy a salary, too. This is why Photon isn't free.
    That said: The 100 CCU Free Photon Server license, can be used to develop and host a game for up to 100 players at the same time. Any PUN based package can use this. For development and testing, you can also use a free Photon Cloud 20 CCU plan.
     
  38. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    115
    @tobiass what is a "master" compared to a lobby? Or are they the same thing? When I call PhotonNetwork.ConnectUsingSettings() does that just connect me to the Photon cloud, then I can join lobby's, etc.?

    Depending on the answer above, if I PhotonNetwork.JoinRandomRoom(), does that bypass the "lobby" if I'm not in one?

    Thanks!
     
  39. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,005
    Thanks! though here it says 100CCU is not free, only 20CCU
    https://www.photonengine.com/en-US/PUN/pricing
     
  40. eron82

    eron82

    Joined:
    Mar 10, 2017
    Posts:
    60
    I have a lot (19) of these errors after updating Unity 2017 to 2018 and comverting all js to c# with the unity tool:

    `Photon.Pun.Demo.Asteroids.AsteroidsGameManager.OnMasterClientSwitched(Player)' is marked as an override but no suitable method found to override
    `Photon.Pun.Demo.Asteroids.PlayerOverviewPanel.OnPlayerLeftRoom(Player)' is marked as an override but no suitable method found to override
    `Photon.Pun.Demo.Cockpit.PlayerDetailsController.OnPlayerPropertiesUpdate(Player, ExitGames.Client.Photon.Hashtable)' is marked as an override but no suitable method found to override

    etc...

    I tried to reinstall PUN but errors are still there.
     
  41. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
    @breban1: There is a "Master Server", which is for matchmaking. Lobbies are used to organize Rooms for matchmaking. Players don't meet in those. The result of matchmaking is a Game Server address and a room to enter. There, communication happens.
    Have a look at our glossary.

    @yuriythebest: The 20CCU are PUN on the Photon Cloud. The Photon Server has a free license for 100CCU. You host that.

    @eron82: Some files seem to be corrupted. Please import PUN 2 into a new, empty project. That should not fail. I would remove all "original" PUN 2 files from your project in the Explorer/Finder and then copy over the fresh import.
    Sorry for the hassle. Typically, the import works fine and we tested in various 2018 versions of Unity, too...
     
  42. breban1

    breban1

    Joined:
    Jun 7, 2016
    Posts:
    115
    @tobias Glossary, that's exactly what I was looking for, thanks!
     
  43. idealconceptz

    idealconceptz

    Joined:
    Aug 16, 2018
    Posts:
    3
    Hi - just started using PUN2 and all seems to work ok aside from one weird problem. The prefab I set in Resources keeps losing its renderer.

    I'm building to Android and using editor to test against, and it will run and build fine for an hour, and then suddenly, come up with...
    "MissingComponentException: There is no 'Renderer' attached to the "Game(Clone)" game object, but a script is trying to access it.
    You probably need to add a Renderer to the game object "Game(Clone)". Or your script needs to check if the component is attached before using it."

    I don't change anything on the prefab and I've tried creating new prefabs but still happens. I'm using basic Cubes and Spheres, and my script changes the color of the instantiated gameobject, hence the error.

    Any ideas why this is happening?
     
  44. eron82

    eron82

    Joined:
    Mar 10, 2017
    Posts:
    60
    Unity 2018.1 or 2018.3 and last version of the converter. If i create a new project with the photon i have no error but when i import thise files in my project or i import my project into the new one i have those errors.
     
  45. eron82

    eron82

    Joined:
    Mar 10, 2017
    Posts:
    60
    Finally i have found the problem. There is a converted script named “Player”. If i change the name i have no error with Photon.
     
  46. yuriythebest

    yuriythebest

    Joined:
    Nov 21, 2009
    Posts:
    1,005
    thanks tobiass! can the 100CCU free server have several "rooms/game instances"?
     
  47. guidkal69

    guidkal69

    Joined:
    Mar 15, 2017
    Posts:
    4
    Hi all,
    we are currently in the stage of looking into different multiplayer frameworks for a VR title in development. We think that Photon Bolt might be a good solution for us, at least from a technical perspective. Since the title is a shooter, things like server authority and client side prediction are all very much desirable.
    However we are concerned about the economical impacts of choosing a solution like Photon. We agree that the pricing scheme of Photon products is fair and having the possibility to grow "on demand" is a cool feature. However as a very small indy team we are aware that we are looking at end prices of let's say around 20€ per sold game at best. So quickly the question will rise on how fast this income is being chewed up by multiplayer related server costs for e.g. Photon Bolt. Especially since today we can not tell how much bandwith the game will use per player /second yet. While it seems appropriate and necessary to offer servers on our side until the game has some decent player base it is obvious that with a margin of ~10€ per sold game we will not last very long. Thus we need the option to enable our community to host servers and respective multiplayer costs on their side, e.g. like Counter Strike, CSGO and so on used(s) to work. For photon bolt it seems that of the four described scenarios on the Photon Bolt webpage the "Dedicated Server" architecture comes closest to this. However we are not sure whether a dedicated server can also be run by third parties (e.g. clans, enthusiastic players, ...) and those third parties carry all related costs for those servers and their traffic.
    Technically we would like to be able to run (headless) Unity instances on the server side, so that we can use all features of Unity during development in order to drive e.g. NPCs / AI. Currently we do not have the capacity to develop server side code outside of Unity. So this is another feature we need. The Photon Bolt webpage states that Unity instances can not be run in the photon cloud and lists some potential partners to do just that. But then again what is photon charging fees for? If the unity instances are run lets say on Gamelift then all traffic and CPU time will be bought from them right? What costs do apply on the photon side then? Obviously there will be two partners who need to be payed in this scenario. So the question is more than ever: How can this solution be suitable for any small indy team / product?

    We did not manage to find out which (if any) photon product will meet our described demands best.

    To sum it the following features / questions are on our whishlist / remain:

    1. Offer servers of our own. May it be on our own premises or in the photon cloud. In case of hosting unity instances somewhere else, what costs are left on the photon side?

    2. Let our community run servers. Is this possible and if so how would it look like in practice? How do we enable the community to run servers of their own? Do those servers genreate any costs on our side?

    3. Run unity instances as servers. Multiplayer relevant game logic is run and authored by those unity instances. Is this possible and if so which service is brought by photon and which service is brought by some third party (e.g. Gamelift). Do the photon prices listed on the website apply to a scenario where the gameserver is run somewhere else (in this case paying for e.g. Msg/s or traffic fees dont really make sense do they)? Or do we even pay "twice" for going doen this route by paying e.g. photon for "API" traffic and the gameserver hoster for "real" traffic. You see we are pretty much confused about this one. Sry about that...

    If you could shed some light on this with respect to the two products of yours - Bolt and PUN - that would be great. Thank you!
     
  48. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
    @yuriythebest: Yes. The workflow/logic is very similar to that on the Photon Cloud.
    @guidkal69: Photon Bolt is likely the best pick for your FPS project. The free package from the Asset Store gets you started.
    The cheapest option is to not run dedicated servers at all. Just run the game in anyone's client, as long as that is open. The fee is listed in the Bolt pricing page. It's a single fee for the software (client and server), development, maintenance and the service to run the Photon Cloud for matchmaking, etc.. There is no support included officially but we try to help as much as possible.
    If you really want or have to run dedicated servers, you could do that with "Bolt Pro".
    Edit: You and your community members can run dedicated Bolt servers. Bolt Pro has an integration for the zeuz.io hosting service. For that, you have contact us for access and pricing.
     
    Last edited: Mar 13, 2019
    Stanchion and ramonmelo like this.
  49. gmenito

    gmenito

    Joined:
    Sep 20, 2015
    Posts:
    2
    I have just imported PUN 2 Free into my project and I get this error:

    NullReferenceException: Object reference not set to an instance of an object
    Photon.Pun.PhotonNetwork..cctor() (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetwork.cs:983)


    This is the line of code:

    Code (CSharp):
    1. // Set up the NetworkingPeer and use protocol of PhotonServerSettings
    2. ConnectionProtocol protocol = PhotonNetwork.PhotonServerSettings.AppSettings.Protocol;
    I can't solve it. I can't also setup a project through the wizard because of this problem. What can I do?
     
  50. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,186
    The asset PhotonServerSettings is an asset that should get created when you import. Its a ScriptableObject of type ServerSettings.
    This seems to be a case where the settings are not created for some reason (maybe the compile errors) and this causes the errors in turn. A chicken egg situation which isn't common (else we would have fixed that).

    Check if the file PhotonServerSettings.asset is in the project.
    Did you try a re-import?
    Which version if Unity are you using on which OS?

    This should be a workaround: Above the error, insert this:

    Code (CSharp):
    1. if (PhotonNetwork.PhotonServerSettings == null)
    2. {
    3.     PhotonNetwork.CreateSettings();
    4. }