Is PUN the right choice for dedicated servers?
The whole answer can be found below.
Try Our
Documentation
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.
Read More on
Stack Overflow
Find more information on Stack Overflow (for Circle members only).
Is PUN the right choice for dedicated servers?
Prioxis
2017-08-26 02:59:57
Hello, I'm currently looking into converting my singleplayer survival game into a multiplayer survival game on Unity where players will be able to host dedicated servers from their home PC or from actual server providers such as gameservers and etc.. I'm interested to hear if PUN is capable of doing this and if so am I still locked into the CCU cap even if all the servers are hosted by me and other players.
Comments
I looked a little bit more into it and I see the word "rooms" used a lot is this the same thing as a dedicated server that can be ran 24/7? And is this something that can save information, go offline and then come back up and every change made to the scene or level in the game be the same? For example, say I have a building system where players build bases on the terrain and the "room" or server saves on increments and then the server restarts, when the server comes back up is there a way for it to be the same room and load all the buildings back into the game? Also are players able to connect to a specific room by using the public IP of wherever it's hosted?
[Deleted User]
2017-08-28 09:59:34
Hi @Prioxis,
let me try to answer your questions.
This is not possible with Photon as we dropped support for this. As a developer you have to host the servers (if you want to use this solution) on your own. Another option here is to use the Photon Cloud.
Mostly, yes. Hosting the server yourself also requires a license. For testing things out there is a 100 CCU free license, everything above those 100 CCU results in monthly costs. See the full pricing here.
Not really. Rooms are joined by clients to actually play the game. When a client connects to the server, he usually connects to the Master Server first. Being connected to the Master Server, the client has the possibility to either join an existing game (he receives a list of games available regularly) or to create a new one. In both cases he then is redirected to the actual Game Server. The Game Server runs on the same physical machine (no need for a second machine here) and can host multiple games / rooms.
This is possible on the self hosted server as well as on the Cloud. When hosting the server yourself you can either create the whole Server Application on your own or extend an existing one (LoadBalancing would be the one to go) with Plugins in order to inject custom code. The second one is the easier way to go here.
When using the Photon Cloud you can use Webhooks in order to persist games / rooms. You can read more about this solution over here.
No. You just need an IP for the initial connection to the server itself. When being connected to the server, joining or creating a game / room works with strings and doesn't require an IP address any longer.
Hopefully my answers will help you. If you still have questions please feel free to ask.
When you start porting your game, I would recommend you to get it working with the Photon Cloud first before caring about persistence of game data, hosting your own server and stuff. If you have it working with the Cloud, there is still some time to think about the next steps :)
Good afternoon. in search of my answer I came here)). I also develop a network game (like rust) only on pun. I had a question how to save the world. How to make that if the last player came out, then the world remained the same (preserved). and the player could return to him back after a while. I came across in the documentation about Photon 4. Here it is told https://doc.photonengine.com/en-us/onpremise/current/version-history/whats-in-photon-4
EmptyRoomTTL - how long should a room be kept in memory after last player disconnects.
I correctly understood that this is exactly what I need?
I can go with Photon Pun. on Photon 4. If so how to do it? Will it be easy or not? Waiting for an answer from you.
it was written in one of the branches.
then came across this one))
I correctly understand that with the help of this (LoadBalancing would be the one to go) with Plugins. I can easily switch from Photon Pun. on a photon server and my world will be preserved and all that is associated with it. I understand you need to connect the database.
[Deleted User]
2017-09-18 07:52:51
Hi @Alex333,
EmptyRoomTTL should not be used for persistence, at least not for long time persistence. EmptyRoomTTL is basically used for a scenario, when a client loses network connection and wants to come back just a few minutes later.
When hosting the server yourself, you have more options to handle this. A database connection - as you already mentioned - is one way to go. Another would be to store data to a serializable format and store this data on the same physical machine.
When you want to use the Photon Cloud, which might be the better way to start with, you can use Webhooks to persist player, game or world data. You can read about this approach in this guide.
Back to top