RTS Blueprints Template

Hello, UE4 community!
I’m pretty new to any sort of game development. In fact I started using my first game engine, UE4, for the first time just over three weeks ago. But thanks to the awesome tutorials provided by Epic I’ve learned a decent amount in a short time.
So I thought it would be neat to create an RTS template made entirely from Blueprints since I haven’t seen it done yet. In fact, I haven’t been able to find anything on working RTS gameplay.
I started about a week ago, working from a third-person template. Right now I have some basic functionality. Select structures (the cube you’ll see in the video below), select units and tell units where to go, some simple buttons that appear upon switching to RTS mode.
In the next two weeks I’ll be working on creating soldier units that spawn as a group, creating enemy states to determine what AI units cannot be selected, vehicles based on the AI_Template I’ve created, and a basic resource system. After that I would like to have some very basic attack commands built into the AI. By the end of tomorrow evening I’ll have menus set up for at least the structures that will handle spawning the units just like what you’d see in C&C or AoE or something along those lines.
I do not plan on adding many custom meshes or animations as I want this to feel like a template. I want anyone who uses this to load it up and have a template in which they may plug all of their own assets and be ready to start customizing. So even when it’s done, it’s gonna look pretty basic for that reason alone.
The only bug I have, and it’s not so much a bug as something I don’t like, is the structure spawn. Right now, when you spawn a structure its world location is set to 0,0,z. By tomorrow evening it’ll follow the mouse upon spawn and then a simple click will set it down permanently and enable collision.

Here is a quick video:

So I guess the main reason that I post here is that I’d like a bit of feedback. Is this something that anyone is interested in seeing once completed? And if so, what could be done better? What could be added to this template to help anyone using this to have a good start to an RTS? What other features would be desired/required if I’ve missed any?


Update 11/19/2014: So I have had a good few hours to work on this since yesterday. Everything that I had hoped to complete by tonight is finished! Mostly subtle changes but definitely necessary and end up making the whole thing look a lot nicer when compared to the last video. A list of these minor changes include:

-Actual spawning and placement of structure units
-Translucent material to denote placement mode
-Red “error” material to denote collision and prevent placement
-Rotation of structure in placement mode (forgot to put in video)
-Structure-handled AI spawning
-“Menu”/widget switch upon structure selection
-CTRL+Click to add to/remove from selection for AI
-Sell function for all selected units (simple destroy actor for now)

It’s very minor but it’s what I said I’d have at this point. So here it is! Here is just a quick video:


Nice work !
The initial work looks great.
Just some food for thought: do you think it is possible to implement a whole RTS game in Blueprints?
When the number of units go up and you are doing A* pathing on all of them, doing collision and physics etc, running BTs on all the units, don’t you think it would be wise to bring in C++ at some point?

Thanks Frederic!

I’m not really sure at this point. I’m still new to UE4 and the process of creating games in general. But from what I’ve seen on the capability of Blueprints I think it would be possible to create an entire game. I do realize that C++ scripting can speed up a lot of the progress but Blueprints are much easier to learn if you’re new. I would love to learn more about C++ function within UE4 since I do have a decent amount of experience with C++. Unfortunately I haven’t been able to find a basic starter guide to C++ in Unreal. That’s why I defaulted to using Blueprints.
But for those who have 0 experience with C++, I think a Blueprints template for any imaginable game type would be nice to start with. And for those who are familiar and comfortable with C++, much of the Blueprint functionality can translate to C++.

If you should still need one: https://www.youtube.com/playlist?list=PLZlv_N0_O1gb5xvsc7VM7pfoRAKLuIcFi

Thank you for the suggestion! I did go through all of Epic’s Youtube tutorials. Most of them were very helpful but the C++ tutorials were difficult to follow. For me I felt like most of the C++ tutorial was copy/paste without enough explanation. And that’s with a familiarity with C++. I think, personally, I could figure out a lot of it like I did with Blueprints if I even knew where to start. Until I can find a good “UE4 C++ Beginners’ Guide” or something that would just point me to a good starting point within the source code documentation I am going to stick mainly to Blueprints.
That being said, I would love to release both a Blueprint and C++ RTS template.

Hey ,

