- Home /
Classic turn-based RPG battle scene question
I want to create a turn-based battle system where the player is transported to a different scene when they touch an enemy.
Should I implement this with multiple scene files (moving to different scene while battling and return to exploration scene) or should I just use one scene and move my player to an isolated portion of the map where the battle takes place and transport them back when the battle is over?
If I use multiple scenes, is there a way to communicate between scene files?
Answer by GameVortex · Nov 23, 2013 at 09:53 AM
There is unfortunately not any one right answers to a question like this. It all depends on what works best for your project. There are many ways of doing this:
1: My favorite is to make the battle as a separate scene and loading it when doing battle. This has a couple of good advantages: You can easily change which scene to battle in depending on where you are in your main scene: Beach battle if you are walking on a beach, forest battle if you are walking in a forest. Also, multiple main scenes can share the same battle scene.
There are two ways of loading a battle scene in this scenario: Additive or Normal. In my project I used Additive, this has the advantage of not having to unload the main scene (which could be kind of large) and then having to load it again after the battle. I just move my assets to the battle scene after it has loaded. The disadvantage with this is that you have to have some extra control over the assets that gets loaded with the scene like Directional Lights, Lightprobes and Cameras because they could interfere with what you have in your scene already. Also Occlusion baking will not be taken into account when you load scenes additively and NavMesh will have to be generated at runtime which I think is now possible with the new 4.3 version.
With the Normal loading method you don't have to have that much control over lights and such but the disadvantage is the unloading and loading of the main scene and the need to store information about what had changed in it like monsters spawned, NPC locations and player location.
2: Second method would be to have the battle area in a remote location of the main scene as you said and just move your players to the scene when needed. This works fine for main scenes that won't have multiple battle locations and when each main scene are not going to share the scene and instead have their own unique battle location. This makes it easier for not having to load battle locations individually.
3: If your battle scene is small you could just have the entire scene in a prefab and instantiate it into the scene you are. This is just an alternate method of method #1 without the specific scene loading. The prefab here can of course not have Occlusion, Lightmaps or Lightprobes baked. So not really recommended.
I recommend method #1, but it all depends on you if Addtivie or Normal works best for your project. Also, just ask if you need me to clarify anything. =)