Open RTS Plugin for Unreal Engine 4

I’m happy to announce the first changes of the game have been merged to the plugin, so here we go with the

December 2017 Update

Features

  • Add tech tree requirements for constructions and production.
  • Add floating combat texts to show above actors.
  • Add error messages for players that try build or produce actors without having enough resources or meeting their requirements.
  • Add cheats for increased construction and production speed, god mode, resources and immediate victory.
  • Add localizable names and descriptions for actors.

AI Players

  • Allow building constructions and producing units for non-player controllers.
  • Move player resources to dedicated component that can be attached to Controller actors.
  • Added player AI controller base class.
  • Spawn AI players when match starts.
  • Prevent AI players from taking builders away from unfinished construction sites.
  • Prevent AI players from blocking their own path between resource source and drain by constructing new buildings.

Orders

  • Allow issuing move orders and placing buildings on landscapes.
  • Add player controller method for starting non-default productions.

Match

  • Allow initial units to be spawned with an offset to their respective player start.
  • Finish construction of initially spawned buildings immediately.

Events

  • Add event methods for finished productions for players.
  • Raise events whenever a unit has received a new order.
  • Include damage causer in HealthChanged and Killed events.
  • Properly raise Killed event before actor is destroyed.
  • Correctly raise Depleted event before resource source actor is destroyed.
  • Include both old and new resource amounts in ResourcesChanged event, as well as whether they got synced from the server.
  • Prevent duplicate issued order events on listen servers.

Utilities

  • Add method for checking whether a unit is idle.
  • Add utility method for finding the closest resource source of a specific type.
  • Add AI utility method HasOrder.
  • Add utility methods for getting the collision size or height of an actor, and for getting the distance between two actors, including or excluding their size.
  • Add utility method for casting a ray to find the ground level of a specified location.
  • Add utility method for verifying whether a unit is controlled by an AI player.
  • Move method for transferring ownership from player controller to game mode.
  • Move method for verifying suitable building locations from player controller to utilities class.

Improvements

  • Slightly changed distance tolerances for some order types to achieve a more natural unit movement.
  • Improve projectile behaviour by detonating closer to their target location.
  • Have gatherers take their own collision size and the collision size of their target resource source into account when checking their gather range.
  • Spawn produced actors next to their producers instead of at the exact same location.
  • Improve general unit behaviour by taking actor collision sizes into account when moving into range.
  • Correctly scale collision sizes returned by utility functions by actor scale.
  • Move builders away from construction site before spawning building in order to prevent spawn collisions.
  • Prevent spawn collision or spawning at wrong side of the world for produced actors.
  • Correctly check construction range before spawning construction sites.

Bugfixes

  • Make plugin PCH public in order to properly allow the plugin to be linked with other projects.
  • Add RTSPLUGIN_API in order to properly allow the plugin to be linked with other projects.
  • Prevent compiler error for fog of war actors in non-editor builds.
  • Add a few missing includes and forward declarations.
  • Move pre-compiled header first in attack component.
  • Reorder includes of attack component.
  • Prevent duplicate issued orders log output on listen servers.
  • Correctly match character decal size with their colliders.
  • Fix some names in construction site logs.

Will you upgrade this to 4.18 from 4.16?

What the heck lets start a Rocket!!!

Hey SinineSiil, this is already at 4.18.1 :slight_smile:

Oh very nice!

Going to give this a shot again soon :slight_smile:

I’m really curious if it’s possible to implement a system where resources need to be carried to a construction site by workers to start construction, i.e. gathered resources are brought to a central location when gathered, and are retrieved from said location and brought to the construction site when required. The former is already implemented, so is it possible to extend that to the latter?

Any plans for wallbuilding?

Oh, maybe the issue is then that I have 4.18.2. I have been having the following issue since the second or third version of the plugin: Can't launch project with plugin · Issue #56 · npruehs/ue4-rts · GitHub

Interesting idea, this reminds me the Settlers game series. This is on no roadmap I’m currently aware of, but you can add it yourself if you need that. You should be able to adapt the ConstructionSiteComponent by tracking how many resources have been brought there, and don’t start construction until all resources are present (bStartImmediately = false). Let me know if you need any further assistance.

Not that I’m aware of :slight_smile: Strictly speaking, walls are just buildings with any additional components (e.g. ConstructionSite, but no ResourceDrain or Production). Building nice walls would be more on the UI side of the game, like dragging walls and queuing the build orders for all of these walls.

