How to deal with default player pawn and pawn possession?

I’m having issues with my default player pawn. In my project I have a setup similar to Anthem. The player walks around in a hub, and then when the go out patroling they take control of a pawn. I had a player starts added to the levels and was attempting to select a player start, spawn the pawn I needed and possess it after the level streaming finished. The problem I have is that my game mode has the default pawn set to the player character in the hub, so my system would spawn the pawn i specified and possess it, but it would also spawn the default pawn setup in the game mode at 0,0,0. It didn’t appear to me that you could change the game mode settings on a per level basis. Every time I tried adjusting the default pawn to the new pawn it would change the default pawn for the whole project. It didn’t matter if I changed the default pawn using the override under the level settings, or the world settings to the right, or the project settings in default game maps & modes.

The solution I came up with was to set the default player pawn to none for the project and then explicitly place the actors I want to posses into the level. When the levels load I auto possess these pawns. This stopped the default pawn from spawning along with the pawn I wanted to control. If someone has a better solution and is willing to provide some guidance I am all ears. Is there a way to override the default pawn per level? What’s the best practice and flow for dealing with this stuff?

It’s my understanding that the method you are using is pretty standard. It’s common to set the default pawn to none in your GameMode (GM) and manage the Spawn and Posses manually either in the PlayerController (PC) or the GM.

I have a multiplayer lobby map where players can harmlessly hang out with other players. It has it’s own GM and PC so players spawn into a dummy pawn to prevent them from having fighting abilities. But when loading into a match, those levels have a GM override in the world settings that uses a different GM to keep track of the match and a PC that spawns in characters that can use weapons and abilities and such.

I hope this helped.

@Ham1ton How do you setup and use multiple game modes? I have my game setup using level streaming. So I have a persistant container level and my sub levels contain and stream between loading screens, main menu, my hub zone, and my playable level. When I try to override the game mode it changes it for the whole project and every sub level. Is this a sub level limitation? Can sub levels override the game mode? if not how are you supposed to actually setup a menu, level, and loading screen flow to allow the game mode to be overridden and still allow a triple AAA quality looking game setup?

@xpgained That question is a little over my head in terms of using Game Modes with level streaming. I don’t think you can have different GMs for each player but I could be wrong on that. What is the reason you need to switch? Maybe you don’t have to…

If you need the player to have different pawns for different sub levels or locations, you may just want to unpossess their PlayerController from the pawn they are in and send them off to posses a new one that is appropriate to that new location. This could be done wherever you’re managing your level streaming. If the player starts in a menu area with a simple pawn and makes some selections or whatever. When the level streaming finally happens, you could send them to whatever pawn and location they need to be in. Be aware that when you UnPossess a PC, the old pawn it was in just sits there and may need to be destroyed if you don’t need to repossess it later or recycle it for someone else.
Hope this was helpful.

@Ham1ton that’s an interesting idea. I will take a look at player controllers and see if that might work. The problem is I expect when I change the player controller it will change it for the whole project just like the pawn in game mode. If this is the case I think it’s safe to assume my setup is wrong and isn’t the correct way to do loading between levels.

@xpgained You can posses/unpossess the player’s PlayerController in and out of any pawn character without the need to change to a new PC. I think of the PC as the players soul, rarely or never destroying it but putting it into the right body at the right time, that’s why they use the possession terminology. Let’s say your level streaming logic is prompted to load the Hub Zone after a character completes a playable map. When the streaming level logic finishes loading the Hub area, you can then do some logic to unposses your player’s PC from their current character pawn, then possess a new pawn appropriate for the newly loaded area. This way, no change of the GM or PC would be necessary.

@Ham1ton I think you just fixed my problem. I’m not 100% positive, but i’m pretty sure I haven’t been unpossessing the default pawn between levels which would be causing my problems I think. I’m gonna give it a go and then I’ll report back.