RTS Blueprints Template

Hey man, great work again. That resource update is quite promising. If your considering additional ideas, how about a resource based Conquest | Battlefield Wiki | Fandom ‘capture point’ ticket system, something akin to dawn of war 2 and battlefield 4? As for the Community RTS, you can find them doing some great work here and their trello here

Mhousse1247’s Basic Enemy AI/squad system may also interest you as well. Additionally, happen to have a tank setup if you want to test vehicles with your 3rd person mode.

I will definitely be looking into that tank setup. I really, really wanted to get vehicle AI in here. I mean I could always just create a vehicle model and animate it, then just use a character blueprint parent class instead of vehicleCharacter.
Oh that ticket system is a neat idea. I’ll have to look more into Dawn of War. I’ve never been too huge on RTS games (oddly enough) but that looks awesome. And man, that Community RTS thing would have been awesome to look at about a month and a half ago. It’s funny, it looks like their fog of war solution is the same one I came up with. I’m still not sure how to set visibility to certain players only, though.

I spent the day working on my behavior tree and I have a pretty decent enemy AI working so far. When I say enemy AI, I really mean all of my soldier units will have the same behavior tree. All I really had to do was set up some behavior tree tasks for my AI_Worker and AI_Soldier and then just implement them conditionally based off of target/surrounding AI’s faction. Each player will have a unique faction represented by an int assigned at the beginning of the game. Everything spawned by that player will have the player’s team number. So when a player right clicks on an interactable object, a check will be run to determine if the target is within the same faction as the player. If not, hostile actions will take place.

I thought it’d take a week or so. Only took a day. I’ll be uploading a video here in the next few days after this step is finished. After that it’s onto making sure EVERYTHING is polished (and possibly adding a vehicle if I can get a good one working).

Once I’ve polished the tank a bit, you’ll be more then welcome to use it. In fact, I would implore you too. Seeing how you would go about implementing AI for an RTS tank would be deeply interesting.

The ticket system really keeps an RTS fresh and engaging, by focusing attention on mobile warfare. Capturing, holding, losing and re-capturing key objectives on the map focuses the players on maneuvering instead of just camping in your base, also known as turtling. Dawn of War 2 and Wargame: Red Dragon in particular have some excellent ticket/unit unlock/purchase systems in place that I feel are rather more rewarding and immersive then the classic ‘build base/mine gold’ system. Though in reality all your really doing is removing the base building, while still gathering gold, but the gold is infinite, and no ‘workers’ are needed to gather the resource, all you need to do is capture the gold point, and keep it out of enemy hands. I would suggest gold points for units an upgrades and victory points counting down to zero multiplied by how many victory points are either held or un-held to determine which team wins and loses.

I bet, well either way youve managed to get yourself some decent experience with UE4, more so then myself certainly and Ive been playing around with it close to 3 months now :slight_smile:

Regarding this, is it possible you could implement a realistic Line of Sight mechanic for units? Standard Fog of War is another classic RTS mechanic. More recent RTS tend to use this realistic (well, semi-realistic) LoS mechanic instead. If an Armor rating dictated how strong a unit is, then an Optics rating would dictate how far it can see and what objects it can see though. For example, most modern vehicles are generally equipped with Thermal Imaging optics. Off the top of my head, to implement this you could use some type of occlusion culling, and a cone shaped volume representing the units optics/sight radius attached to the front of the unit. Unless units are within the sight cone, they will be occluded, an thus not visible to your own units, or your RTS camera.

Again awesome stuff, I was wondering how to handle the teams, attemtping to reverse-engineer the Community RTS implementation, will be really interesting to compare the different systems once I fully understand how theirs an yours work.

Haha show off. And a little part of me just died. Anyways, good work as usual, lookin forward to the video :slight_smile:

Thanks, ! I’ll be uploading a video later tonight. I’ve worked every day since my last post so I haven’t had a chance to really do any work on this since then. Today’s been my first day off! I’ve been working on this a lot today!

And yes, I would love to figure out a way to add that tank! I am really down about not being able to add vehicles. I mean they wouldn’t function much differently from the soldiers but it’s just kinda neat to have them. I was using the Advanced Vehicle Template vehicle for a while and it was pretty cool. Just didn’t work properly at all. It would’ve required a ton of calculations that were very specific to the vehicle’s properties and that’s something that changes with the vehicle. Doesn’t leave a lot of room for customization and I really wanted this to be a template.

