Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Third Party Photon Unity Networking

Discussion in 'Multiplayer' started by tobiass, Aug 23, 2011.

  1. Tethys

    Tethys

    Joined:
    Jul 2, 2012
    Posts:
    672
    Regarding emails - Well that's good to know. :) Maybe something will come in later this week. We appreciate the offer and I did email the addy you supplied. Can we discuss further in email or PM, we have a few questions still about the formula? Thanks for the rapid response here too btw!

    I guess why we don't understand is at 40,000 copies sold, if 25% of the users started up their multiplayer game/server, wouldn't that be 10,000 servers running?
     
    Last edited: Feb 18, 2014
  2. gokhan

    gokhan

    Joined:
    Jun 21, 2013
    Posts:
    5
    I am having a problem when trying to test the sample for google native client. I get some some errors when I select Google Native Client"

    $Capture.JPG

    It is in MarcoPolo Tutorial, about audioRpc.cs,

    But I do not any errors for a windows build.

    I am using the free photon plugin at the moment,

    It seems there exists no restrictions for the google naive platform right? And how to resolve this issue?

    Thank you
     
  3. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    I'm sorry to say but the Native Client export is not supported. Last time we checked, it was tricky to get socket access.

    Export to Standalone, Win 8 Store, Win 8 Phone and Web with Unity Free. Exports to Android and iOS need the respective "Unity Pro" licenses or PUN+.
    We do support console exports but not with the package from the Asset Store.
     
  4. ZimM

    ZimM

    Joined:
    Dec 24, 2012
    Posts:
    963
    Not sure if this appropriate here, but I really think this can be useful for quite a lot of people...

    Some time ago, I've released an asset that allows to use .NET sockets on iOS/Android without the need for Pro licenses, and, of course, Photon Networking was one of the reasons I've did it :) I know about PUN+ with built-in support for mobile, but hey, not everyone will need it, especially when just testing.

    So, here it is:
    Good ol' Sockets
    PUN works with this asset in just a single click. After that it'll just work on iOS and Android even without mobile Pro license.

    Hope this will come in handy for non-Pro mobile developers who want to use PUN.
     
  5. 121Gamers

    121Gamers

    Joined:
    Jan 7, 2014
    Posts:
    6
    Can someone help i know im a noobe lol
    Trying to add photon multilayer with spawn respawn on die Can any legend see the problem
    using System.Collections.Generic;

    public class NetworkManager : MonoBehaviour {

    public GameObject standbyCamera;
    spawn[] spawn1;

    public bool offlineMode = false;

    bool connecting = false;

    List<string> chatMessages;
    int maxChatMessages = 5;

    // Use this for initialization
    void Start () {
    spawn1 = GameObject.FindObjectsOfType<spawn1>();
    PhotonNetwork.player.name = PlayerPrefs.GetString("Username", "Awesome Dude");
    chatMessages = new List<string>();
    }

    void OnDestroy() {
    PlayerPrefs.SetString("Username", PhotonNetwork.player.name);
    }

    public void AddChatMessage(string m) {
    GetComponent<PhotonView>().RPC ("AddChatMessage_RPC", PhotonTargets.AllBuffered, m);
    }

    [RPC]
    void AddChatMessage_RPC(string m) {
    while(chatMessages.Count >= maxChatMessages) {
    chatMessages.RemoveAt(0);
    }
    chatMessages.Add(m);
    }

    void Connect() {
    PhotonNetwork.ConnectUsingSettings( "MultiFPS v002" );
    }

    void OnGUI() {
    GUILayout.Label( PhotonNetwork.connectionStateDetailed.ToString() );

    if(PhotonNetwork.connected == false connecting == false ) {
    GUILayout.BeginArea( new Rect(0, 0, Screen.width, Screen.height) );
    GUILayout.BeginHorizontal();
    GUILayout.FlexibleSpace();
    GUILayout.BeginVertical();
    GUILayout.FlexibleSpace();

    GUILayout.BeginHorizontal();
    GUILayout.Label("Username: ");
    PhotonNetwork.player.name = GUILayout.TextField(PhotonNetwork.player.name);
    GUILayout.EndHorizontal();


    if( GUILayout.Button("Single Player") ) {
    connecting = true;
    PhotonNetwork.offlineMode = true;
    OnJoinedLobby();
    }

    if( GUILayout.Button("Multi Player") ) {
    connecting = true;
    Connect ();
    }
    GUILayout.FlexibleSpace();
    GUILayout.EndVertical();
    GUILayout.FlexibleSpace();
    GUILayout.EndHorizontal();
    GUILayout.EndArea();
    }

    if(PhotonNetwork.connected == true connecting == false) {
    GUILayout.BeginArea( new Rect(0, 0, Screen.width, Screen.height) );
    GUILayout.BeginVertical();
    GUILayout.FlexibleSpace();

    foreach(string msg in chatMessages) {
    GUILayout.Label(msg);
    }

    GUILayout.EndVertical();
    GUILayout.EndArea();

    }

    }

    void OnJoinedLobby() {
    Debug.Log ("OnJoinedLobby");
    PhotonNetwork.JoinRandomRoom();
    }

    void OnPhotonRandomJoinFailed() {
    Debug.Log ("OnPhotonRandomJoinFailed");
    PhotonNetwork.CreateRoom( null );
    }

    void OnJoinedRoom() {
    Debug.Log ("OnJoinedRoom");

    connecting = false;
    SpawnMyPlayer();
    }

    void SpawnMyPlayer() {
    AddChatMessage("Spawning player: " + PhotonNetwork.player.name);

    if(spawnSpots == null) {
    Debug.LogError ("WTF lol?!?!?");
    return;
    }

    spawn1 myspawn1 = spawnSpots[ Random.Range (0, spawnSpots.Length) ];
    GameObject myPlayerGO = (GameObject)PhotonNetwork.Instantiate("PlayerContr oller", myspawn1.transform.position, myspawn1.transform.rotation, 0);
    standbyCamera.SetActive(false);

    //((MonoBehaviour)myPlayerGO.GetComponent("FPSInputC ontroller")).enabled = true;
    ((MonoBehaviour)myPlayerGO.GetComponent("MouseLook ")).enabled = true;
    ((MonoBehaviour)myPlayerGO.GetComponent("PlayerMov ement")).enabled = true;
    ((MonoBehaviour)myPlayerGO.GetComponent("PlayerSho oting")).enabled = true;
    myPlayerGO.transform.FindChild("Main Camera").gameObject.SetActive(true);
    }
    I get this error everything else works fine
    Assets/Photon Unity Networking/UtilityScripts/NetworkManager.cs(7,9): error CS0246: The type or namespace name `spawn' could not be found. Are you missing a using directive or an assembly reference?
     
  6. Parappa

    Parappa

    Joined:
    Jan 27, 2013
    Posts:
    77
    I need an example or guide for a system of spawning and killing players, and adding to a scoreboard everyone can see whenever someone is killed
    Using photon cloud
    Is there some way the player who is the server can spawn a character for other players, so it has a reference to it?
     
  7. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    Hello, I am having some difficulties with the Photon support, it need lot of time and concentration to have a clear answer to my question so if there is some user that are in same case as mine maybe they can tell me !

    The game we are working on use multiplayer,

    -Ideally servers are hosted on the company servers and users can host their own servers on the same unity app. can we list both rooms from our and players server on the same lobby?

    -If we use Photon Server (SDK+LICENSE) in unity, can we also use "PHOTON CLOUD" (PUN) , using for example 2 different menu LOBBY but on the same compiled Game? or we cant run the game logic on client side as PUN do?

    thank you if someone can answer this question.
     
  8. Tiny-Tree

    Tiny-Tree

    Joined:
    Dec 26, 2012
    Posts:
    1,314
    edit: answered by email
     
  9. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    121Gamers: The error you get is a general one that's not directly related to Photon. You are basically using spawn like it's some Unity-known type. Which it isn't. Google the error and and read tutorials about using classes and defining types.

    Parappa: I am sorry to say but we don't have perfectly fitting demos for your demands. But: Once you get the basic gameplay turned into multiplayer, you will be able to derive the score from what you're sending anyways. Shots and hits you send lead to kills and scores. Tracking those on each client is basically not a multiplayer-issue then anymore.
    Maybe it's more easy to find some single player spawn tutorial. The way to do it in multiplayer is basically the same except for a single extra step: When a player spawned, you let the others know where (with an RPC, e.g.).
     
  10. Marionette

    Marionette

    Joined:
    Feb 3, 2013
    Posts:
    349
    i'd like to know a little bit more about world state persistence..

    for example, what i would need vs what you already provide etc.

    think traditional MMO (centralized instance shards w/SQL server for example). do you already provide services for authentication/persistence?

    i'm confused as to how this would set up. do you provide hosting? and if so, do i get access to the server to be able to install my backend? or would i need to provide services for that?

    is there a demo that shows this?
     
  11. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Authentication can be done with Photon's "Custom Authentication". Clients send their authentication values to Photon which in turn asks a suitable web-service to verify them and the account. The account itself is not registered with Photon and can be any community you want your players to use. We provide the tools to verify Facebook but you can easily roll your own.

    Photon Unity Networking does not provide any persistence on the server side whatsoever. Once a room becomes empty, it gets cleaned up and is gone. Also, PUN is very room-oriented, which doesn't work well for masses of players in the same place.
    We are working on persistence features but they are not in PUN anytime soon and they are also not for mmo-style seamless-worlds.

    The Photon Server SDK might be what you need. It's extremely customizable in C# and saves you a lot of low-level work. However, you would have to integrate your whole game logic yourself.
     
  12. Marionette

    Marionette

    Joined:
    Feb 3, 2013
    Posts:
    349
    what about PUN+? or is that included in what you're talking about?

    thanks, i appreciate your honesty ;)

    given my direction, if i had bought this i would've spent a lot of time trying to shoehorn this into what i needed only to find out it wouldn't be suitable.
     
  13. TheBraxton

    TheBraxton

    Joined:
    Mar 6, 2014
    Posts:
    98
    So you're saying PUN is NOT usable in its current state for seemless MMO projects? This is pretty much what quite a few people want from PUN lol?

    Also, is the Photon Server SDK part of the free stand-alone server software or do you have to pay for that?

    Also, just an opinion on your cloud service....that is probably only being used for mobile games correct? I ask because not a single game programmer i've talked to would EVER rely on a cloud-server solution for an MMO....ever...unless it were a small dinky-mobile app. Developers like having full access to code for customization when it comes to servers. Just my 2cents, but i don't know how you're doing with it sales wise :).

    -Brax

    ps: Anyone know any tutorials on starting on a standalone server software for an MMO by scratch, or know any good solutions that allow custom modules/code to be added server-side? I've got a fairly ambitious project that requires massive customized server-side logic to be successful :). My aim is towards a seemless, zone-less, instance-less, game world that can support up to 1000 concurrent players at any given time (with breathing room code wise to go further with optimizations and custom modules to handle load balancing).
     
  14. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    PUN+ is identical to PUN in features but also exports to iOS and Android from Unity Free. It also has a voucher for +100 CCU for a Photon Cloud application (applicable even to a free subscription).

    So Custom Auth would be in it but no persistence. The WebRPC will make it to PUN and PUN+ in the future but it's unclear when.
    You could probably start doing your game and fake some of the account data or skip those parts. Just get the game going and everything. Make it fun and bug-free. Then add the community features later on.
     
  15. Parappa

    Parappa

    Joined:
    Jan 27, 2013
    Posts:
    77
    Is there anyway to protect my game from being stolen?
    If I upload a beta on Dropbox, to be played in the unitywebplayer, can someone just steal it and put it on kongregate?
    What's a good protection method?
     
  16. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    I would love to have a solution for that and make quite a few people happy but PUN is not the solution for it.

    "MMO" is not a very clear term: Some use it for seamless worlds with the least amount of sharding possible. Basically everyone could gather at the same place in the world. Sometimes MMO is used for games played by millions at the same time but in reality you can only interact with a really small number of them in realtime.
    If you need more than one server for a crowd, then things become tricky when anyone from one server needs to "see" anyone from the other. This type of MMO requires you to code some custom interest management and server-cooperation. This is what's difficult. And of course most teams want control over this kind of server setup.

    PUN is very good at making room-based games happen with smaller player counts per room (or area or ...). PUN and the Photon Cloud both group players by rooms exclusively. Rooms are relatively easy to distribute on servers and quite scalable for a large number of players.
    I hope we are clear enough about that - it's not a secret or anything.

    It does not matter if the game is mobile, web or standalone. It's the count of concurrent users that matters for the servers. Photon Cloud is used by mobile games, web-based ones, standalone and mixture of all of those.


    The Photon Server SDK is free to access and work with. It can be used as basis for MMOs but you will have to do some work yourself and you will have to skip PUN on the client side. The Photon Unity SDK is better suited for the needed flexibility.
    You can use Photon's features, extend them any way you like and host it for up to 100 concurrent users for $0. You can upgrade licenses when you really need them later on. Get in contact when you need some licenses for slightly bigger beta tests or something.

    Our SDK Downloads:
    https://www.exitgames.com/en/OnPremise/Download
     
  17. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Parappa:
    For Photon games, you can probably use a special custom authentication value that those beta clients contain and make those useless when you disable logging in with those clients.
    Aside from this sort of online protection, you might want to search the other subforums. This seems also a general (non Photon) question.
     
  18. TheBraxton

    TheBraxton

    Joined:
    Mar 6, 2014
    Posts:
    98
    Thanks for the reply :).

    What consitutues "Massive" for an MMO has been strained and lied about by many major companies in order to "dip" into those fields of playerbase.

    "Massive", by previous industry standard, meant at LEAST a minimum of 500 players at any given time can co-exist in real time on the same server and interact with each other without instancing them away from each other. Generally speaking, you never really got 500 in the same "area" that would cause problems as people generally self-regulate themselves when it comes to areas that begin to lag. That, and game design can dictate a given area's maximum population.

    For example: Area A can physically maintain 250 players at any given time due to the # of NPC camps for people to farm/exp/group at. This is right on the threshold of what the server can maintain for a single given area so it begins to lag around ~225 or even ~200 players depending on how efficiently they coded their traffic for each player.

    So once it would get around ~250 or ~260 players in a given area others will come in, see that most camps have been taken and that it is starting to lag, so they end up looking elsewhere in your game for content to experience.


    TLDR: "Massive" for a seamless MMO generally constitutes being able to maintain at a MINIMUM of 300 players in a given "Room" as you would call it, and have a max population of around 1000 to 2500 players per server being connected concurrently.

    If games like Everquest, Shadowbane, DAOC, and early versions of EvE can do this around 10years ago I'd be surprised if modern day tech and/or server architectures cannot.


    So a more focused question would be: Would Photon Server SDK (the standalone server with 100ccu for $0) be a valid choice for a Sandbox Seamless MMO that has roughly around 1000 players at any given time per server, and around 300 max per "room" interacting with each other (100ccu limit aside as that would have been paid for to reach 1000cu at the given time)?
     
  19. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Simply put: Yes.
    In more detail: 300 players with 10 updates per second is most likely not a healthy incoming data-stream for the clients.
    You most likely want an update-cap, interest management (visibility and importance) and optimized messages for your game.
    This has been done before in Photon but it's not coming with the SDK. A room might be a basis for this but it does not support 300 interacting players out of the box.
     
  20. AuroJj

    AuroJj

    Joined:
    Dec 13, 2013
    Posts:
    7
    Hello. How are you?
    I bought the PUN + to use my game on Android platform.
    This is the message I get unity:
    connection failed. Check setup and use be up to fix configuration wizard.

    Do you know whether to change any of the information?
    Thank you
     
  21. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    For some reason, the setup for your client is not correct in that project.
    You can re-start the Photon "Wizard" dialog from the main menu: Windows, Photon Unity Networking. In the editor window, press "Setup" and fill in the form (AppId and region). Don't forget to save.
     
  22. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    I just updated the PUN and PUN+ packages in the Asset Store to v1.25.
    This update has a long change list and even a few breaking changes compared to v1.24. Before you update, make sure to backup your work (as always).

    The list of changes is too long to repeat here (it's in the initial post) but some highlights that come to my mind now:
    PUN and PUN+ are more compatible with each other and the PUN+ will now also export to Windows 8 Store and Phone.
    JoinOrCreate is a new and simpler method to get into a room once your players decided on a roomname. You can set room properties for creation, too.
    Support for multiple lobbies and types of lobbies. The two available types are what you know already and the new SQL-Typed lobby for more elaborate matchmaking.
    RaiseEvent offers a way to send your own, custom messages to the others without the PhotonView context. This alternative communication is not depending on scenes and GOs.
    Fixed some (but most likely not all) issues with offline mode.

    If you can: Read the changelog! ;)
    More info coming...
     
  23. Julian-S

    Julian-S

    Joined:
    May 31, 2013
    Posts:
    73
    Hey, just a quick question.

    Is there an easy way to set up photon so that it interacts with a mySQL database or something of the like so that it's easy to save and load player data?

    Thank you!
     
  24. CaoMengde777

    CaoMengde777

    Joined:
    Nov 5, 2013
    Posts:
    813
    a concern i have is...
    how permanent is the photon system??
    i mean... 50 years from now could i still play my game multiplayer? .. "talking" to photon is required?..
    lol im a noob at networking... is Unity's networking "permanent" ? ... as in, not relying on the existence of a third party to maintain its ability?
     
  25. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    628
  26. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Julian: You could use the Photon Server SDK, which has all the game logic in C#. In that, you can connect to any database or other service.

    Cao: In 50 years?! Yes, sure you will be able to "talk" to Photon. You can download our server software and keep it. Run it whenever you like for your players.
     
  27. fholm

    fholm

    Joined:
    Aug 20, 2011
    Posts:
    2,052
    I would recommend using MS SQL Server if you are using Photon Server as the tooling and support for SQL Server is *amazing* in .NET
     
  28. bac9-flcl

    bac9-flcl

    Joined:
    Dec 5, 2012
    Posts:
    829
    I'm about to start a Unity project that will be used on around a dozen of PCs within a closed network. Scope of network-related work I'm looking at is building a server and a client build, auth system for the clients within that closed network, and passing calls with variables to the clients to trigger some code remotely. Admittedly I haven't yet researched much of the Photon features, so I have a question - will Photon be useful in the described case or I should stick with standard Unity networking functionality? I'm unsure due to many mentions of Photon cloud services surrounding the asset, which I will of course be completely unable to use due to a closed nature of environment my project will be deployed into.

    TL;DR: It's functional and useful for LAN-only projects too, right?
     
  29. Julian-S

    Julian-S

    Joined:
    May 31, 2013
    Posts:
    73
    Thanks! I'm very happy with how Photon is working out, so I'm not sure I want to change my network solution. Please correct me if I'm wrong that Kii and Parse are their own networking solutions.

    Thanks guys!

    As someone who doesn't have much experience coding in c# outside of unity, is this difficult to do? I can't seem to find a tutorial on it.
     
  30. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    bac9-flcl: Photon can be used in LAN-only projects but it has some restrictions: You need to start the server in that LAN (on a Windows machine) and you need a license for that server that doesn't need to connect to our license monitor.
    Photon does not support LAN discovery but our workflow for Operation (RPCs on the server), Responses (per operation) and Events could be a good basis to start your development. PUN on the client side might be helpful with "client to client" RPCs (using events).
    Most likely you can implement all of that also directly in Unity. The workflow will be a bit different but that's only a question which API and workflow you prefer or "get".
    If you got the time, test both variants by implementing one RPC.

    Julian: The focus of Parse and Kii is a different, it seems. I never used either but judging by the descriptions, they obviously provide user accounts, friends / social features and can store data for your clients. Actually, they sound like a tools you could use in cooperation with Photon as social component (while Photon provides the room and communication features).
     
  31. Julian-S

    Julian-S

    Joined:
    May 31, 2013
    Posts:
    73
    Hmm, that might be very useful then. Do you think this would be possible to use in conjunction with Photon Cloud then?
     
  32. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    Hey there, I'm looking into using this but I have a few questions.

    I'm making a game that will have multiplayer that allows for a few players (2-4) to play together on levels.

    In addition to this, though, I'll allow players to create their own levels. I'll want them to be able to upload these levels to a server, and allow others to download those levels. This, I imagine, would require a database.

    Can I do this with Photon Cloud? I feel as though I read somewhere that I could do this with the 'standalone server'. Although I'm confused about what the difference is between the cloud version and the standalone server version. With standalone server, would I be required to have my own server somewhere and then pay for photon to be used on that server?

    Thanks in advance.
     
  33. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Julian: You wouldn't implement Kii or Parse in the server but on the client side with their own libraries. They should be easy to combine with Photon that way.

    Jason: There are many ways to implement level editing and even more how you combine that with Photon (server or cloud).
    As you already stated, you definitely need some way to store the edited levels. It could be a blob storage in a DB or it could be file-based with a DB to look up details of the levels. You will need to build that "service" in any case for your game.
    You can do that directly in the Photon Server in C#, based on Photon's communication between client and server (clients call operations on the server, get responses and events). This is what the Photon Server SDK is for. In this case, you buy a license and host the Photon server on some machine.
    Alternatively you can also do this completely separate from Photon in your own web service (be it PHP, JSP, Google App Engine or whatever). Instead of only communicating with Photon, your clients can call this service to save edited levels and of course to get them. In that case, Photon Cloud doesn't even need to know your service. Players find each other via Photon, enter a room to play together, pick a level. They load the level from your service and tell the others (via Photon) when they are ready to begin.
    The game Fight The Dragon is doing it this way, e.g.. They use the Photon Cloud but the levels are stored in some other service.
     
  34. JasonBricco

    JasonBricco

    Joined:
    Jul 15, 2013
    Posts:
    956
    I see. So just to be clear, because I'm still a bit confused (I'm new to multiplayer/server stuff):

    Let's say I have a server somewhere right now. I can make a database on there to store edited levels. Then what I would use Photon for is to give Unity the ability to communicate with that server I have / with that database I have? Is that right?
     
  35. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Jason: Sorry. Missed your question post.
    In that case, you would use Photon for the matchmaking and in-game communication. You match your players and in a "room" they select a level. Via Photon they communicate which level they want but they load it externally in your custom service. When each is done loading, they can tell each other, start playing and send their turns or position updates or whatever your game does.
    You external service would be used for content delivery. Photon does game communication in realtime.
     
  36. kurtdesi

    kurtdesi

    Joined:
    Dec 10, 2013
    Posts:
    7
    any one knows how to pass OnCollisionEnter as rpc ? so that i can detect whenever the clients player has collided to my server player
     
  37. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    In OnCollisionEnter, you should run some code to detect if that has an effect on the networked gameplay. If so, you can simply call an RPC. Don't send the collision itself, just cause it happened.
     
  38. Marionette

    Marionette

    Joined:
    Feb 3, 2013
    Posts:
    349
    hey tobias? question: do you have an offering for *generic* cloud service? for example, i was checking out the photon site and it kind of feels like you do, but it's a bit confusing. is that the 'realtime' service?

    and if you guys *do* have that offering, can i use my own networking backend/server or would i need to use photon?
     
  39. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    The Photon Cloud service is pretty generic and can run any pretty much any type of game (except seamless world mmo and some other special cases).

    It's not generic in respect to hosting some other software. For that, rent any non-managed machine from a hosting company and run whatever you like on Linux or Windows machines.
     
  40. Demonscum

    Demonscum

    Joined:
    Apr 23, 2014
    Posts:
    4
    Hey,

    My team has been working with Photon for a bit and we're currently experiencing a problem with not being able to create/join a new room after leaving a room and loading back to the menu scene.

    Currently in the menu the players connect to a room and it waits for them to select a role. After that, they get pushed to the game scene. When they are done one of the players can press a button that calls PhotonNetwork.LeaveRoom(); then waits for the PhotonNetwork.connectionStateDetailed to equal PeerState.JoinedLobby and then pushes them back to the menu with PhotonNetwork.LoadLevel("Menu");.

    Now what happens is that when I try to make them Create or Join a game nothing happens, PhotonNetwork.room stays null and when I try to leave the room menu I get the error:
    It appears that they stay in the PhotonNetwork.countOfPlayersInRooms even if the amount of rooms is 0.

    I hope someone is able to help us.
     
  41. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Demonscum:
    Please set the PhotonNetwork.logLevel to "full" and mail me the player log (to: developer@exitgames.com).
    I also need to know the PUN version you are using.
    Maybe I can help then.
     
  42. Demonscum

    Demonscum

    Joined:
    Apr 23, 2014
    Posts:
    4
    The version we are using is v1.24.

    Changing the log level to full didn't log anything new. The only thing that gets outputted when trying to leave a room after none was created is:
    I don't know if it outputs an file, because I couldn't find one in the project folder.
     
  43. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
  44. Demonscum

    Demonscum

    Joined:
    Apr 23, 2014
    Posts:
    4
    Thank you, I've send you the log now.
     
  45. Demonscum

    Demonscum

    Joined:
    Apr 23, 2014
    Posts:
    4
    If I try to first make the players move back to the Menu and then try to make them leave the room it does nothing.
    Also the GetPing() function stays exactly the same, after returning to the menu.

    I tried disconnecting the players and then making them reconnect, but that resulted in them being stuck on Connecting.
     
  46. Quen

    Quen

    Joined:
    Apr 6, 2010
    Posts:
    21
    Hi,
    can I use Photon in a local network too? I have a project where I need several clients to communicate with each other, without having an internet connection.

    Greetings, Quen
     
  47. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Demonscum: I replied by mail. I hope you got your nullreference issue fixed by now.

    Quen: Yes, you can run a Photon Server in your local network. The licenses we had out usually have to "phone home" but we can also create licenses that don't. Please mail us what your use case would be. Do you need to redistribute Photon to your players or do you install it in some networks or something in between? Mail to: developer@exitgames.com. Thanks.
     
  48. Steve-of-Construction

    Steve-of-Construction

    Joined:
    Jan 26, 2013
    Posts:
    67
    Hey Tobias I've got some questions.
    A short answer would be nice cause I'm german and my last english lesson at school is 31 years ago now :mrgreen:

    1)
    Did I understand it right? The PUN Madness Sale is for 100CCU and forever for just $47,50?
    On the Exitgames website 100CCU is$9/month = $108/year.
    Or is the PUN+ Madness Sale for 1 year and after that year it's $47,50 or $108 p.a.?

    2)
    What happens (with PUN+ 100CCU) if there are 100 players and player #101, #102, #103 wants to connect?
    Will they be forced to wait for free slots or will the PUN+ owner get a message that there are more players than 'CCU' allows?

    3)
    Do all people around the world have a good connection cause of the cloud system? For example if I have a server in Germany a player from Japan will have ping 280++ (US 150++) what is not good for games. Will he have a better connection if he's playing via Photon and a player from US, Asia and Europe can play together?

    4)
    If my game will be released it uses the actual Photon version. Will the game still work 10 years later with the Photon scripts?


    Thanks and sorry for my bad english. I hope you understand everything :-D


    *EDIT* sehe gerade Du bist in Hamburg und ich brech mir hier einen ab :mrgreen:
     
    Last edited: May 8, 2014
  49. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,062
    Hey Lotte,
    I happily keep my answers short when I'm asked to :)
    Even though we are in Hamburg, this public discussion should stick to English (for everyone else). But you can post in German in our forum, if you like (link below).


    1) It's +100 CCU. Forever. Madness!!
    2) It depends on the subscription:
    In the Free Subscription, player 121 can't connect. You got 20 Free +100 from PUN+.
    In a paid subscription with "CCU Burst", we allow more players and expect you to upgrade the subscription accordingly. If you don't we will disable the burst after a few warnings.
    Your client can be built to re-connect if it's rejected due to CCU limits. If you do is up to you.

    3) No. To have a benefit from our regions, players must choose their region based on location. US players should not play on Japanese servers, for example. Regions are fully separated and users on the US cloud will not be able to find players in the EU or JP regions.
    This is not a miracle tech to cut lag for worldwide games. It just offers multiple server centers to minimize lag for players in the same region.

    4) I hope so! Of course a lot of things might happen but our goal is to keep the Photon Cloud compatible with the current games. It's likely we put newer games and feature on different servers if they would break compatibility.
    In worst case, you can download the Server SDK and run your own servers for as long as you want. The Server SDK comes with a pre-built binary that's compatible with PUN games, so setup is not an issue.
     
  50. VSuper

    VSuper

    Joined:
    Apr 25, 2014
    Posts:
    5
    Hello, i've just got a really big problem. I code my playerHealth and Punch and all worked fine but now... after some other test, it doesn't work anymore. I've got this error when i touch the other player: "NullReferenceException: Object reference not set to an instance of an object
    PlayerCollider.OnTriggerEnter (UnityEngine.Collider hit) (at Assets/_SCRIPTS/Player/PlayerCollider.cs:12)"

    This is PlayerCollider.cs

    public float damage = 25;

    void OnTriggerEnter (Collider hit) {
    if (hit.tag == "Player") {
    GameObject PlayerObjs = GameObject.FindGameObjectWithTag ("Player");
    //Debug.Log("We Hit " + hit.transform.root.name);
    PlayerHealth playerHealth = PlayerObjs.transform.root.GetComponent<PlayerHealth>();
    PhotonView pv = PlayerObjs.transform.root.GetComponent<PhotonView>();
    if (pv == null) {
    Debug.LogError("no PhotonView found");
    }
    else {
    //On appelle la variable pour la modifier "devant tout le monde"
    PlayerObjs.transform.root.GetComponent<PhotonView>().RPC("TakeDamage", PhotonTargets.AllBuffered, damage);
    }
    }
    }
    }

    and this is PlayerHealth:

    public float currentHealth = 100;
    [RPC]
    public void TakeDamage(float amt){
    currentHealth -= amt;

    if (currentHealth <= 0) {
    Die();
    }
    }

    void Die(){
    if (GetComponent<PhotonView> ().instantiationId == 0) {
    Destroy (gameObject);
    } else {
    if (PhotonNetwork.isMasterClient){
    PhotonNetwork.Destroy (gameObject);
    }
    }
    }
    }

    it seem the script can't find the PhotonView on the root (there is one). But he can find the PlayerHealth, who's at the same place as the PhotonView... HELP.
     
    Last edited: May 9, 2014