[SUPPORT] Advanced Turn Based Tile Toolkit

Hey ! If you’ve read through most of the messages I think you can safely call yourself a long time reader! We’re just one page away from 200 at this point :slight_smile:

Make sure that you have the most recent version installed. The hybrid map can be found in Maps/Experimental/Hybrid.

Learned quite a bit reading, I must say!

Okay, I haven’t updated to 4.23 yet, so it was downloading an older version, I think. I grabbed the 4.23 engine version and it has the hybrid folder.

Thanks!

Thanks for this amazing tool, , it’s been fun looking through your blueprints the last few days. I’m mostly interested in just using the hex grid system and pathfinding, not so much the turn-based aspect. Is there a way to have the AI-controlled units all take their turns at the same time (or with minimal delay between turn starts) rather than waiting for each enemy to move to it’s position one-by-one? I’m also wondering if there’s a simple way to have AI-controlled units pathfind towards a goal rather than only to their nearest enemy unit (pathfinding towards a flag or zone for example).

Basically I’m hoping to have a hex grid with one AI faction marching towards an end-zone, and another AI faction trying to stop them. I realize this isn’t the purpose of your pack but it’s the closest marketplace asset I can find. Thank you for any insight you can give me!

As long as you’re aware that some of the older suggestions in this thread might not be ideal in the newer versions there is hopefully a lot to learn in this thread. Glad you found the hybrid folder. Hope it helps you add the feature you want.

Hey , good to hear you’re having fun with the toolkit. As you’ve guessed the kit isn’t really geared towards the sort of game you’re describing, but you can hopefully make use of some of the features nonetheless. You would of course throw away the turn system and probably scrap the ability system for your own implementation.

The general grid logic would of course still be using (storing and accessing data on the grid). Stuff like pathfinding and visibility gets more tricky, though. The included blueprint implementations for this are not performant enough that I would recommend using them if you are to use them multiple times a second for multiple units at the same time.

For a real time game I’d recommend rewriting the RunPathfinding, GetIndexesInRange and FindTilesInRange functions in C++, as you would likely need the performance boost for your game. You can leverage a trick to improve performance if all your AI units are heading towards the same goal, though. In that case you can run pathfinding in reverse, with the start index at the target. You run the pathfinding to a large enough distance that it reaches all the units heading towards the same target, and they all use the same pathfinding graph to navigate towards it. You can then rerun the pathfinding periodically (perhaps as often as the shortest time it takes a unit to move from one tile to an adjacent one). If your game as multiple targets this becomes less and less viable, though.

In the default toolkit it is simple enough to make it so the AI has targets other than enemy units. You would search for these custom targets in a similar way that units are searched for, perhaps using the GridObjects TMap instead of GridUnits (though this can be used as well if you targets cannot be occupied by a unit). However, as mentioned I don’t believe the ability system is a good choice if you have multiple units acting at the same time

Hope my answer made sense. The summary is that you can use some of the features, but be prepared to tear a lot of stuff out and rebuilding a lot from scratch.

Yeah, I was confused at first because of the older documentation videos, but I’m starting to wrap my head around your system. I just started learning UE4 about six weeks ago, so just hearing you explain things from the older version helped out some. I was more just curious about the hybrid feature. I think I’m gonna go the route with an overland map that pops open smaller battle levels kinda like Forged of Blood.

I’m a LitRPG author working on ways to tie books into games.

This is about how far I got with your toolkit so far…

This is my first UE4 project that’s just about done. While waiting on beta tester feedback, I’m thinking about my next project which will be turn-based likely.

Thanks again.

I haven’t checked in for some time and I’m curious if there’s been a fix for the bug where killing a unit with overwatch never ends the turn.

Hey, long time no see! This has indeed been fixed. A couple of updates ago I added a new way to insert new actions into the ongoing action queue, which was a good fit for the overwatch ability. The ability is currently residing in the Experiemental folder, though it should be ready for primetime.

Hi ,

I just started with ue4 and im still going through your tutorials. A lot of questions came to my mind but right now I´d like to ask something general.

In general I´m wondering if it would be possible to trigger the turn based aspect only when we have spotted an enemy or if an enemy has spotted us - would that be complicated?

On the other hand I thought about MouseOverEvents - how can I tell the engine that something should happen when I hover my mouse over a hostile pawn? (I currently have no idea how to match the mouse location with the pawn I am for example aiming at)

Another idea was an inventory for the pawns and one inventory for the map. For the pawn inventory I´d have to store which pawn holds which items, right? And for the map inventory I´d have to store which items are dropped by slain pawn on the specific grid location, right? Futhermore I would use functions like Add Object and Remove Object from the Grid Manager to get it working, wouldn´t I?

Looking forwad to your reply.

Hi ,

I was wonder what manager in the toolkit handled the attack selection. To be more clear, after you move when it highlights red to attack a target i was wondering what handled that as i need it to identify this elemental weakness I’ve implemented into my project, so when it finds a unit it’ll know what unit type it is as tagged through an enum.

Thanks, EagleEyeGamma.

Not that complicated, no. Take a look at the “Hybrid” example map in Experimental. In this map the game switches between turn based top-down and real-time third person when the player enters a trigger or ends a combat. Instead of using a box trigger you can implement whatever code you want for an enemy spotting the player.

