clarify what client & demos work with cloud vs. self hosted

So please can you clarify for me! On this page
There are 3 resources (Viking demo, Bootcamp demo, PUN client). Do they ONLY work with Photon Cloud, or do they work with self-hosted servers too?

I intend to run my own server, and develop my own room/game saving logic server side. I would like to use the PUN client, if possible.

I have Photon3 running, and I can connect to it with this project:

But cannot connect to it with any of the PUN examples. Does PUN depend on having a load balancing server? I tried starting the load balancing server, but it apparently fails because it uses the same TCP port as the Photon server already running.

I installed the Viking Demo, and changed ServerSettings to
hostType SelfHosted
Server Address (my windows server)
Server Port 5055
App ID Master

I tried changing App ID, on a hunch to MmoDemo and MmoDemo.Server but neither worked.

Authentication failed: 'Unknown operation code 230' Code: -1

Please advise!


  • Ahah! This is exactly the info / big picture I was looking for
    it's all starting to come together :)
  • Hi.
    The loadBalancing demo is working with InstanceLoadBalancing, while all other demos are working with Instance1.
    With the self hosted server, you can decide which instance to start and this way determine, which demos will be compatible, while on the cloud there is always InstanceLoadBalancing running.

    PUN is using the client side LoadBalancing implementation internally and therefor needs InstanceLoadBalancing to run on the server.
    Also, in case, that you have run Instance1 before, make sure, that it is stopped before connecting with PUN to the loadBalancing Instance. Running both instances at the same time means, that you will either have to do some additional configuration on ports, etc. or that you will get undefined behavior.
  • Kaiser- thanks for your reply. Another general question: Would you say in general that PUN is only for use with Photon Cloud? Or is that incorrect or over-generalization? I am making a social game that is actually not room-based. It's more of a pub-sub model with lots of games that are long-running. Considering that do you think I should just forget about PUN and look at the low-level C# socket API?
  • PUN is not only for usage with the cloud, but also for usage with self hosted servers, which are running InstanceLoadBalancing.
    However PUN is targeting room-based types of games, so if you would want to make a game with just one big world instead of many small rooms, then you should use the MMO application and the normal Photon Unity Client SK instead of LB and PUN.
    But actually your game is room-based, as you are having a lot of simultaneously games instead of one big world. The only thing is, that your games rooms have to persists, even if no player is in there. Therefor you would either have to use some dummy clients, which are ignored by your game logic and put one in every room, to keep them open, or you would have to inherit from the LoadBalancing game server code and add room-persistence in your subclass. So I think, that you can indeed use PUN for your game.

    I don't understand, why you would want to go with raw sockets, if PUN would not work, although you would prefer PUN, if it would work. The normal Photon Unity Client SDK is not mapping the unity built-in networking as close as possible like PUN does, but raw sockets don't do this either and the Photon Unity Client SDK aside from that is nearly doing as much work for you, as PUN does, which you would have to implement yourself, when using raw sockets.
  • Thanks Kaiser- that helps me a lot!