Dungeon Instances (Scenes)

I plan on making some kind of Dungeon Crawler where players can enter dungeons either alone or as a team up to 4 players.

I understand that Scenes can be used to create new areas and instances. But it's not clear to me if a new instance is always created for every player/team that is send to a new scene.

Example: Dungeon Scene - Max players: 4

Player 1 is sent alone to Dungeons Scene.
Player 2 is also sent alone to Dungeon Scene.
Player 3 and 4 is sent together to Dungeons Scene.

Will these 4 players be in the same scene AND instance since max players is set to 4? Or will they be in the same scene but DIFFERENT instances?

Can I in some way control if a Scene is a 'shared' instance with all players like a continuation of the Main Scene where players keep filling up the instance until max players is reached? And can I Control if the Scene is 'private' where every player/team sent there will have their own instance?


I'm totally new to Core and tried my best finding an answer to this. I currently don't have a computer able to run Core and test things so I'm trying to read up on the technical stuff meanwhile. Thank you.

For your example:
Player 1 is sent alone to Dungeons Scene.
If there is an instance of your game running with Dungeons Scene as the live scene and there are less than the maximum number of players then your new player will join that existing game/scene. If there is no live instance of the game with that scene as the live scene then a new game instance will be started with that scene as the live scene and your player will be sent to that.

Player 2 is also sent alone to Dungeon Scene.
As above

Player 3 and 4 is sent together to Dungeons Scene.
As above. They will get split if there is an initial instance with 1 free space.

Will these 4 players be in the same scene AND instance since max players is set to 4? Or will they be in the same scene but DIFFERENT instances?
Assuming there was no partially filled instance with Dungeons Scene as the live scene then they will all end up in the same instance of that game and in Dungeons Scene.

You may want to read Scenes

There are two additional control methods:

  1. If they are in a party and the leader has the option "Play with Party" enabled then they will all be forced into the same instance if the party is <= the scene max player count. Creating a new instance even if a partially filled instance already exists if required to accommodate the whole party. E.g. if an instance (player cap 4) is running with 1 random player and a party of 4 try to join, a new instance (player cap 4) will be created to accommodate them. If the player cap was 5 then they would just get added to the original instance and join the initial one random player.

  2. You can lock your game to prevent new joiners using Game.StopAcceptingPlayers() . So you could leave the instance open for 5 minutes and then lock it if you wanted, subsequently new instances would be created to accommodate new players.

Edit: One strategy to resolve this is to give your main scene a large player count and not much else, so that players can use it as a hub to look for group / party up etc. The player cap is defined at a scene level not a game level.

Thank you for your reply.
Yes, I was planning of having the Main Scene as sort of a hub and social area with a large player count. I would then want players to explore procedurally generated dungeons either alone or in small groups. There would be some kind of teleport in the Main Scene to the various dungeons.

I guess I would be able to achieve my goals by your suggestion of using Game.StopAcceptingPlayers() instantly after a player or group enters the Dungeon Scene. This would then create a separate instance for this player or small group and assure that no new players/groups would enter an already started dungeon instance.

There are a few additional options, especially if your scenes are procedural (so relatively light weight). You can effectively duplicate your scenes for different join options (immediately lock, stay open for x minutes, etc) and then let the player decide on how they want it to work by selecting different portals from the hub world, your overhead is duplicate scenes with slightly different parameters.

Be aware that you can also pass data to configure your scenes by using Storage.SetPlayerData() which is persistent between game instances; this might save you the duplicate scenes depending on what you want to do.

" E.g. if an instance (player cap 4) is running with 1 random player and a party of 4 try to join, a new instance (player cap 4) will be created to accommodate them. If the player cap was 5 then they would just get added to the original instance and join the initial one random player." as you say, the player cap is 5,at the same time ,the instance is running with 1 player. what I need is sent the party of 4 to a new dungon, not but original dungon. has resolution?

@ pengcheng.zhang

If your scene has a 5 player cap and 1 player playing, then your party of 4 will always be sent there unless you lock that game to prevent more players joining. A possible solution would be to have 2 identical scenes, one that allows players to join in game and the other that locks after the whole party has joined (you can send the party size/key as player data, then boot non-party joiners back to the hub until you have the full party or a timer has expired). The players pick a portal from your hub scene that allows them to choose whether they want a one party game or for randoms to join in game.

Thank you for your advice and suggestions. I really appreciate it. I will take all this into consideration.

Could you show me When you will call Game.StopAcceptingPlayers() in script?

I haven't made any scripts yet.
I'm planning on calling Game.StopAcceptingPlayers() directly after I successfully have sent a player or group to a dungeon.

if do that ,will your social area stop other players join? Is function Game.StopAcceptingPlayers()
ref to current scene?

I will make the call from the Dungeon Scene and therefore not affect the Social area Scene.

ok, hope to share your game code when you success.