Learning Blueprints: Tactical RPG Combat

EDIT: See the last post for the endresult :slight_smile:

Hey everyone!

This semester we are learning how to work with blueprints(last semester we learned materials and general use of UE4). And our assignment is to make a working game/demo with blueprints.
The end of the semester is already close by and I still have a lot of work to do for other courses.
But I’d like to share my progress with you.

This is what I currently have working. The game checks all the characters on the field, checks their dexterity stat and then rolls to set the order of movement.
The active character’s stats are displayed right. Then the game checks the active characters speed stat and colors all the tiles that are in reach of the character.
The character can then move to a tile when clicked. Finally you click end turn to go to the next character.

I’m no programmer so some blueprints are really messy and I think one of them is causing memory leaks. I especially had trouble with sorting the array of characters and also a bit with checking the movement range on the grid.

Things that still need to happen(hopefully before the deadline) is fighting, simple AI and a menu.
I think fighting will be fairly easy as I have most functions for the grid ready. Just still need to make a check for if a tile is empy or not.

If you have any questions or suggestions, feel free to comment!
I’ll try to update this thread in the coming weeks, hope you enjoy!

1 Like

I love seeing turn based strategy games made in UE4. It’s the first thing I started making when I downloaded the engine as well. I have quite a lot of experience with this kind of stuff, so hit me up if you’re having any problems :slight_smile: I’ve made a total of five threads on pathfinding and turn based strategy since I begun working on it a year ago. In case you’re interested in reading them, to avoid making the same mistakes I did (the builds were pretty messy to and unstable to begin with), they can be found here: (1, 2, 3, 4, 5).

How are you handling pathfinding/finding possible tiles in range you can move to? Are you using algorithms like Dijkstra or A* or are you doing something else entirely? When is your deadline?

Looks like your off to a good start! Would love to see a video.

Good luck finishing your goals before the deadline :slight_smile:

Thanks for the replies!
@Monokkel, haha I’m just using the ue navmesh for now :slight_smile: A* is way too complex for me(It looks like that at least)
For the tile range I just draw that shape depending on the unit’s speed stat. I think I spend a weekend on that one. Not really perfect as it starts bugging out when the unit stands on the edge of the grid etc. I am not too worried about that. What I’d love to know though is how I let the navmesh go around the other units. If I could then update the navmesh in runtime it could work. Now the units run into each other.
@order66, maybe later, and thanks!

Yeah, I guess I probably wouldn’t have bothered with A* myself if I was on a deadline :wink: If you’re using navmesh and find yourself stuck you might consider contacting Stormrage256 on these forums. He was working on a turn based strategy system using navmesh before he switched to using my toolkit. He has a blog where he writes about developing his system among other things as well as a YouTube channel. I’ll be keeping an eye on this thread in any case. Good luck!

Oh wow this takes me back! I too learned Unreal during my studies but back then it was the Kismet system. For our semester 2 finals we had to create a level in UDK3 and this is what I came up with (I had modelled the Stargate in another class so…)

As for your project, one thing I cannot stress enough, is KISS - Keep it Stupid Simple. Your teacher will appreciate much more a complete demo with little flaws and that is fun - even if the mechanics are simple. Rather then an attempt at a complex system that feels wonky and has little content to show for. I’m not saying that your project will be wonky and flawed, but just something to keep in mind.

With that said, seeing as you seem to already be a ways into your project, here is a suggestion: Instead of going for the traditional turned based combat, create a “run away” game. Depending on the player stats, he can move x range and his turn happens more often or less often depending on his agility. Depending on this, the enemy will move before or after the player depending on their stats. If the enemy reaches the player, he loses(or takes dmg based on defense stat). The player must reach the exit on the grid and may have to unlock paths by picking up keys or such items. And the enemy may or may not chase the player depending on if they have line of sight of the player, so the player could hide behind walls to avoid enemies(The AI could do backflips in the meantime? :D). One way or the other, you will need a targeting system for the AI. Most of the movement mechanic you have already done, you would just need to add a level layout with static mesh which should automatically block pathing on the navmesh. And on level completion you could reward the player by choosing to either upgrade agility or movement range for the next level. This would be a simple mechanic using a SaveGame object. This would save you the work of having to create a combat system. You could still use the strength and defense stats. For example, the player could break certain walls or barriers down depending on his strength stat and could get hit multiple times depending on defense. If an AI manages to reach the player, the AI explodes, this would be a simple way to warrant the player having defense stat and also gets rid of that AI in one swoop. This is just an idea, but I think you would have a lot more time to focus on other projects and even adding fun elements to your demo instead of spending many hours creating more complex BP systems. I’m not trying to deter you from your current direction, but I know that in school, having many classes to attend to, it is easy to overload yourself with extensive projects and run out of time. Once you finish your studies, you will have all the time in the world to create intricate and complex games.

With all that said, if you are anything like me, this will probably only make you want to create your system even more :stuck_out_tongue: I’m heck of stubborn, but then, I often miss out on sleep also > < Can’t have it all.

As far as updating your navmesh in real time, you could check this out How To Update NavMesh's Realtime [Tutorial] - Community & Industry Discussion - Epic Developer Community Forums
Basically just make sure that in your project settings. under Navigation Mesh, under Runtime, the check box Rebuild at Runtime is set to true, and the navmesh should update during runtime.

Good luck and keep working hard!

Thanks again for your comments! Mortusnyte, thanks for the suggestion and link! I think I’ll stay with the current idea though :stuck_out_tongue:

Here is some small update. I added a character mesh with a CAT run animation I had to make in another course, I’ll also add some vegetation and props from that course later.
When you hover over an unit that’s not active they get a red outline and you see their stats in the upper left corner.
I also added better navigation with the navmesh that updates each turn so the units won’t run into each other.(Thanks Monokkel) It’s sometimes a bit buggy, but enough for now. I guess I’m trying to stall the fight mechanics.
Here are some screens:
9bd6c8d7d2575b0fcbe57e204ea61fcedae136dd.jpeg

This one shows the navmesh during play
415cd864bd2bcb6958beedf47a3198eb706df6f3.jpeg

Ok, another little update.
I managed to fix a major performance issue, but I’m actually not sure how I fixed it…
Today I implemented a basic AI that moves towards the closest unit. At the moment it all the enemies go to the same unit, probably need to reset some variables.

Here is a video as someone requested it earlier:

Also, I get an error with this blueprint, it isn’t any major I think but it would be nice if I could fix it.
I’m trying to sort the array with unit depending on their initiative roll. Sorry it isn’t commented.
The error points to the last bit where it sets J to 0 and says it’s a “none”. Not sure if that is correct. because the sorting and everything works…

THanks!

I have finished the project. Still some bugs but I’m calling it done for the moment.
Enjoy!

When the character have finished moving, they should auto rotate to look at the nearest opponents instead of looking in the direction where there is nothing to fight.

Normally they should face the direction they are moving because of the character blueprints. But this is indeed a bit buggy as you can see.
Maybe I fix it later. Thanks for commenting

Hallo FloreVanackere,

is it possible, that zou can share your project, so that others can learn from it?

@FloreVanackere Very nice man good job it is a bit buggy but hey you got something out there that works and looks pretty good for one person. GOOD JOB