Ways to implement transition between explore and battle screen like in old JRPGs?

Hi there! I’m working on a 2D top down RPG with turn based battles but I’m having issues putting together the battle system.

So my scene structure right now is:

  • Persistent Scene: This holds the player, as well as the game and UI managers that are in charge of keeping track of stuff.
  • Environment Scene: This scene is loaded asynchronously changes as the player transitions (e.g. goes from the town to the wilderness, or into a house). This holds all the NPCs, environments, tilemaps, and enemies.

This is working well so far, but now that I’m trying to work on the battle system I’m unsure how to set it up. I can think of three ways of doing it, but I thought I’d ask here in case anyone has a better solution or ways to improve my solutions.

Here are the options I’m thinking could work:

  • Put the battle area on its own scene (i.e. make a third type of scene for my game). I’m not sure if with this method I would want to unload the Environment scene and then reload it though, or just keep all three scenes loaded. Unloading it would mean having to save the player location and enemy locations, etc.
  • Put the battle area in the environment scene, somewhere off camera. This seems, like the easiest method, but would require me to make a battle scene for each environment scene.
  • Put the battle area in the persistent scene. This seems sensible, but I’m not sure how well it would work since I’d likely have to turn it on and off so that the player doesn’t see it during exploration.

Any thoughts on this? I think the thing I’m struggling the most is that no matter which of these options I pick I have to either keep track of where the player was before battle and then put them back, or leave everything as is (and use a second player copy in the battle area) but somehow pause only the exploration part while the battle happens.

Any tips from someone who has worked on this kinda system before?

The simplest thing to implement would be additively loading a battle scene and working out how to properly disable your other scenes while it’s happening. The disabling part should be relatively simple. That saves you from having to recreate your other scenes when the battle ends.

Thanks for the reply! Yeah I’m leaning towards this as well. Just to clarify:

  • Loading a battle scene async that takes in info from the persistent scene
  • Pausing the other scene (so I don’t have to worry about rebuilding it the way it was before the battle)
  • Unload battle scene after it’s over

The issue is step 2. You said it should be relatively simple. I’m a beginner still so maybe I’m not thinking of a good solution for this but I can’t quite figure it out. I guess I could use a sort of global “Pause Exploration” variable that when disabled removes movement control, halts monster/NPC movement, etc. Does that seem reasonable?

You could do it that way but you would have to check that variable in about a million places, and you’d probably miss a few.

Instead, I’d loop through all of the GameObjects in https://docs.unity3d.com/ScriptReference/SceneManagement.Scene.GetRootGameObjects.html for the main scene and just call SetActive(false). Then when you unload the battle scene, reactivate them.

Oh interesting, didn’t know this method. I take it I can use it from a different scene? For example, could I have my Persistent scene use it to find all the objects in my exploration scene?