Do you have a C++ Unreal project there? We don’t ship the plugin libraries (yet), so you need to compile them yourself.

Hey!

Old time Unity user here who is about to make the jump to UE4, because of the current state of networking in Unity is so bad and forgotten.

This what you’ve been doing, seems like a godsend to my team. After learning the ropes and doing a couple of test projects I’ll surely take a look at this, and perhaps even contribute when I’ve become more comfortable with the tools!

Keep up the great work! :slight_smile:

A total newbie to Ue4 here, the plugin looks fantastic, so i am trying to install it. I am using Unreal 4.18.3, I download zip file from github, unzipped. Then copied the RTSPlugin folder to epic Games>Launcher>Engine>Plugins , restart Unreal Editor, EDIT>PLUGINS… i dont see any RTSPLUGIN available. not sure what the reference to the RTS.uproject files in the instructions for installing means, or where this and all the others folders should be placed. Obviously i have overlooked something ?

Realized my mistake… i was copying to wrong directory, i put in Program files (x86) but other plugins are in Program files/Epic Games/UE_4.18/Engine/Plugins…
Moved, restarted Unreal Editor now i get Plugin “RTSPlugin” failed to load because module “RTSPlugin could not be found” , then the editor stops loading.

Hey man, great work! Can you make it 4.19 compatible?

I may be missing something simple, but how do I set teams? I have the “Num Teams” set in the GameMode but do not see how I would designate teams for a CPU player (AI bot) using the plugin/blueprints. The human player starts the game with units who appear to be on the same team, they are not attacking each other. However, when I place “enemy” units in the world, they just attack each other.

Any help would be greatly appreciated!

Sorry guys, I’ve been pretty busy lately with a more-than-full-time production at work, so please apologize for answering here infrequently for the time being :slight_smile:

Hey Duisti! Thanks for the warm words :slight_smile: I’m happy this helps, and looking forward to your contributions!

Hey Trader56! This should work out of the box, without copying anything anywhere. Just open Source/RTS/RTS.uproject in Unreal. If you want to use the plugin in another project, follow the instructions at GitHub - npruehs/ue4-rts: Real-time strategy plugin and showcase for Unreal Engine 4.

The project needs to be a C++ project, and you need to have Visual Studio along with the C++ tools installed on your system.

Hey TriNityGER! Sure, this shouldn’t be much of an issue, will take a look at that soon. Also, there’s Not compatible with 4.19 · Issue #63 · npruehs/ue4-rts · GitHub for this (don’t know whether you’ve started that one?)

Hey sovkan! Thanks for following up by e-mail on this one as well. I’ve opened Assigning teams for pre-placed actors · Issue #65 · npruehs/ue4-rts · GitHub for this, you should find detailed instructions there.

Hey npruehs, I’m attempting to install your plugin on 4.20.2 but when I try to build I’m getting a build error on : UE4Editor-RTS.dll

When rebuilding through the unreal project launcher I’m getting RTS could no be compiled. Try rebuilidng from source manually.
Perhaps engine version?

The following modules are missing or built with a different engine version:
RTSPlugin

Would you like to rebuild them now?

Thanks!

Hi, you can do it simply by yourself. Download the Visual Studio Community 2017 Edition from Microsoft.
Then follow these Instructions: Setting Up Visual Studio Development Environment for C++ Projects in Unreal Engine | Unreal Engine 5.1 Documentation
After that right-click on the Open RTS Plugin project file and create the Visual studio svn files and then open it in Visual Studio and recompile it.
Hope this Helps.

Haha sorry for never getting back on you! Nope that wasn’t me^^ Maybe I can try compiling it for 4.20 and soon 4.21. May I fork the repo and provide a download for it then?

Ohh ok my mistake, thought it would be compatible. Yes a fork would be nice.:wink:

@anonymous_user_9257d68e thanks for the reply, I browsed to the RTS.uproject file, right clicked > Generate Visual Studio Project Files > Selected 4.20 Engine > Opened up the RTS.SLN (solution file) in VS2017 Community > Hit F5 to Build\Debug

Here is the output log:

