Issue with using 2 scenes with MRS in 1.x

This a conversation carrying over from Discord under Help > “MRS issues with 1.1.3”. There is some context there, if needed.

My main objective is to get a 2 scene (Menu and Game), MRS environment working in coherence 1.0.5 as it was in 0.x. In 0.x, the game had the 2 scene MRS environment fully working as I would expect both locally and on Coherence Cloud. After investigating this more, I can confidently say that this is no longer working the same as it was pre 1.0.

I’ll explain the basic steps I’ve taken in hopes that it helps to understand maybe where I’m going wrong in implementation or maybe just misunderstanding the concept:

  1. I have 2 scenes, Menu and Game. Conceptually, the player opens the Menu scene first, uses some UI to find/connect to a room, then when they connect to a room, the Game scene additively loads and becomes the active scene.

  2. I use the MRS wizard to setup each scene as outlined by the wizard. In 0.x, there was an option to use either 1 or 2 scenes for an MRS setup; I believe there was a difference for how each scene was setup in the wizard before, but I’m going by memory here. As of 1.0.5, these options have disappeared, so I use the MRS wizard to add the same required components to both Menu and Game scene.

  1. This does not achieve the required result by using the wizard alone. The wizard does allow establishing a client connection, and also the simulator connection is made and simulator scene is loaded. However, the Game scene does not additively load, and obviously does not become the active scene. (and why would it? In the base MRS wizard components, there is nothing to tell the system what scene should be loaded on connection.)

  2. Fortunately, there’s a component that seems to make perfect sense here, which is CoherenceSceneLoader, which allows configuring what scene to load and on what connection type. There is an “Attach” property on this component as well. In 0.x, adding this component to the Menu scene and configuring the component to open the Game scene on Client connection worked exactly as I would expect and did just that. In 1.0.5, it does this also, but it requires enabling the “Attach” property. I’m going by memory here, but I’m almost certain this was not required in 0.x. This is not a big deal to change obviously, but it is a difference to note.

  3. Here is where things diverge and really break down. In 0.x, the Client objects existed in scenes and so when they were instantiated using this setup, they were created in the Game scene. This also meant that all network objects moving forward were also instantiated in the Game scene. This is what we want because we want the players to see the objects in the Game scene.

In 1.0.5, the Client objects exist in the DoNotDestroyOnLoad scene, which seems fine, but when the Game scene gets loaded by CoherenceSceneLoader, it creates a 2nd Client in DoNotDestroyOnLoad. The fact there are 2 Clients also is maybe not necessarily even a problem (you’d know better).

The issue that actually prevents me from moving forward is that any network objects instantiated by the simulator seem to only be detected by the first client, the Menu client. This is evidenced by the fact there are 2 authoritative Clients in DoNotDestroyOnLoad, but only 1 non-authoritative Client (what the Sim sees) and I was able to verify this is the Menu client. I would expect if Sim detected both clients, there would be 2 non-authoritative Clients here instead of 1.

This essentially means that all network objects being created in the Menu scene, which is not what we want to happen.

v1_0_5-MRSissue


I’ve tried many different things to try to make this work conceptually as it used to, but I have not found a solution that works as expected.

It’s possible that there is some simple configuration I’m missing by following the docs. I’ve reviewed the updated docs for both MRS and Scene Transition, but the feeling I am ultimately getting as a coherence user is that MRS and Scene Transitions have been developed maybe in 2 different isolated cases.

MRS seems to work as expected if only 1 scene is used. I also tested the scene transition functionality and it seems to work if MRS is not being used. If they are used together though, they do not seem to play well. This is just my “feel” from the outside though.

Please advise if you can see something I’m missing or have some suggested steps to ultimately get to the desired objective. This is something I’d like to get resolved as quickly as possible as it prevents future network development.

Hey there. Yeah, excellent description of the problem and I think you’re right that the behaviour is changed. I’m not sure what a quick fix is right now, so we’ll need some time to discuss this.

Hey! Really appreaciate the thorough description. We’ll be discussing this internally, as Cary pointed out, but for the time being, I’ll give you some rough high-level details.

