Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question Photon Fusion Question

Discussion in 'Multiplayer' started by sam_unity762, May 9, 2024.

  1. sam_unity762

    sam_unity762

    Joined:
    Mar 7, 2024
    Posts:
    1
    We are building a multiplayer space game where each "solar system (just a small area to hunt NPC and Mine" is a server session and players can freely enter and leave. If there are no players inside we simply reboot when a new player joins.

    What happens if a single player or multiple players continuously stay inside the system? How long can a Photon Fusion session last before it disconnects?
     
  2. CodeSmile

    CodeSmile

    Joined:
    Apr 10, 2014
    Posts:
    6,922
    By "session" you mean a server instance? If so, that will last as long as it is designed to last by you of course. No service provider will indiscriminately shut down your server instances at their own discretion, except for maintenance or if the instance becomes unresponsive.

    Be aware of the time it takes to boot up a server instance. This could be anywhere from 5 seconds to 5 minutes, plus the time it takes to launch your server executable. Best to test and time this on multiple occassions.

    For a highly responsive system, the kind players expect, you ought to have n number of sessions running all the time (on standby). Where n is a number that can grow dynamically based on how many players are likely going to require new sessions, eg more sessions on standby during "rush hour" and less over night (in a given region). Yes it costs more to keep servers running on "empty" but it also costs losing players who don't like to wait a minute to switch solar systems. This is a tradeoff you need to balance, and if in doubt, err on the side of the users' convenience.

    Players migrating to a new solar system would get to join an already running session/server instance already on standby. This session would then only "load" (or generate) the solar system the first player intends to enter. From then on that session is locked to that particular solar system until all players have left, at which point the session goes back to standby or shuts down if there are an excess number of sessions already on standby.
     
  3. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,082
    We'd assume that players don't keep their session running forever. While there is no actual session time limit, servers get updated, replaced and added all the time, so a session also won't last forever.
    As each online user counts as CCU and causes some traffic being used, this is another downside of keeping them online just to idle.

    Maybe you could come up with an in-game explanation why ships of idle players become invisible (and disconnect) until they act again (where the client simply reconnects and joins the correct session again)...

    Depending on the game, make sure you can "shard" the sessions for a region. If you ever make a mistake and some region becomes super attractive to farm, most if not all players may end up in the same system. In that case, you want to be able to have more than one instance of it.
    The actual max player count for a session may be high (even 200 and more is possible with Fusion) but there are technical limits at some point (depending on your game).

    With Fusion Shared Mode, you don't need to worry about ramping up servers. It is using a "room" / "session" on a server that's running already, so it's really lightweight.