Looking good for just a few days of work, keep it going!
I was wondering, could you make your project available before releasing it (on github or smth)? That way people (like me) can watch and learn as you go along, it’s easier to dive into a small project and learn as it grows. And it might give me ideas for this project if you don’t mind anyone using it :slight_smile:

Anyway, good luck!

Absolutely! Once I have the basics to be what I consider “polished” I will release the entire thing. I also plan on making a detailed tutorial to explain exactly everything I did, step-by-step. Also, if you watched the video, you can see I’ve labeled everything within blueprint to be as descriptive as possible without overdoing it. I hate looking at example code/blueprint that have no comment text.

I think it’s great that you’re contributing content to the open community. Thanks!

That being said, Unreal Engine is by default a very poor match for a real-time strategy game that will have lots of units.
The reason is that the Unreal simulation engine is not deterministic, so each separate unit has to be separately replicated to all other players.
Meanwhile, the mechanism that is typically used for real-time strategy games is to send only the user input commands to all other players, and use a deterministic simulation engine to make sure that everyone sees the same thing.
That way, you can have a thousand units per player, and still keep the network bandwidth needs small.

Very interesting. Again, I’m a newcomer to this whole thing and that’s why networking or anything related didn’t cross my mind. I would still like to see this to the point of being finished but I will keep that in mind. Well, as much of what I understood in mind haha. I don’t know how that all works.
Even though I know the nature of the RTS is competitive multiplayer, the reason I started working on this was an idea I had for a minion based game, hence being able to switch from 3rd person to an RTS type game. It just kinda developed into a “Hey, I haven’t seen this done yet. Maybe someone out there other than me would be interested” type deal.

Wow ! You threw a bucket of cold water on my wargame dreams in UE4! I plan to develop a game with 1000s of soldier units in UE4.

Could you elaborate a bit on the deterministic simulation engine with reference to network replication?

An elaboration would be nice for me, too! It’d be nice to know if it’s impossible or just difficult.

Just a little update.

After I posted my last video, I decided to re-“write” 100% of my code. I originally designed it in such a way that each AI/structure handled all of its own selection, movement, widgets, spawning, and just about everything else pertaining to the actor. If I was going to expand my ideas, I needed to completely undo all of that. I needed everything to be handled in either the player controller or the player character. So now everything is handled by the player, not by the selected actor. It makes everything a lot more expandable and customizable.
Everything is still 100% Blueprints and 100% from content packaged with UE4.
So with that, there are several additions and improvements. Many of which are within blueprints, kind of behind the scenes. Here are a few apparent updates:

-Barracks template
-Soldier template
-AI and structure ID’s to make each actor unique in the game world
-Special soldier selection to select/deselect all soldiers in one group
-AI movement handled by behavior tree rather than simple MoveTo
-Soldier unit formation for moving in predictable patterns
-Increased MoveTo acceptance radii for workers based on number of soldier groups

Current problems all have to do with navigation. I’m having trouble figuring out how to make my AI stop getting caught on little corners or, even worse, other AI. That’s really the only problem I’m running into, as you can see a couple times in the video.
It doesn’t seem like much on paper. I suppose that’s because what you can see has changed is very little compared to what all has changed.
I decided that vehicle AI will come at the end if at all. Right now Epic has no support for vehicle AI and I wanted to keep this a simple template. I might just keep the vehicle AI out of it for now.
Within the next 4 days I will for sure have resources started and finished. Just a simple resource actor node that spawns in random areas on the map. The resource node can be collected by workers to supply the player with currency that will be used to spawn structures and AI. Hopefully I’ll have started the enemy AI system within the next 4 days, too. But once that’s done it will be finished!


Nice work -Impressive use of blueprints!

, thank you!

Just in case it’s useful to anyone, here is how I arranged placement to allow for an infinite number of groups of AI_Soldier and put them into formation accordingly. These functions are called for each soldier selected when commands (MoveTo) are given.

Each soldier is in a group of 4. For every command I have available the amount of groups selected, a group number assigned (for example, first group selected is Group 1, second is Group 2), and soldier’s placement in group. I calculate each soldier’s placement in that group (1-4) and use that to determine what quadrant it should go to (front right, front left, back right, back left).

