Client-side code

Options
I am using LoadBalancing and writing client-side code with PUN. I am just wondering about a bit more explanation on what is happening exactly when peer.Service() is called. Is the RaiseEvent code automatically executed on the client just by calling peer.Service()? Or is there something else beyond this that must be done to actually execute the event code once the client has it? I am writing a simple lockstep engine so trying to send lists of RaiseEvents to clients here (e.x. buildings made, units made). Also, does peer.Service() do exactly the same thing whether the RaiseEvent is from the MasterServer, GameServer, or the plugin that I am writing? Thx for any help!

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @NimbleSprite,

    You can use PUN to connect to LoadBalancing server application running on your self-hosted Photon Server.
    There is no need to worry about Service() as it's automatically handled in PUN internally, you need to call that in case you use Photon Realtime client C# SDK.

    Here is how to connect to your self-hosted Photon Server using PUN 2. We recommend to always use ConnectUsingSettings and update those settings in inspector/editor or via code.
    To read about Service() (again it's called periodically on your behalf by PUN, so this is just FYI): here, here, here.

    Recommendations:
    Use PUN 2 instead of PUN Classic.
    Use Photon Server v5 instead of Photon Server v4.