[SUPPORT] Advanced Turn Based Tile Toolkit

Hey leo! If all goes well then yes. On my internal build inclusive nativization of the toolkit seems to mostly work. A remaining hurdle is that native blueprints do not seem to allow custom trace channels defined in the config files, which makes some of the toolkit features less flexible. Hope I can find some workaround for this. The performance improvement is quite good, though.

Good evening, Matt. From what you’re describing I think you can avoid having to change the structure of the GridUnits TMap. In the case where you’re just seeing one unit (but the other unit is still there, hidden), perhaps you can add the hidden unit to an array in the visible unit and store it in this way. For the platoon you could do something similar. Perhaps have a platoon type unit, which also holds an array of unit references. When adding or removing a unit from the platoon you could call a function to add or remove that unit’s stats from the platoon’s stats.

hi

this is great news!! this and the Convert expensive functions to cpp that you are working on will make a Significant addition to this allready awesome toolkit.I am impressed :slight_smile:

cheers

leo

Beautiful, just what I was thinking. thank you in a lot of ways, its great that you devote your busy time to answering questions and helping us out.
I will give that a shot.
Thank you once again .

Glad you’re excited :slight_smile: This is something I’ve wanted to get working for a long time, so I’m happy that I finally cracked it. This is something I’ve worked on sporadically, but Unreal Engine specific issues have held me back. The last UE4 update finally seemed to fix the most serious problems and after some testing I only needed to make one minor change to get inclusive nativization to work.

If you want to fix it yourself before the next update, all you have to do is to change the SpawnTiles event in BP_Ability_EnemyDisplay (going from memory on the names here) so that the array of vectors input is not passed by reference. That is enough for packaging to work, but note that there might still be many issues with the packaged project (custom trace channels not working being one of them).

Happy to help! Note that you will need to run a custom pathfinding type in the ability you’re using for movement to allow units to enter the tiles of other (friendly) units. Find the SearchAndAddAdjacentTilesCustom1 function in BP_GridManager and see where it is implemented. In this function you can see the chain of branches that potential movement tiles are funneled through to see if they should be added to the reachable tiles. At the end you can see that tiles are not added if they contain a unit. Make the following change to fix this:


After this you must modify the move ability you are using for your units so that they use this pathfinding type and when clicking a friendly unit the unit should move to the tile of that unit and execute your custom code. Take a look at EventServerInteract in BP_Ability_MoveAttack for an example of how to handle different outcomes depending on whether a clicked tile is occupied or not.

Thanks ,
It works once a unit moves through the other unit (Over its tile index) but not until then, still working on how to make it so that on start up you can stack the units on top of each other.
Next question, I am trying to find the auto posses units so I can turn that off on start up as when you start the game you start with the units and have to move them, I’m trying to achieve being able to select the units and the the choice of either being able to move them, place them on guard or what ever, which is not hard to do I think.
can I use mouse right select to unselect units?

Hey @ - Just a heads up - In the BP_Vive the Motion Controller (L) Trigger node and the motion Controller (R) Trigger node have been deprecated and are throwing warnings as of 4.24. You may want to fix this :slight_smile:

Hey ,
Recently, the Elemental attack system works however when something dies the player can still attack the spot where they were and then it seems to halt the game whenever the player attacks them again or its that enemies turn again. Any help is vastly appreciated.

Many Thanks, EagleEyeGamma.

If you are using the custom pathfinding the unit tiles should be added as possible target tiles for movement. However, if you are otherwise using the default BP_Ability_MoveAttack (or sprint/move) you will see that the ServerInteract event in these abilities lead to several checks to determine the outcome based on what is currently on the target tile. You need to replace what currently results from detecting an allied unit (which is “default click”, leading to switching to that unit) to moving to the tile and stacking the units with a custom implementation.

The units are not really possessed in the standard UE4 sense, as the grid camera is what is possessed. If you want to not have any units selected at the start of the game, try using the BP_ATBTT_Strategy game mode. In this mode when no unit is selected the BP_AbilityBase_Idle is activated (which is not tied to a specific unit).

After you’ve done this I’ve modified BP_Ability_MoveAttack to something you can use as a starting point. Make a duplicate of the ability and replace everything in the Click comment box in the EventGraph with these nodes. This checks if the player right clicks the unit owning the ability and activates the idle ability (deactivating the move ability) if this is the case. It also sends clicking a friendly unit to ExecuteAbility instead of switching to that unit.

Then replace the code in ExecuteAbility with these nodes, that will move the unit to the space of the friendly unit if appropriate. You would need to add your custom stacking code here.