Anyway, I’ve got nicer buttons, gold counter + expenses from units, warning messages for some things (trying to sell your base, units under attack, insufficient funds, etc.), death animations/attack animations, health bars, timers for building and a bit more. It’s coming along nicely.

All I have left is a bit of polishing. I include Fog of War in polish. It’s a nice feature to have and I’m going to turn it on/off with a pause menu. Basically I’m going to create an interface and have every unit use the interface. It’ll have one function in it called by the pause menu to toggle on and off the “light” used for fog of war vision. The only thing I’m not sure about is how to make a light visible to one camera while not letting another camera see it. Basically, I don’t know how to make lights visible to the character in control of the unit. Structures are gonna be “built” by workers, too.
I’d also like to do something with soldier units when barracks are upgraded. I mean this is meant to be a template so something simple like activating a fire particle system on their hands or something. Something that could be quickly changed out for something better. That’s how I’ve built this entire thing. You’ll be able to remove/add small parts of the code/components to do/look/act in the way you want it to without compromising any of the basic function. And it has worked out pretty well! I’ll include a demo video that shows a bit of customization with minimal effort/time. Playing around with those Maximo characters haha.

Anyway, I’ll be posting a video in an hour or so once I’ve fixed this little animation loop that I’m trying to work out. Shouldn’t take too long.

So here is the video.

Like I mentioned above, I added quite a bit. And like always, most if it is in the code. Like the whole iceberg metaphor. But here you can see enemy AI. A simple “J” press in the level blueprint sets my worker as their target. Underneath every unit is a blue/red decal. They show up on cursor over/selection and the color is determined by whether or not said AI is on your team. You can’t select enemy units. Team is determined by 1 of 2 things. If you place the unit in the level, you can set the team, ID and starting/total health in the “Details” panel. Otherwise, when spawned by a player, that player’s team number is assigned to the unit. I have set this up so that it DOES SUPPORT multiplayer. There is no multiplayer built in, though.

The only thing left is final detail. I include fog of war in what I consider to be the polishing-steps of this process. That will be a bit tricky as I don’t currently know how to make scene assets visible to one player but not another. That’s the only problem as of right now.
I also have a few things that I’d like to add just to make it a bit nicer. Some blueprinted volumes that can be custom sizes that spawn resources every x amount of seconds, the limit being determined by top-down area of volume. I’d also like each of the structures to be “built” by a worker. Whenever structure is placed, the nearest worker runs to the building and slowly fills the health/build progress of the structure. And a few other, minor things.
SOON!

Like always, this is still 100% in blueprints. Everything you see (except the selection decal) is either shipped with UE4 or free on the marketplace (death/attack animations). Everything is built to be customized without ruining function.
Thanks!

Edit: I also forgot to mention about color coding guides. Every single set of nodes are grouped together by relation. I’ve commented everything in every one of my blueprints (there are tons). Several hundred variables and functions are all carefully grouped in color coded comment boxes with descriptions of what they do. Each comment box is color coded as a guide for anyone who uses the template:

Blue = modify, add to, remove functions and variables at no cost to underlying function
Green = add to functions and variables safely, modifying variables and functions is on a per asset basis but usually safe, removing functions or variables may cause errors
Orange = these functions and variables should only be modified, added to, or removed if you really need to change something and you know what you’re doing
Red = these functions and variables are at the core of the RTS system. If you delete something that’s red, you are why we can’t have nice stuff.

This looks great. I’ll definitely give this some proper study when it comes time to get groups of characters to behave in my own project. I like your unit movement patterns – were they difficult to implement?

Thanks man! Well at first I couldn’t imagine how I was going to create an infinite number of possible groups to fit in the formation I had in mind. But a little bit of math and it worked! And with behavior trees, sending all the data to each selected unit was very easy to put into place!

So I have the start of my fog of war system working. I have a lot of problems, still. But it’s a work in progress. Hopefully I can get it all finished quickly. I also completely forgot about minimaps. That won’t be a difficult addition so I’ll do that once I have FoW finished.
Anyway, here it is:

Really like the FoW, i’m curious to see how you’ve handled the problem :slight_smile:

Also what i wanted to ask was, are you planning on creating non-character based AI? I’ve noticed in the community project that my fps drops below 30 with ~400 units in a very basic and empty level. I’ve been looking into AI and navigation to try and see how i can create AI without using Character as a base class.