1>------ Build started: Project: RTS, Configuration: Development_Editor x64 ------
1>Creating makefile for hot reloading RTSEditor (no existing makefile)
1>Compiling game modules for hot reload
1>Performing full C++ include scan (no include cache file)
1>Using Visual Studio 2017 14.15.26726 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.15.26726) and Windows 10.0.16299.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Parsing headers for RTSEditor
1> Running UnrealHeaderTool “D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\RTS.uproject” “D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Intermediate\Build\Win64\RTSEditor\Development\RTSEditor.uhtmanifest” -LogCmds=“loginit warning, logexit warning, logdatabase error” -Unattended -WarningsAsErrors -installed
1>Reflection code generated for RTSEditor in 7.1477167 seconds
1>Building 13 actions with 12 processes…
1> [1/13] PCLaunch.rc
1> [2/13] PCLaunch.rc
1> [3/13] SharedPCH.Engine.cpp
1> [4/13] Module.RTSPlugin.gen.3_of_3.cpp
1> [5/13] Module.RTSPlugin.gen.2_of_3.cpp
1>D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Plugins\RTSPlugin\Source\RTSPlugin/Classes/RTSMinimapWidget.h(90): error C2143: syntax error: missing ‘;’ before ‘*’
1>D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Plugins\RTSPlugin\Source\RTSPlugin/Classes/RTSMinimapWidget.h(90): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Plugins\RTSPlugin\Source\RTSPlugin/Classes/RTSMinimapWidget.h(90): error C2238: unexpected token(s) preceding ‘;’
1>D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Plugins\RTSPlugin\Source\RTSPlugin/Classes/RTSMinimapWidget.h(83): warning C4996: ‘UUserWidget::NativePaint’: Please override the other version of NativePaint that accepts all the parameters, not just the paint context. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
1> Runtime\UMG\Public\Blueprint/UserWidget.h(1040): note: see declaration of ‘UUserWidget::NativePaint’
1> [6/13] Module.RTSPlugin.gen.1_of_3.cpp
1> [7/13] PCH.RTS.cpp
1> [8/13] Module.RTSPlugin.cpp
1>D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Plugins\RTSPlugin\Source\RTSPlugin\Classes\RTSMinimapWidget.h(83): warning C4996: ‘UUserWidget::NativePaint’: Please override the other version of NativePaint that accepts all the parameters, not just the paint context. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
1> D:\Unreal Engine\UE_4.20\Engine\Source\Runtime\UMG\Public\Blueprint/UserWidget.h(1040): note: see declaration of ‘UUserWidget::NativePaint’
1>D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Plugins\RTSPlugin\Source\RTSPlugin\Private\RTSMinimapWidget.cpp(133): warning C4996: ‘UUserWidget::NativePaint’: Please override the other version of NativePaint that accepts all the parameters, not just the paint context. Please update your code to the new API before upgrading to the next release, otherwise your project will no longer compile.
1> D:\Unreal Engine\UE_4.20\Engine\Source\Runtime\UMG\Public\Blueprint/UserWidget.h(1040): note: see declaration of ‘UUserWidget::NativePaint’
1> [9/13] RTS.cpp
1> [10/13] UE4Editor-RTS-6951.lib
1> Creating library D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Intermediate\Build\Win64\UE4Editor\Development\RTS\UE4Editor-RTS-6951.lib and object D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Intermediate\Build\Win64\UE4Editor\Development\RTS\UE4Editor-RTS-6951.exp
1> [11/13] UE4Editor-RTS-6951.dll
1> Creating library D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Intermediate\Build\Win64\UE4Editor\Development\RTS\UE4Editor-RTS-6951.suppressed.lib and object D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Intermediate\Build\Win64\UE4Editor\Development\RTS\UE4Editor-RTS-6951.suppressed.exp
1>UnrealBuildTool : error : UBT ERROR: Failed to produce item: D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\Plugins\RTSPlugin\Binaries\Win64\UE4Editor-RTSPlugin-5923.dll
1> (see …/Programs/UnrealBuildTool/Log.txt for full exception trace)
1>Total build time: 62.93 seconds (Parallel executor: 0.00 seconds)
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.MakeFile.Targets(44,5): error MSB3075: The command ““D:\Unreal Engine\UE_4.20\Engine\Build\BatchFiles\Build.bat” RTSEditor Win64 Development “D:\UE4-RTS-Plugin\ue4-rts-develop\Source\RTS\RTS.uproject” -WaitMutex -FromMsBuild” exited with code 5. Please verify that you have sufficient rights to run this command.
1>Done building project “RTS.vcxproj” – FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========