A implementation question - character - character between levels

Hi, I will try to explain what I need to implement. First say that actually I know how to solve this, but maybe there are better / cleaner / more correct ways to implement this.

Exploration Mode:
The player can have multiple characters, say ten.
Each character belongs to a specific class like “warrior”, inheriting from a base class.
The player can increment stats for every character, change equipment, etc, classic RPG mechanics.

From that ten characters the player can select a subgroup, say 4 of them .
This four characters are the players team, and can be changed anytime in expiration mode.

Battle mode:
Then the players enter to battle mode.
Here I have other characters that represent the four selected in Exploration mode.
I am not using the same characters, because the mechanics from the exploration mode and Battle mode are totally different.
Example: In Exploration mode you can freely walk with WASD and mouse, and interact with actos in the world. In battle mode I have a turn based mechanic, likely Final fantasy games.

The battle mode is other map/level (or maybe could be the same?), so I need to transfer all the data from the four characters team (GameInstace could be helpful here?), and recreate the corresponding battle mode characters.

So, how / what / which is the best way to, based in the four selects characters in Exploration mode, create and spawn the 4 corresponding “battle characters” .
Taking into account the all the stats needs to be obtained, the equipment, etc.

Is there a nice and clean way to do this? How can I manage all the information I need to keep between levels/maps, then analice it, then create the correct “battle characters”, then if for example the health ends being 40/100, match the battle character to the corresponding “exploration character” and set the correct health update when exit the battle?

Correspondientes I think is a little tricky to manage and I want to do it in a nice way. Because it could turn into a truly mess

thanks and I am sorry for my English.

Off the top of my head, I would use the savegame system. You will need a method for saving the character info to disk, and then retrieving it again. Why not use the same system when transferring between maps? When transferring, save the game (possibly to a special slot) including setting the position to the next map. You can then just do a standard load game operation, like if the game had just started, and end up on the next map.

Thanks @HavocX for your response!
and Yes, that could be a posibility.
What is buggig me right now is if I should have two set of characters. One for the “Exploration mode” and other for the “battle mode”. In this case I will need an Adapter, to adapt from one character to other.
Or just implement aaaaall the functionality in just one, and use differents implementation depending on what game mode I am.

I was thinking in a character that implements two interfaces. One “IExploreCharacter” and other “IBattleCharacter”
So in each GameMode, depending if I am IN a battle mode map or an Exprore map, I will have a List of “IBattleCharacter” or a List of “IExploreCharacter”, Exposing only the implementation I want to use in each map.

What do you think_

thankyou so much

With the adapter, do you mean for character-world interaction?

I mean an Adapter like an Adapter patern

In the case I go for two differents characters (Most likely), I need to

  1. While in Explore Mode Map, Store the selected chararters (with class A) in a List somewhere.
  2. When changing lvls persist this List in disk or in some “in memory” persisten object like GameInstance
  3. When the new map (Battle map) is loaded, restore the list of “class A” characters and **Adapt **them to the other “class B” characters
  4. Spawn the class B characters into the loaded Map

The Adapter will create the B Objects with all the parameters needed taked from A. And vice versa

Class A = ExplorarCharacter
Class B = BattleCharacter

Final Fantasy doesn’t load a new map for when you enter battle mode;
They store the data into something like UE’s PlayerState or GameInstance, the pawn in battle doesn’t hold anything RPG related.

What I particularly do in UE4 is:

  • I don’t switch maps, I keep battle map loaded in memory.
  • Use State Machine to control current world state (world, battle, cinematic)
  • Battle streamed map has spawn spots in place with blueprint characters, world pawn’s camera can’t see this stuff.
  • I actually do keep stats in pawns spawned to make my life easier and copy values from a custom Actor Component.
  • When world director enters battle state, I possess pawns in battle streamed map changing camera in use as well.
  • After returning to world state, update player data and save if needed.
  • I don’t use GameInstance, I store everything in GameMode’s classes and use my SaveGameMode() function.
  • With that saved I can transfer/restore progress across different persistent maps.
  • If game is in Multiplayer I use PlayerState to hold/copy values when traveling across online maps.

mmm this is interesting [MENTION=434]BrUnO XaVIeR[/MENTION], thanks for this information. I should investigate a little more about streamed maps and how they work.

One thing I didnt understand (probably my English languaje limitation)

“I actually do keep stats in pawns spawned to make my life easier and copy values from a custom Actor Component.”

You are saying the you use two types of pawns, one for “World Mode State” and others for “Battle mode State”?
And you share stats information with an Actor Component?

I know it should be easier to have only one Pawn type for everything, but I feel like that will end in unmaintainable code, and chaging logic for the exploration mode will end up braking other stuff for the battle mode, etc.
In other words, everything would end up too much coupled.
Also I have the two types of characters working, so I need to deside if keep them as separates entities or merge them into one.

By the way, actually I am using your save system to store save game data, <– thanks for that, makes my life easier

Yes, separate pawns. I didn’t see a reason why to code everything into a single Character blueprint;
As you said that would be a mess, too much unrelated code put together thus I just use different pawns.