Thanks! Once it’s perfect I’ll post the process of making the FoW. Wasn’t as complex as I thought (although it might become a bit more complex when I get everything perfect).

As for the AI, it is character based. Character base class has a movement component which is very helpful for anything that requires movement based actions. I’ve had near 100 units at most with little hit to performance and I run on a low end PC. But you know, most RTS games have very low detail everything for that reason. I’m not really big on how computers work but I imagine that shaders take the most computer resource. At least for me, the more complex shader and lighting have been the only times my computer sounds like an aircraft. Like the Elemental demo. I can hear my computer howling from the street. But so far I haven’t seen any performance issues with my system. The only problem I’ve come across is within the actual engine. Lots of units moving to the same area seem to get caught up sometimes. And for some reason, geometry that doesn’t exist in my level seems to interfere with navigation. I really don’t understand this.

This looks great do you have a template for download or are you still working on this?

Thank you! And not yet. Definitely still working on it. I have a few more things to add (FoW, minimap). <— When I started writing I thought I’d have more things inside those parentheses. Guess that’s all I really have left. But the FoW is proving more complex than I thought. I’m hoping to have this finished before 2015.

Here is a short update on the FoW system. It’s just about finished.

Here is a bit more polished and completed fog of war system. I didn’t like the cut in and out in the previous version. When revealing units it would only show the parts of the unit within the FoW radius. Not only that but as of right now, with blueprints ONLY, it’s not possible to use my previous method on more than one actor at a time. Basically only one of my units could drive the FoW system previously. I also hated that “spotlight” look.
Now the “spotlight” look is far gone. Infinite actors can drive this FoW system. And most importantly, the revealed actors are entirely revealed, not partially. Overall, I like this new system much better.

Final update before minimap and then onto finishing the guide for this RTS toolkit. Most of this is a few bug fixes and the finalization of all the functions. A couple actual features were added, though.

I did add a resource spawner. It’s basically a volume the size of which is determined by the player in the details panel. It spawns resources on the ground from -10000 units to +10000 units in height every x amount of seconds, x being adjusted by the player the details panel. It also stops spawning when the max amount (also set by the player) of resources has been reached within the volume.

Also, structures cannot be placed outside of FoW. Similar to many RTS games, if you don’t have vision of a part of the map, you can’t build structures there.

Thanks!

Minimap is done! My minimap functions only require a user to input world map dimensions, minimap dimensions, and world map offset from origin. From there, my functions will calculate the necessary equations to translate minimap space to world map space! Middle school algebra sure is neat!

Anyway, that’s it! On to color coding functions and variables. After that I’ll work on getting this thing released. Very exciting time.

This is looking really great, I am looking forward to the release!

Cant wait to get my hands on this, tho Ill definitely have to modify the placement destination spawn points for infantry-type units to prioritize spawning at nearest ‘cover’ zone or something similar. Will hopefully have a few more weapon types, abilities and attack behaviors setup by the time you release this so I just hope getting your blueprints to work with my blueprints will be as easy as I imagine it is haha. Your currently working on documentation right? Hows that coming along? Oh btw, happy belated New Year :slight_smile:

Jerad: Thank you! I’m submitting it to market soon. Hopefully in the next week.

: That would not be difficult to do at all with my setup. Sounds interesting and I’d be excited to see it in action! I would really like to see a lot of awesome RTS/MOBA games out of UE4. And actually, everything involving weapon types/attacks/abilities are all stored in the animation blueprints. Here I’ve used the default anim blueprints. I made it this way so that the functionality of the actual RTS system is intact no matter what kind of units you’ve implemented. I did take into consideration certain aspects of RTS games that should be inherent. For instance, anything related to damage also has a “DamageType” node. It’s not used in the blueprints I’ve set up but I’ve created it so that anyone using it can include their own damage variant functionality.
Right now I’m working on the hardest part. Putting together a demo level. I was going to make a video but that would take so long with editing and all that. Everything in every blueprint is commented and labeled so it should be easy to read and understand. Aside from the demo level I just need to put together some documentation for the template. Once that’s done I’ll be submitting it to market. I really wanted to have this all done by now but a combination of more work hours and distractions (Dragon Age) have taken much of my time. Happy new year!

It’s looks great!
If release I will buy~

: Thank you for your support!