The target placement is calculated by getting mouse location and adding some offsets determined by group number and amount of groups.

Offsets are determined by whether group amount is odd or even and by group number. For example, Group 1’s placement will always either be center and front if odd number of groups selected or front right if even number of groups selected.
If you wanted to change this around, you could write several different formations in this way and have some kind of mouse-drag input to switch between formations.

Looks really cool! Would love to take a look into those Blueprint files and mess around if you are willing to share :).

Currently looking though/reverse engineering the Community RTS Project, but would love to see your approach to an RTS and project files/blueprints. Great work so far mate.

looks great, would pay good money to have an rts template in marketplace that had all of you’ve shown with timed building, gather able resources and multiplayer support.

  • Thanks man! Do you have a link to that? I’d be interested in checking that out, as well. Whenever I get done with this I’m gonna post a very thorough (very, very thorough) tutorial that will start with the basics and work through everything to get this working. It’s a great learning tool for understanding behavior trees, blueprint interfaces, and blueprints in general. I have learned so much just by working on this project.

BlackRock & Crumbaker - Thank you! I am definitely going to be releasing the whole thing when I’m finished (I’m almost there!) on the Marketplace. But if too few people want to see it there then I will just release it on an Epic-approved sharing site. Whether it is put on the marketplace or github/sharing site, I am documenting EVERYTHING as I go and I will be making a detailed tutorial that covers absolutely every single blueprint feature there is. Literally every node in my blueprints is gonna be in the tutorial. To address the multiplayer comment, I will not be working on multiplayer as of right now just because I’m not sure how networking in UE4 works. I mean yes, the template will have the capability of adding multiplayer, but there will not be any kind of networking built in. Along with my enemy AI work I will be adding team assignments for the AI to differentiate between hostile and friendly units. So any amount of players can be added via networking and it will work just fine with this template. But I will not have networking built in. If that makes any sense. I will be able to explain in more detail when I have videos/screens of my team assignment functions.

And for anyone who is interested… I’m just about done with resources. Currently I have collectable resources with health bars that can be collected by workers only. All I have left is a “Gather” mode for the workers. I want them to cycle through all resources within a given radius and start collecting them one by one, moving to a new resource when finished the current. They should only stop moving when all of the resources within a given radius are collected. I want to have that done by tonight or tomorrow night. Once that’s done all I have left is enemy AI/team assignments. It’s exciting!

So this is a quick update just to show the resource function. So upon hovering the mouse on a resource node, the node’s highlight and health bar appear. Right clicking on a node will send all Worker AI to the node for collection. A random amount of damage is done per Worker to the resource every 0.5 - 1.5 seconds. Every 33% of health taken from the resource gives back gold with the complete harvest giving the most. Each Worker has “Collection Mode” now. This is enabled by the “Collection Mode” widget. When Collection Mode is enabled, the worker will move to the nearest resource node and harvest until that node is gone and then move to the next node to start collecting. The Worker will do this until he either has a new command or there are no nodes within 5000 units.

I have noticed a few things that have either been fixed since the recording of this video or are unable to be fixed right now due to certain UE4 features’ functionality at this time:

#1 - There is a little bit of bugginess with the health upon its first visibility and I think that’s in part due to the fact that 3D Widgets are experimental right now.

#2 - I noticed at the end of the video that by taking one Worker AI off of the resource node it set the health bar and outline visibility to false. That was fixed with a simple check to see if other units were working on the resource node.

#3 - I haven’t added any currency counter to the HUD yet. The way it works is every 5 seconds the player gets a random amount of currency from 5-10. Totally overlooked that but it’s so simple I’ll just save that for when I tidy everything up at the very end. That’s also when I’ll add in costs for spawning units.

So all that’s left is team assignment/enemy AI. Shouldn’t be too difficult. I hope to have that done in a week or less. If anyone has any suggestions about certain features that can be done differently/better please let me know. Also, if anyone has suggestions as to what needs to be added/features you’d like to see, please PLEASE let me know. I don’t want to miss anything!


Edit: I apologize for the framerate. My computer is old. Really old. I had a lot of stuff going on in the background for this recording and my computer didn’t like that.