Skip to content

Latest commit

 

History

History
100 lines (66 loc) · 5.55 KB

Setup.md

File metadata and controls

100 lines (66 loc) · 5.55 KB

Setup

Game Framework Setup

Real-Time Strategy Plugin for Unreal Engine 4 extends the game framework provided by Unreal Engine with features that are common in real-time strategy games.

For this, we embrace the principle of composition over inheritance: Most features are implemented by the means of components to add to your actors, to allow for the most flexibility on your side when building your game, especially when it comes to combining the plugin with other third-party software.

Some things have been carefully added to the existing game framework however, as designed by Epic, and require a few steps to set up.

The plugin also ships with a few assets that are designed to get you started, e.g. with unit AI, but feel free to modify or replace them as you see fit.

Make sure View Plugin Content is enabled in your view options.

  1. Create a player controller deriving from RTSPlayerController.
  2. Create a player state deriving from RTSPlayerState.
  3. Create a game state deriving from RTSGameState.
  4. Create a HUD deriving from RTSHUD.
  5. Create a game mode deriving from RTSGameMode.
  6. Use your player controller, player state, game state, and HUD in your game mode.
  7. Create an AI controller deriving from RTSPawnAIController.
  8. Set the Pawn Behavior Tree Asset of the new pawn AI controller to BT_RTSPawnBehaviorTree.
  9. Set the Pawn Blackboard Asset of the new pawn AI controller to BB_RTSPawnBlackboard.
  10. Set the Acquisition Object Types of the new pawn AI controller to WorldDynamic (or whichever Object Type you're going to use in the collision settings of your units).
  11. Create a player start deriving from RTSPlayerStart.
  12. Create one or more resource types deriving from RTSResourceType, setting their names and icons to use in your UI.
  13. Add the resource types to the PlayerResourcesComponent of your player controller.

Camera Setup

Usually, players control a single pawn in Unreal Engine. However, in the case of real-time strategy games, players control many units from a camera perspective far out. Thus, the plugin works best when using a simple pawn with a normal camera whose location reflects what the player wants to see right now. Individual units are not directly possessed by the player controllers, but just "owned" by them.

Creating The Camera

  1. Create a pawn blueprint.
  2. Add a Camera component.
  3. Set the Location of the Camera component as desired (e.g. X = 0, Y = 0, Z = 1500).
  4. Set the Rotation of the Camera component as desired (e.g. X = 0, Y = -75, Z = 0).
  5. Use the pawn as Default Pawn Class in your game mode.

Setting Up Camera Movement

  1. Bind the axis MoveCameraLeftRight (e.g. to Left and Right keys).
  2. Bind the axis MoveCameraUpDown (e.g. to Up and Down keys).
  3. Bind the axis ZoomCamera (e.g. to the mouse wheel axis).
  4. At your RTSPlayerController, set the Camera Speed (e.g. to 1000).
  5. At your RTSPlayerController, set the Camera Scroll Threshold (e.g. to 20).
  6. At your RTSPlayerController, set Camera Zoom Speed, Min Camera Distance and Max Camera Distance as desired.
  7. At your RTSPlayerController, set Double Group Selection Time to the number of seconds the player has for rapidly selecting the same control group to center the camera on it.

Input Setup

Many default input actions for real-time strategy games are already provided by the plugin. Given that you use an RTSPlayerController in your game mode, you can bind the following actions which should speak for themselves. Clearly, all of these bindings are optional.

At Edit > Project Settings > Engine > Input ...

Selection

  1. Bind the action Select (e.g. to left mouse button).
  2. Bind the actions SaveControlGroup0 to SaveControlGroup9 (e.g. to CTRL+0 to CTRL+9).
  3. Bind the actions LoadControlGroup0 to LoadControlGroup9 (e.g. to 0 to 9).
  4. Bind the action AddSelection (e.g. to Left Shift).
  5. Bind the action ToggleSelection (e.g. to Left Ctrl).
  6. Bind the action SelectNextSubgroup (e.g. to Tab).
  7. Bind the action SelectPreviousSubgroup (e.g. Shift + Tab).

Camera

  1. Bind the actions SaveCameraLocation0 to SaveCameraLocation4 (e.g. to CTRL+F5 to CTRL+F9).
  2. Bind the actions LoadCameraLocation0 to LoadCameraLocation9 (e.g. to F5 to F9).

Orders

  1. Bind the action IssueOrder (e.g. to the right mouse button). This will enable typical smart orders, such as moving when right-clicking ground, and attacking when right-clicking enemies.
  2. Bind the action IssueStopOrder (e.g. to the S key).

Health Bars

  1. Bind the action ShowHealthBars (e.g. to the LeftAlt key).

Production

  1. Bind the action CancelProduction (e.g. to Escape).
  2. Bind the action ShowProductionProgressBars (e.g. to the LeftAlt key).

Construction

  1. Bind the action ConfirmBuildingPlacement (e.g. to Left Mouse Button).
  2. Bind the action CancelBuildingPlacement (e.g. to Right Mouse Button).
  3. Bind the action CancelConstruction (e.g. to Escape).
  4. Bind the action ShowConstructionProgressBars (e.g. to the LeftAlt key).

Gameplay Tags

The plugin makes use of gameplay tags for enabling condition-based gameplay (such as whether a unit can be attacked or not).

At Edit > Project Settings > Project > Gameplay Tags, add DT_RTSGameplayTags to the Gameplay Tag Table List.