You can use abilities for this. Make sure to look through my ability system tutorials to understand this better. In all abilities there is a Server Hover event, which includes a reference to the tile being hovered over. Within this event you can check the GridUnits TMap in BP_GridManager for enemy units and run whatever code you want if this returns true.

There are many ways to do this, sure. For individual items you could create an inventory array in BP_Unit (or whatever derived blueprint you are using as a base for your own units), or create an inventory component similar to the ability system one. Or you could store it all in a data table. Depends on the requirements of your game, really. For storing stuff on the map you can take a look at the HydrasLair example map, where I do just this (using Add/RemoveObject as you suggest).

Looking forwad to your reply.
[/QUOTE]

This is done within the abilities. Check out BP_Ability at the PlayerActivate event to see how the ability searches for nearby units and display them. When the ability loops through these units and place markers you could add a check that looks up their elemental weakness enum and places a custom marker based on the value. You would probably want to do this by overriding some of the PlayerActivate code in a derived ability blueprint.

Going to start looking into pathfinding performance next week. Need it faster for very long movement like 18-24 tiles and also perhaps moving multiple units at once.

Going to look into nativization first and was wondering if there are any known issues with it?

After that i will look at a full remake in C++ then if thats still not fast enough a completely new method for pathfinding.

Have you run into performance issues or are you anticipating future issues? 18-24 tiles should be well within what the toolkit has been designed for. If you have encountered performance problems make sure you are testing in a packaged project. Blueprints run significantly faster in a packaged project compared to playing in editor.

If you do need a performance boost, blueprint nativization does not play well with the toolkit’s pathfinding. This is due to Engine issues with blueprint structs and TMaps. The best approach is generally to manually convert what you need to C++ in any case. The good news is that I’ve already done this for many of the toolkit’s expensive functions. So when you need it let me know and I’ll format the code and share it.

Hello! I just downloaded and am having a little trouble getting the friendly character to traverse heights (walking up a flight of stairs). I’ve been watching the tutorials and they said to set “auto calculate costs based on height” to true, but that option isn’t available for me. Any help on this would be nice, and thank you!

Hey , I upgraded to 4.23, and I was wondering if you could help me out. I noticed the movement is now based on AP, which I LOVE. But, I would like to change it so the amount of spaces the unit moves costs 1 AP per tile. So if a unit has 3 AP, then the unit can only move 3 tiles. Do you know how I can achieve this easily? Thanks!

Hey Zennisin, can’t recall changing anything like that from 4.22 to 4.23, but this has been an option for a while. I guess I must have changed the defaults of one or more abilities while testing. If you set MoveCostType of BP_Ability_Move to FromPathfindingCost, the AP cost of the ability will be based on the pathfinding cost of the tile you move to. If you give a unit a move of 1 and AP of 3 you’ll then achieve the results you want.

Edit: Support thread page 200!

Woohoo! Page 200!

I have another question for you. I am trying to do some testing on my Android device, specifically the galaxy s7, and I am trying to double tap to move my characters, but they are not moving. Am I missing something to make it run on mobile?

I have abilities for my units if that matters.

Also, it seems to have some controller movement sticks on each side of the screen. Any idea on how to remove those?

The game thread was starting to stall quite a lot at 18+ tiles i thought even in a packaged build it would still be noticeable but i will check and let you know, maybe its fine. I have added in extra checks to stop things like diagonal movement through 2 other units so perhaps thats making it worse. Moving multiple units at once is more of a future thing i am expecting problems with.

Would love to see your C++ versions of expensive functions, i would certainly be using them to save where ever i can. Think i will still want to keep a BP only project and add the C++ functions in via a plugin though im not sure how sensible that is.

Sorry for so many questions! But I’m using the experimental grid manager, for the interrupt feature, and I have units on both the Player faction, and the Enemy Faction. They all have the same initiative. But, when its each of their turns, I can’t seem to switch between the characters so I can play them in a different order. Am I missing something? Thanks!

Edit: Clicking the icon in the initiative bar gives me this error:

Blueprint Runtime Error: “Accessed None trying to read property Unit”. Blueprint: WBP_Initiative_Icon Function: Execute Ubergraph WBP Initiative Icon Graph: EventGraph Node: Branch

Probably my bad. Mobile controls is not something I test every update, so I might have made some change that has disrupted touch input as a side effect. In that case thanks for making me aware of it. I will try to look into it soon.

Here is a guide on how to remove the touch joysticks. This should be how the toolkit is by default, but I guess it must have been reset somehow.

Hmm, odd. Not able to replicate this. What game mode are you using? How have you set up the level more generally?

Hmm, odd. I’m not seeing any stalling on much higher move ranges, even for regular PIE. I have a pretty powerful rig, but even with much weaker hardware I would not expect any visible frame drops for 18 tile movement. Not to worry, though. For anyone experiencing such issues I intend to share the C++ converted functions fairly soon. But if you’re not planning to release your game within the next few weeks I hope you can have a bit of patience so I can do more testing, optimizing and commenting.

I think it has to do with the ability system? I gave both of my units the Move ability, and the Attack ability separately. Once I gave them both the singular MoveAttack ability they were able to swap between each other again. Any idea how I can fix this for if I want to split it back to 2 abilities instead of just the 1?