Is it possible to run two or more scenes in parallel?

I am working on a prototype for a mechanic in an RTS game where there is a general map and detailed battles with units. However, the world should not remain static while a battle is taking place. My current solution (which is just a conceptual flow at this point, as I haven’t started developing this stage yet, since I’m researching better solutions) involves using a probabilistic algorithm to determine the outcome of the strategic view. For example, if a group of units is moving from city A to city B on the map, and the player initiates a battle in city C, when returning from the battle scene, the algorithm will calculate the position of these units (and simulate battle results in parallel). However, another solution that theoretically could yield more realistic results is to run the battle scene and the general map scene in parallel. Is it possible to implement this mechanic?

That would be a waste of resources, and you are going to need the main thread either way. Just work on data in parallel, and minimise using parallel if not required.

I mean you can have multiple scenes loaded easily in Unity. However RTS games generally need a data-oriented approach, which should let you simulate battles without scenes.

Totally, although as listed above, it might not be the BEST solution, it might be actually a nice simple move-quickly solution.

First up, you can additively load scenes in Unity. See SceneManager.LoadScene() and also see below.

BUT! You can also accomplish all the above with two master hierarchies of GameObjects in a single scene.

Second, to keep yourself sane you still want to have explicit control of what is active and inactive in each given scene, such as to:

  • disable battle, enable worldmap
  • enable battle, disable worldmap
    etc

This is helped by having all items in each scene parented to a single GameObject that you can access, allowing you to set that GameObject inactive.

WARNING: setting a parent GameObject inactive will affect ALL child objects, stopping coroutines and possibly other things, so if you choose this solution, be sure you write your scripts so they don’t mind being deactivated and activated an arbitrary number of times. This is generally not hard, but does require a tiny bit of discipline.

Additive scene loading is one possible solution:

https://discussions.unity.com/t/820920/2
https://discussions.unity.com/t/820920/4

https://discussions.unity.com/t/824447/2

A multi-scene loader thingy:

https://pastebin.com/Vecczt5Q

My typical Scene Loader:

https://gist.github.com/kurtdekker/862da3bc22ee13aff61a7606ece6fdd3

Other notes on additive scene loading:

https://discussions.unity.com/t/805654/2

Timing of scene loading:

https://discussions.unity.com/t/813922/2

Also, if something exists only in one scene, DO NOT MAKE A PREFAB out of it. It’s a waste of time and needlessly splits your work between two files, the prefab and the scene, leading to many possible errors and edge cases.

Two similar examples of checking if everything is ready to go:

https://discussions.unity.com/t/840487/10

https://discussions.unity.com/t/851480/4