Building System documentation - Getting Started EN|FR

1] Plugin:

- Download & add plugin LE Extended Standard Library in UE
- Go to your own project, activate plugin LE Extended Standard Library and Procedural Content Generation Framework, for that, go to Settings -> Plugins, search for Low Entry in search bar and tick the plugin. - Then search for Procedural Content Generation Framework in search bar and tick the plugin.
- Don't restart, just exit the project.

2] Migrate content & Collision:

- Create project from Survival Building System from Epic Launcher, and open it.
- Go to Settings -> Project Settings -> Engine -> Collision and clic Export... button and export it where you want.
- Right clic on SurvivalBuildingSystem folder on Content Browser -> Migrate (select only SurvivalBuildingSystem folder hierarchy)

3] Implement System in our project:

A) Project Settings:

- Go to your own project.
- Go to Settings -> Project Settings -> Engine -> Collision and clic Import... button for import collisions from file you exported before (if you have custom Collision, make sure to re add them after)
- Go to Settings -> Project Settings -> Engine -> Rendering, searh for Enable virtual texture support and tick it. - Restart your projet

B) GameInstance:

You don't have GameInstance or you use basic one without modification:

- Use BP_SBSGameInstance (SurvivalBuildingSystem -> Core) instead, so change GameInstance on Settings -> Project Settings -> Project -> Maps & Modes, last settings is for GameInstance, switch it by BP_SBSGameInstance (SurvivalBuildingSystem -> Core)

You have already custom GameInstance:

- Go to BP_SBSGameInstance (SurvivalBuildingSystem -> Core) and copy SaveGame custom event to your own GameInstance on Event Graph.

C) BP_BuildMng (only if you using custom GameInstance):

- Go to BP_BuildMng (SurvivalBuildingSystem -> Core) and edit GameInstance variable type to your GameInstance on object reference.
- You get an error on compile right ? Fix error on Save event, for that:
delete call of SaveGame event and take pin from GameInstance variable to search for SaveGame, link to set function on execution pin and link the SaveGame variable to SaveGame input, and set SlotName to Building
Like this:


D) GameMode:

You don't have GameMode or you use basic one without modification:

- Use BP_SBSGameMode (SurvivalBuildingSystem -> Core) instead, so change GameMode on each maps to use BP_SBSGameMode, for that go to World Settings -> GameMode Override and change it for BP_SBSGameMode (SurvivalBuildingSystem -> Core)

You have already custom GameMode:

- Go to you GameMode and add Variable type BP_BuildMng object reference, and name it BuildMng (or copy that variable from BP_SBSGameMode).
- Then open BP_SBSGameMode (SurvivalBuildingSystem -> Core) and copy Event BeginPlay and checkBuildManager code to your GameMode, if you have already BeginPlay, add our part after your code.
- Only if you using custom GameInstance, replace cast from BP_SBSGameInstance on checkBuildManager by your own GameInstance cast
- Copy function InitBluidManager to your GameMode.

E) BPL_Functions (Only if you using custom GameMode):

- Go to BPL_Functions (SurvivalBuildingSystem -> Core -> Libs) and edit function GetGameModeBP and replace cast and output variable type to your GameMode.

F) PlayerCharacter:

You use basic PlayerCharacter like ThridPersonCharacter WITHOUT modification:

- Use BP_SBSPlayerCharacter (SurvivalBuildingSystem -> Core) instead, so change PlayerCharacter on GameMode by BP_SBSPlayerCharacter (SurvivalBuildingSystem -> Core), for that go to World Settings -> Selected GameMode and change Default Pawn Class by BP_SBSPlayerCharacter.

You use PlayerCharacter WITH modification:

- Go to you PlayerCharacter and add Variable type BP_Building object reference, and name it BuildingTarget (or copy that variable from BP_SBSPlayerCharacter).
- Add Component type BPC_BuildComponent and name it BuildComponent.
- Then open BP_SBSPlayerCharacter (from SurvivalBuildingSystem -> Core) and copy function InitKeyMapping to your PlayerCharacter.
- Copy function TraceBuildInterface to your PlayerCharacter.
- Copy code from red comments on Event BeginPlay to your PlayerCharacter Event BeginPlay, that part need to be after base input mapping.
- Copy code from red comments on Event Tick to your PlayerCharacter Event Tick, but if you don't have Event Tick, then copy all Event Tick to your PlayerCharacter
- Copy code from red comments Building System - Inputs to your PlayerCharacter where you want.
Now we can adjust camera to make it better for BuildingSystem :
- (optional)Attach CameraBoom to Mesh
- (optional)Change Target Arm Length to 300 (Default: 400)
- (optional)Change Location of FollowCamera to X:0, Y:50, Z:150
- (optional)Change Rotation of FollowCamera to X:0, Y:-10, Z:0
In that way, character will be a little off to the left and bottom to leave the crosshair free

