[SUPPORT] Advanced Turn Based Tile Toolkit

Your solution should work, but I have a simpler one that you might prefer. You can change the CheckHoveredLocation function in BP_AbilityBase so that it also checks for units before it checks for tiles. You will need to enable collision for the meshes of units first (they should not block PathTrace, RangeTrace, CoverTrace or WallTrace). This channel also needs to be one that GridManager blocks. Then in CheckHovered location, change the TraceChannel from PathTrace to the new trace channel you are using. This should work well unless you have units with meshes that extend beyond the area of the tile they are positioned on.

Hey, all. Long time reader, first time poster. Iā€™m still wrapping my head around ATBTT, but Iā€™m loving it so far. Iā€™m writing regarding the new hybrid move as referenced above.

I donā€™t seem to have the hybrid folder in my maps/experimental folder. Did it not make it into the latest release?

Just spent the last couple days reading through (most!) of the messages on this epic thread.

Keep up the great work!

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