The Photon Forum
is Closed Permanently.

After many dedicated years of service, we have made the decision to retire our Forum and switch to read-only: we´ve saved the best to last! Your search result can be found below. Plus, we offer support via these channels:

Try Our

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

Keeping the Photon Room open when all players leave

2014-05-09 22:17:02


How do I go about keeping the server online when all players have disconnected? It seems to close and I have to re-open the server/room again.

Thank you!


2014-05-12 11:04:41

You can't keep the rooms open. There is no way we would be able to clean up unused rooms otherwise. What do you want to achieve? Do you want the state saved to be able to continue later on? Or do you only want to show some rooms in the list of rooms?

2014-05-12 14:50:01

I want to be able to keep the room when 0 players are playing the room. You mentioned a "saved state", is possible to save the room and return to it? If so what do I need to do in order to get this?


2014-05-12 14:58:06

"I want to be able to keep the room when 0 players are playing the room." This is not possible in the Photon Cloud. You can download the Photon Server SDK and modify the basic logic to do what you want.

It is possible to save the game state with the upcoming Photon Turnbased feature set. It's not going to be available with PUN soon, however. And if your game can't be played asynchronously, saving the game state will not help you a lot. It's explicitly not a way to keep rooms that are simply empty.

Again: What do you want to achieve and what's the idea of that?

2014-05-12 23:15:10

Thanks for the info.

I have base/player building. Players can create they're own houses etc. However I want to be able to keep these game objects a live per server/room. However I noticed if no one is playing, it wipes the server completely. This is why I wanted to enquire about how to -not- do this. However it cannot be done, as you said.

Say I collect some resources and build on server 1. I disconnect and make another base on server 2. However because server 1 has no people on it, I've lost my build due to it going offline. But due to having people online in server 2, my base is still there and I can continue.

2014-05-13 09:36:54

I'm sorry but Photon Cloud is not built with permanent games in mind.

If you could keep the game forever, we would have no way to clean up and in turn, the server will run out of memory / disk space. Of course, you will have some rules that could tell your server to clean up a game. It's just that the default logic of Photon Cloud could not understand those.

To persist games in a custom way, you could use the Photon Server SDK and modify the server side to store things and list them for users. However, this will be quite some effort as you have to handle the DB and everything.

Could you game be described as turnbased game that ends or is it a (pretty much) endless game? What type of game do you want to build?

2014-05-13 13:36:49

It's an open world survival/building game. Vaguely think of Rust/Minecraft in a nutshell. Players can build their own bases (out of a selection of walls, roofs, floors etc) and survive in a huge world. It's pretty much an endless game. We moved to photon as it's much easier to host on the cloud. But if you say that Photon Cloud isn't built for persistent/permanent games then we may need to move to an alternative.

Thanks again!

2014-05-13 14:48:42

Ah, I see.

I doubt that you will find an alternative where you don't have to host your own, custom logic. These types of games are not as easy to handle as games that are "live" for a while and that can be cleaned up easily. You need to store stuff in a DB, keep the rate and amount of updates low while at the same time sync all users about the current state of the base, etc. Unless you simplify your game considerably, I would always propose to use some networking software as basis while customizing the game logic depending on your needs.

You can use the Photon Server SDK as basis or you could use Photon Cloud for the realtime position updates while saving the world state on another service (combining Cloud with something custom for saving data).

Back to top