G) HUD/ATH:

You don't have HUD/ATH:

- Use WBP_Hud (SurvivalBuildingSystem -> UI), add all part of your interface to that widget, it will be loaded by BP_BuildComponent automatically.

You already have HUD/ATH:

- Go to WBP_Hud (SurvivalBuildingSystem -> UI) and copy all content of Canvas Panel (not Canvas Panel himself) and Paste it on you HUD/ATH canvas panel.
- Crosshair was not in middle ?, edit SB_Crosshair and make position X & Y to 0.
- Go to Graph on WBP_Hud and copy UpdateCrosshair function to your own graph hud.
- copy SetInvalidText function to your own graph hud.
- Create variable type E_CrosshairType and name it CrosshairType (or copy that variable from WBP_Hud)
- Create variable type BPC_BuildComponent and name it BuildCmpt and make it Instance Editable and Expose on Spawn (or copy that variable from WBP_Hud)
- copy custom event Init on Event Graph to your own hud Event Graph
- Go to Designer, select Crosshair (image) on Hierarchy and on Brush use Bind scroll menu and Create Binding.
- Go to WBP_Hud and copy content of Get_Crosshair_Brush function to same function on your own hud
- Be carefull, outputs are duplicated, so delete all outputs excepts first one (ReturnValue as SlateBrush type)
- And if Texture 2D pin was disconnected, connect it to return Value Image
Like this:


H) BuildComponent:

If you have custom PlayerCharacter:

- Go to BPC_BuildComponent (SurvivalBuildingSystem -> Core) and edit Character variable type if you use custom PlayerCharacter
Some error was created when Character variable changed:
- 1} On Init custom event, delete Cast and make another cast from your own Player Character and link to Character variable SET.
- 2} On PlayerTraceVector function, replace Camera Boom from previous Character with new one and same with Follow Camera
- 3} On GetRotation function, replace Follow Camera from previous Character with new one
- 4} On DetectPawns function, you can just relink correctly with Get Class

If you have custom GameMode:

- Edit BuildManager comment on Init event (Event Graph) delete get BuildMng after GetGameModeBP (below InitBuildManager) and get BuildMng from GetGameModeBP output pin.
Like this:

If you have custom HUD/ATH:

- Change HUD (not Build_HUD) variable Type to your HUD widget type on object reference.
- Delete Create Widget and Add to Viewport, get your own Hud from where is stored (PlayerCharacter or PlayerState ?) and link to set HUD variable.
- And Delete Init called event, and recall it from HUD set variable
Something like this (My HUD is stored in PlayerState in this case):

Some error was created when HUD/ATH variable changed:
- 1} On Init custom event on Initialize Build HUD comment, delete Get WBP_BuildHud and make another Get WBP_BuildHud from HUD variable and link to Build_HUD variable SET.
- 2} On Init custom event on Initialize Build Menu comment, delete Get WBP_BuildMenu and make another Get WBP_BuildMenu from HUD variable and link to Build_Menu variable SET.
- 3} On ActiveBuildMode function, delete Get WBP_BuildInfo and make another Get WBP_BuildInfo from HUD variable and link to SetVelocity function to Target pin.
- 4} On DisableBuildMode function, delete Get WBP_BuildInfo and make another Get WBP_BuildInfo from HUD variable and link to SetVelocity function to Target pin.
- 5} On ToggleMenuMode function, Delete UpdateCrosshair and Call UpdateCrosshair from HUD variable and change Type to Normal value and link to execution reroute pin.
- 6} On TogglePlacingMode function, Delete UpdateCrosshair and Call UpdateCrosshair from HUD variable and change Type to Normal value and link to execution pin.
- 7} On ToggleDestroyMode function, Delete UpdateCrosshair and Call UpdateCrosshair from HUD variable and change Type to Forbidden value and link to execution pin.
- 8} On InitBuildColor function, Delete SetInvalidText from True pin and Call SetInvalidText from HUD variable and leave InvalidText empty and link execution pin to True pin.
- 9} On same previous function, Delete SetInvalidText from False pin and Call SetInvalidText from HUD variable and link InvalidText reroute (pink line) to InvalidText pin and link execution pin to False pin.
- 10} On DestroyMode function, Delete SetInvalidText and Call SetInvalidText from HUD variable and leave InvalidText empty and link executions pins from True pin and to PlayerTraceVector.

I) Maps as ground:

You need to make that modification on each landscape and staticmesh that used as ground on each level that use this building system.

Edit Collision Presets to Custom, expand it and tick Build_ground on Block.
Like this:


And voila !