Unity Client SDK implementation process

Options
Dima
edited June 2013 in DotNet
Hey,

I have been working on the PhotonClient SDK for Unity rather than PUN lately.

I have to admit the documentation is driving me crazy. I do not know where where to start nor to find my answers.

Here was my experience as a new user:

1) I have downloaded the Photon Client SDK for Unity (Cloud)
2) As stated in the Readme file I have copied the Photon .dll into the "Assets" folder of my project (Unity Projects provided with the SDK are tagged as "Demo" so I have put them aside for the moment)
3) Since no step-by-step tutorial about implementing Photon's SDK (not PUN) is available in the Cloud Documentation (http://doc.exitgames.com/photon-cloud) or the provided PDF I have been following the "Hello World" Tutorial from the PhotonServer Documentation
4) Everything was going well until I got some errors after trying to Join! After looking for an answer on the forum, then on the UnityProjects delivered with the SDK I've found that Photon Cloud is using LoadBalancing and so, more importantly, do not uses the same Operation Codes than the Lite Application (used in the Hello-tutorial)
5) I switched the byteCode and after some other troubles I figured that I needed to Authenticate before trying to join (of course, not stated in the tutorial because it is aimed at Lite Application users)
6) I am still wondering why the OperationCode, Event, etc... in the Cloud Documentation are linked to the Lite application whereas Cloud uses Loadbalancing ones (http://doc.exitgames.com/photon-cloud/U ... t-Protocol) and since I could not find Loadbalancing Codes on the website I had to look into the code of the provied Demo
7) How can I know which parameters the Cloud Server expects for an Operation (e.g. Authenticate requires "AppID" and "GameVersion"). Is there a documentation about those Operations and Parameters somewhere ?

I know the informations I've needed all along were there but It's really a pain to switch between PhotonCloud/Server documentation, Demo Projects, PDF documentation... it was unclear and I have mingled Cloud with Server with Lite whith Loadbalancing.

Maybe I'm missing something.. ?

Comments

  • Tobias
    Options
    I'm sorry you have such a bad experience. I admit: It's far from optimal. Obviously, the LoadBalancing & Cloud part is not described well.

    By setting aside the Demos, you lost much of the convenience. We decided to provide the LoadBalancing part of the API as source and because Unity requires all code to be in subfolders of "Assets", that's actually where the classes and enums for the Photon Cloud are.
    The readme is missing the part where you also want to import the LoadBalancing API into a new project. The files are in:
    demo-loadbalancing-unity\Assets\LoadbalancingApi

    With those you get the LoadBalancingClient class plus all enums and definitions needed. No more guessing.
    In best case, you take a look at the Demo itself. It should show the basic workflow.


    I will take a look at the documentation and readme.
    Thanks for the feedback.
  • Dima
    Options
    Don't be sorry, I didn't want my experience to sound harsh. Photon is great and everything (especially the code) is well documented but I was just trying to warn the exitgames team that a new user could be lost.

    The real problem is all the informations are scattered. Indeed, the Loadbalancing and the Cloud parts could have been better!

    From now I'm looking into LoadBalancingPeer.cs, which implements everything I need. I will try to learn it step by step to understand it well.
    Loadbalancing is missing some informations: which operation need which parameters and return what?

    I will post a "Step by step Guide" as soon as I understand the whole stuff. Maybe it will help new users.

    Thank you for your concern Tobias!
  • Kaiserludi
    Options
    Hi Dima.
    The LoadBalancing client-side API has two layers: the low level layer, that lays on top of the Photon client core, with its main class being LoadBalancingPeer, at which you are currently looking. This low level API is provided in case that you have rather special needs and need more flexibility to adjust things than with the high level API.
    This comes with the burden, that you have to do a lot of work yourself, that the high-level API otherwise would already do for you.
    The high-level API is called LoadBalancingClient and abstracts a lot of the implementation details that usually have not to be changed by the game developer. For example the workflow of switching between master and gameserver is handled completely internally and as a game programmer you practically can ignore the fact, that there is more than one server, completely.
    You also don't have to care about operation codes with LoadBalancingClient. The cloud doesn't allow you to add new operations on the serverside anyways and only adding them on the client side won't work, so on the cloud you will mainly use raiseEvent() and can just treat the operation codes as an implementation detail.
  • Dima
    Options
    Hi Kaiserludi,
    Thank you very much for those explanations.

    I already made the mistake of using PUN instead of the Unity SDK and I would like to avoid a new mistake by understanding LoadbalancingPeer before looking at LoadBalancingClient. If I succeed in understanding all the layers I will be able to select the features already handled but I will also be able to make changes in the parts that I would like to be more flexible.

    If I understand well what you are saying, I will keep the LoadbalancingClient as it is. And I probably will. But for a comprehension purpose I prefer to start with LoadbalancingPeer.

    But again, thank you for making the API a little more clear to me.
  • Tobias
    Options
    Actually, LoadBalancingPeer is more about implementing the operations (similar to LitePeer), while the LoadBalancingClient implements the workflow and adds a state, needed to work seamlessly with multiple servers.
    So, while LoadBalancingPeer.OpJoinRoom can be used, LoadBalancingClient.OpJoinRoom will keep the context for you and actually react to the server's response you get in this case.

    I am taking your original post as feedback. It wasn't harsh really and it's good to know where people get derailed.