Confusion about custom server - long running continuous process?

Hello Photon! I'm a big photon fan and extensively use PUN2 usually in Unity, for desktop apps.

I'm about to experiment with Photon's custom server systems and processes.

I'm confused: when I write my own multiplayer/realtime server from scratch, I use say Node with websockets (perhaps on an aws instance)

The actual "room" will be one actual process running (so, it will literally be a node script named "blackjack.js" or such). Clients will connect to that room, imagine say seven clients connecting. blackjack.js runs "forever", it is a continuous process. Messages will come in to the blackjack.js process from the seven clients (messages like "I'll bet 15" and "hit me") The blackjack.js will send commands outwards to the clients, this could happen at any time for any reason. The blackjack.js process thinks for itself over time and does things. blackjack.js of course has sundry arrays, list and other data structures, it very often uses timers etc for logic and it controls everything.

Can I do this in the Photon custom server universe? Can I have a "long running process" ... so myGameThing.cs ... which runs continuously for the existence of that one room?

Loving to hear back from Photo crew! thanks!


  • hi, @FattieSMHK

    yes, you can do that but only with self-hosted server. you can set EmptyRoomLiveTime to int.max and will not be removed by server once players disconnected.

    I would recommend to you to write your own plugin to not deal with server code. We have setting to set max empty room live time - GameServerSettings.Default.MaxEmptyRoomTTL . you have to set it to int.max too in order to be able to set EmptyRoomLiveTime to int.max