Hope this gives you a decent starting point.

Thanks for telling me :slight_smile: I already noticed while working on the nativization issues, so I’ve already replaced this in my internal build.

I’m guessing you might be damaging the unit only through queued actions, but not through TakeDamage? If so the unit might seem dead (as they are animated as such), but they are still alive according to the game logic. That the game halts seems to suggest that you’ve queued some action where EndAction is never called. Could this be the case? Take a look at the damaging abilities such as BP_Ability_Attack and note how damage is dealt. Are you missing something like that in your ability?

Hey man, this system is incredible and I am super happy with my purchase. I have a quick question before I go in to develop my turn system. I am designing a pvp board game/RTS hybrid which will have multiple phases during each playing round. The phases of play will be as follows:

Collect: get resources from resource nodes each player controls on the board.
Recruit: Pay resources to summon/spawn units from buildings.
Move: Each player will first select where they want to move each unit, then each unit moves simultaneously after the “move” turn is over. This way the opponent doesn’t know where each player will move until everybody as already committed to their movement, making each move turn exciting and unpredictable.
Action: Now each player attacks/defends/uses abilities based on initiative. Just like you already have it set up.
Build: Final phase where workers can build structures and upgrade buildings.

After that it resets back to the Collect phase and the round begins. Any advice on how best to set this up would be majorly helpful and will save me a lot of time! Thank you so much

Love it,
It is perfect thank you Monkkel, I will leave you alone for a while now and get to work.

I’m trying to use the procedurally generated grid but it seems imprecise and there’s usually a bit of visible blue tile overlap on the edges of things, because my map is not square. What’s the best way to manually place invisible tiles so that I can set tiles up very precisely?

Hello Taken, glad you like the toolkit! In the Real Time Strategy mode you will obviously not have that much use for much of the toolkit and you should set this up in whatever way you see best. The one thing you’ll probably want to use is the GridLocations in the grid manager, to keep the end points of movement and placement of buildings on the grid.

For transitioning from real time to turn based I recommend taking a look at my hybrid third person/TBS map in Maps/Experimental/Hybrid. You could do something similar to what I’m doing for the player unit, only for all units.

Best of luck!

Hmm, hard to know what is going on here. As long as your grid manager is at 0,0,0 and you generate your map based on a grid the size of the tiles it should work. Can you post a screenshot?

Here is how the damage is being calculated in the ability.

Hey, terribly sorry. It seems I missed your message in the midst of all the holiday festivities. I see something here that might be the cause. You are calling TakeDamage before your QueueAction if I’m reading your graph correctly. If TakeDamage leads to a unit being killed, that unit is removed from GridUnits. When you then later try to access that unit from GridUnits as input to your QueueAction, the Find node will return zero. When the ability then later tries to access this unit to animate it taking damage it finds no animation blueprint, leading to an action call without any EndAction.

So try switching the order for which you call TakeDamage and your QueueAction and see if it helps. Apologies again for my slow response.

No problem, however i did this and apparently it’s still happening here is some screenshots to show what is happening.

In the first screenshot you are still calling TakeDamage before your queued action

Sorry to ask but could you show me where would be a good place to place the take damage I looked at the Execute Ability of the Attack Move and it was in the same place as I had in my own copy, then moved it in the location where i thought you were talking.

Thanks, EagleEyeGamma.

In BP_Ability_MoveAttack, the Attack QueueAction is called before TakeDamage, as you can see here:


Just to make sure you follow the logic: When you run TakeDamage on a Unit, if this causes the unit to be killed, it is removed from GridUnits and initiative. If you then try to access GridUnits’ at that unit’s index at a later point it will return an empty reference. This is generally a good thing, as it means that unit will not be added as a potential target after it is dead. So if you want to access the unit through GridUnits you need to make sure it is actually there. If not you need to store a separate reference to the unit by getting it at an earlier point or through another method.

Hey there, is it possible with this asset to generate at runtime? So if I have something that randomly generates the tiles in different orders at runtime (or players create their own map using tiles at runtime), the toolkit can update the tiles and movement for it?

Yes, this can be done without much difficulty. The grid is set up when the SetupGridManager event in BP_GridManager is called from BP_ATBTT_State, which normally happens in the first frame after launching.

You can remove this event call and call it at a later time after you have generated your custom map. Note that you will also want to similarly postpone calling BeginTurnBasedCombat from BP_TurnManager to prevent the game proper from starting (as activated units etc. will assume a grid is present and will throw warnings)