How do i properly construct PhotonPeer in C++?

I'm an amateur when it comes to Cocos2d-x & C++, My problem is I cant wrap my head around how to construct the PhotonPeer Class from PhotonPeer.h in my HelloWorld Scene... Would apreciate the help, thanks!

Comments

  • Hi @Gunplay.

    Just write a class that inherits from the PhotonListener interface (so that you have a place where you can receive the callbacks from PhotonPeer), create an instance of that class an pass it to the PhotonPeer constructor.

    However directly using a PhotonPeer yourself only makes sense if you write a serverside Photon Application yourself from scratch by modifying a self-hosted PhotonServer. I assume that you are not doing that (as in that case you likely wouldn't ask such a question)

    If you just want to connect to Photon Realtime, Photon TurnBased or a self-hosted Photon Server that runs the default LoadBalancing application or a customized enhanced LoadBalancing application, then it makes a lot more sense to use the class LoadBalancing::Client or in case of Photon Chat the class Chat::Client on the client-side, as they already handle a lot of low-level complexity for you.
    You can find demos for them in the Client SDKs.
  • Hi @Gunplay,

    in case you want do program a server and the client by yourself you may find some concepts here:


    I know it's for Unreal Engine but the concept of photon client is in there.