Custom Implementation
A brief and quick explanation of what you must not forget to do if you implement your own GameInstance, PlayerState, HUD, PlayerController, etc.
As usual, I always warn that creating your own implementation of a system with your own mechanics and logic will always require work and a certain mastery of the engine, as well as an understanding of weak and strong dependencies, along with OOP and event-driven programming.
GameInstance
As always, when you implement your own GameInstance or migrate an asset, never forget to check if the correct GameInstance will be used in the project settings!
The GameInstance must implement the BPI_ACS_GameInstance in order to return the ACS_GameModule, which must be instantiated at the start of the game through the Init of the GameInstance.
PlayerState
Your PlayerState must implement the actor component BP_ACS_GamePartyComponent.
HUD
Your HUD should implement the actor component BP_ACS_CommonHUDComponent.
Character
Your Character must have a SceneComponent with the tag ACS_ViewPoint so that the camera focuses on your character when the character selection menu is activated.
You can also add another SceneComponent to determine how the character will be spawned in the selection menu. You need to know the position of the ground relative to your character's feet:
PlayerController
The PlayerController should implement two components:
Why ACS_StateComponent in PC
The StateComponent is used in the PlayerController to know when the system swap the character:
So I update things like the UI when this happens.
Why ACS_CommonPlayerController in PC
Overall, the ACS_CommonPlayerController is used to centralize a good part of the code that manages the player's character team within the PlayerController, so you don’t have to inherit from the template's PlayerController to create your own implementation.
You should read and understand how it’s used in the example PlayerController to implement it in yours.
An example of how this component is use, when you open the menu and when it closes
Open Menu
ActivePreviewScene will switch the camera to the outside skybox sphere with the preview character, etc.
Also, it blocks input to avoid the possibility of moving from the controlled pawn.
Close Menu
DeactivePreviewScene will switch the controlled pawn camera
Also, restore controlled pawn input
UI
All the dependencies of the graphical menu for viewing the team are in the PlayerController.
Overall, everything operates through broadcasts and events. You can read the code located in the ACS_PlayerController to understand how I listen for menu events in OnUIConnected.
It’s in the InitUI function that I create my widget on the screen and bind the events of the team system so that the menu performs certain actions based on the state of the PartyMenuManager.