Since 0.x we’ve decided to streamline the wizard and only offer directions for simpler one-scene setups.

The wizard for the two-scene setup depended on the legacy sample UI. This sample UI had a reference to a CoherenceSceneLoader, which was the responsible for loading the game scene.

Right now, if you’d like to mimic what was there, you’d need to write you write your own connection UI, and connect using CoherenceSceneLoader (and CoherenceScene).

Attaching was handled by the wizard/sample ui iirc. What attaching does is trigger the load/unload logic on connects/disconnects made by the bridge.

Roughly, this is what should happen, in a 2-scene MRS setup (Menu + Game):

In your Menu you have some connection logic. Either you enable loader’s attach, or the logic has to use loader.Load(enpointData) manually. Menu should have no bridge nor other coherence-related components (e.g., live query) , since there’s no networking happening there. Which I think do do correctly, looking at the screenshot.

CoherenceSceneLoader/CoherenceScene is the core building block on top of MRS - they enable bulk scene loading, and making sure the bridge association and connection are done right.

The team will take some time to review your specific case internally, see what exactly is going on, and if there’s a bigger problem involved in all this.

Thank you for chiming in!

Thanks for the response, and I’m pretty sure I understand what you’re saying.

I just tested to see what happens if I take Bridge out of the Menu scene because I did actually have it in both scenes, but the built-in connection UI gives me an error if I don’t have Bridge in the Menu scene, so I can’t connect to the room and thus trigger the SceneLoader’s Attach.

Therefore, for me to connect and trigger the SceneLoader, I need to write something custom to perform the connection.

Does that sound correct?

If that’s right, I will wait and see if you plan to change something to support this kind of setup working out-of-the-box before I do anything.

I will say, for my part, I understand the intent of streamlining and making an MRS setup more digestable as it promotes people using it. However, I also think anyone who is using MRS has already taken a more difficult path to set up networking because they are probably thinking about scalability, at least that’s my reason.

Having multiple scenes is more scalable than a single scene for an entire project. Because of this, in my mind, multiple scenes and MRS sort of go hand in hand.

Even though I only need 2 scenes in my setup to meet my needs, I do not think it is hard to imagine games that would be best suited with an MRS, multi-scene setup. Those would likely be among the biggest games that are developed (and thus highest network demands).

That’s just my 2 cents, obviously it’s in your domain, but please let me know when you decide as that decision will be actionable for me.

Thank you again :slight_smile:

Indeed. As the team worked on a new UI, the integration with MRS was discarded for the sake of simplicity. So chances are you have to write your custom connection logic. The current documentation around is rather sparse. You can take a look at the samples themselves to reproduce something alike for your specific use case.

I understand this is a downgrade to your current experience. Sorry in advance.

Right now there’s no plans on the roadmap to support this scenario.
However, I’m forwarding two topics internally:

  • Work on a MRS sample, with a 2-scene setup in mind.
  • Feasibility of out-of-the-box MRS support for the sample dialogs.

I will reach back if there’s news regarding MRS.

That said, I encourage you to write your connection logic and handle connection your own. I did this a few times for gamejams we organize internally. The bit that differs from what’s on the samples, is that the connection should be forwarded through the loader (loader.Load(endpointData)). That should be it.

I’d start peeking at the samples themselves, but you also have Coherence.Cloud (and Coherence.Cloud.Coroutines, provided as an extension layer).

Nonetheless, let us know if we can help you figure out custom connection logic.

Agreed. The compromise we went for for 1.x here makes it for worse out-of-the-box MRS experience. The intent of the wizard was to help illustrate what is needed to make MRS work. An onboarding, so to speak.

1 Like

Thanks for the insight and I know development is both a creative AND destructive process, so it’s all good.

At the end of the day, custom connection logic was going to have to be written at some point to use a custom UI and get full game immersion; I just didn’t want to do it quite yet :smile:

So, this doesn’t cause me to do anything I wasn’t already planning on doing, it just changes the timeline, which isn’t the end of the world.

I will start another post if I need help with setting up the custom connection, but I think you’ve probably given me enough here to be able to work my way through it.

Thanks for the help and quick responses

3 Likes