Farming System + MSGT (Multiplayer Survival Game Template)

HOW TO INTEGRATE THE FARMING SYSTEM WITH THE MULTIPLAYER SURVIVAL GAME TEMPALTE (MSGT)

  • Begin by Migrating the Farming System to your MSGT installation

  • Add the FarmingSystem component to the MSGT’s SurvivalController

  • Copy the Events from the BP_PlayerController (inside the FarmingSystem folder) to your SurvivalController, EXCEPT the last event (Input: E), we’ll add this to the MSGT’s own interaction system.

  • Inside the SurvivalController, open the “GetActionType” function, modify it as such:

  • Open the C-FarmingSystem component (Inside /FarmingSystem), below is an example to get the reward when harvesting a plant

  • The reward when harvesting a plant is simply a “Row Name” that you define in your own DT_SGT_ITEMS DataTable, whatever you type into Rewards (on the right screen) is what you will get when harvesting a plant.

That’s it!

Farming System – HOW TO USE

HOW TO ADD THE FARMING SYSTEM TO YOUR OWN PROJECT

Begin by Migrating the FarmingSystem to your own project

Add the Component to your PlayerController

Check the example BP_PlayerController on what functions/events to execute from your own PlayerController.

Settings

  • Enable Snapping
    Enable/Disable placement snapping when placing new farm actors
  • Enable Trace Interaction
    Enable/Disable the Farming System’s built in Actor tracing (when aiming at a Farming Actor, it will display a “Interact” text on screen
  • Enable Collision Check
    Enable/Disable collision check when placing down farm actors, it only checks if it’s colliding with any other farm actors
  • Placement Update Rate
    Determines how often we want to update the placement location, this can be decreased at the cost of performance and make the movement smoother
  • Default Water Amount
    This default water value will be added to the new farm actor when placed

How to edit Blueprint USTRUCTS() in Unreal Engine

Before attempting ANY of this, PLEASE READ THE FOLLOWING!!

  • I take NO RESPONSIBILITY if You or Unreal Engine mess up when editing a Blueprint USTRUCT().
  • Make sure you BACKUP your project BEFORE doing ANY USTRUCT() work in Unreal Engine 4.

First of all, open your “Project Settings” and select the “Entry” map as the “Editor Startup Map“, you need to click “View Options” at the bottom and select “Show Engine Content” for the Entry map to show up. This is so the engine loads up without any references to anything other than the engine core.

In your Editor Preferences, disable Auto Saving (at least when editing a Struct)

RESTART THE EDITOR AFTER YOU’VE SELECTED THE MAP & DISABLED AUTO SAVING

Add your new Struct Variable

When you’re done editing the struct, click “SAVE” inside the Struct editor, DO NOT CLICK SAVE ALL!!!!

THIS IS THE THE MOST CRUCIAL PART!!!

CLOSE THE EDITOR & DO NOT CLICK ON SAVE SELECTED!!!

Click on “Don’t Save” and Restart your Editor!! Don’t save or touch ANYTHING else.

Using this method, you’ll keep all the Struct references intact and can edit Blueprint USTRUCTs however you like, without making a mess, IF you make a mess, you’ll have to Replace ALL references to that Struct in every blueprint and every function that has a reference to it.

Happy USTRUCT editing 😉

Integrating Simple Build System with Multiplayer Survival Game Template

Assets required for integration

Before you begin, please read the following!

  • START BY BACKING UP YOUR PROJECT BEFORE MIGRATING, I take NO responsibility if You or Unreal Engine mess up the Migration/Integration process.
  • The Multiplayer Survival Template doesn’t have a default definition of Resources such as Wood or Stone, therefor, if you want to enable the feature of removing resources from the Player’s inventory, you’ll need to edit the Str_SGT_InventoryItem struct, I will cover this process in a separate tutorial, reason being, it can mess up A LOT of references to the struct & the DT_SGT_Items DataTable, making your entire project a nightmare to fix. DO NOT ATTEMPT THIS UNLESS YOU KNOW WHAT YOU’RE DOING
  • Begin by Migrating the Simple Building System to your MSGT Installation

  • Open up the SurvivalController Blueprint (/SGT/Blueprints/Game/SurvivalController)

  • Add the C-Building Component to the SurvivalController Blueprint

  • Select the C-Building component in the SurvivalController Blueprint (where you just added the Component), on the right hand side, in the Details panel, UNCHECK/Disable the “Enable Line Trace”

  • Copy the Events from (/BuildingSystem/Blueprints/BP_PlayerController) to your SurvivalController

  • In the SurvivalController Blueprint, add the Branch checks shown below, to make sure we’re not in Building mode when using the number keys.

  • Open the Manager-HUD component Blueprint, add a reference to the Building Component as Shown below

  • In the Manager-HUD Component, open the function “Update” and use the Reference you just created “Building Component” to call the function “CL Line Trace on Client”.

That’s it!

Step 2 of the Integration process can be found here:

How to edit Blueprint USTRUCTS() in Unreal Engine