[SUPPORT] Advanced Turn Based Tile Toolkit

Thanks for letting me know, leo. I need to be more vigilant in testing the experimental content when there is a new engine update. I’ll look into it soon and find a fix.

This same question has been asked before a bit further down in the question here. I’ll paste in my previous reply:

Sure, creature stacks in HoMM are functionally the same as single units with a special additional “CreatureCount” health variable that also affects damage. That should be simple enough to set up. Add an integer variable to your unit blueprint that tracks the number of creatures in the stack. When the unit takes damage look at the remaining health after taking damage and set the number of remaining creatures equal to ceil(CurrentHealth/IndividualCreatureHealth). When the unit attacks other units multiply its damage by CreatureCount. You shouldn’t need much more than that. Let me know in my support thread if you need any more assistance.

send an image more specific hou to add multiple crestures like heroes of might and magic

Hi ,

I know we’ve talked a little about this but I was wondering if I could get some more help / clarification on the tile connecting feature.

I am still admittedly not well versed in your toolkit, I am still wrapping my head around everything it does and how. I am more designer than programmer.

Before this new update I assumed you could not connect separate grids but I recently I discovered I could use the heightmap feature to connect multiple blueprints as long as they’re all inside the bounding box. Is this the route I should be taking? I will be needing the ability for the player to draw a random blueprint tile (from an array of like 32 pre-made blueprint tiles) with a 3x3 grid and let them connect it to the most recent tile on the board, they will also be able to pick from 2 different sides to connect it.

In the new update, what new feature did it add that helps me accomplish this?

Sorry if you felt like you answered this already,

Thanks

Hi, I’m not able to replicate this issue. Could you give me the repro steps?

Here is a starting point:

Create a duplicate of BP_Unity_Anim. Remove the HealthBar component and the functions referring to it (ModifyHealthBar and SetupHealthBar). Add a text render component to display the unit amount (a bit basic, but works for demo purposes). Enable tick and rotate the text render to face the camera on tick:

https://i.imgur.com/sXYgij5.png

Add a function to update the amount text:

https://i.imgur.com/DGufxGB.png

In this setup I’m calculating the number of units through CurrentHealth. So for instance if current health is three times max health there are three units. Add these functions to find the current amount of units and to get the amount of units based on an input health value:

https://i.imgur.com/aIs2UgG.png

https://i.imgur.com/gBonM1R.png

Create an instance editable StartingAmount integer value to be able to set the amount in the editor or on spawn. Also update the amount text in the construction script:

https://i.imgur.com/MKSwjyy.png

So far so good. Now we want to create an ability that modifies damage based on the number of units. We also want it to pass the amount of remaining units after an attack to the action system, so we can modify the number at the appropriate time.

For this example I’ve duplicated BP_Ability_MoveAttack. In ExecuteAbility I calculate damage using the unit amount and store it in a local variable. Then I feed this into The Attack queued action and TakeDamage event. Note that in the attack action I’m feeding the remaining amount of units after damage instead of the damage value I use in BP_Ability_MoveAttack:

https://i.imgur.com/dayFIAS.png

In AnimateAction I feed it into the Attack event (which I’ve changed to take an integer parameter):

https://i.imgur.com/ecDGpQX.png

and then within said action I pass it on to the action to be executed on the target unit:

https://i.imgur.com/Getv7kh.png

We follow the action to where it is animated, where we update the amount text and decide if the unit is to go through its death animation code based on the remaining number of units that we passed:

https://i.imgur.com/xZRfjT2.png

And finally there you have it:

https://i.imgur.com/gFZLOwH.gif

Hi RTE, the best way to do this is not to use multiple grid managers, but rather to extend the existing grid manager. I will show you a simple setup that will give you a starting point for what you’re describing.

First I’ve created a 3*3 tile blueprint. It has nothing except some square tile meshes and there is no code in it. The root is under the central tile.

https://i.imgur.com/GmsfrLY.png

Then in BP_GridManager I’ve created a simple setup that gets the location of the tile under the cursor when you press space bar and spawns one of these 3*3 tile actors there. The code I use to get the appropriate location outside the original grid should probably be a utility function in itself. I’ll include something like it in the next update.

After spawning it I use the new UpdateTilesInRange function to add the tiles in the area around the new actor to GridLocations and GridEdges. The next time a RunPathfinding function is run, these will now be included in the search if in range.

https://i.imgur.com/CNUeLLA.png

You would proably want to do something like this through something else, depending on your needs. An ability is what I would have gone for.

For testing I’ve added a map with a 3*3 BP_GridManager as well as a large Plane mesh for blocking the mouse trace events in GetHitTileLocationAndIndex:

https://i.imgur.com/3WA44PS.png

And there you go:

https://i.imgur.com/BlulQ5Y.gif

Note that you cannot add tiles that have negative relative X and Y coordinates to BP_GridManager. Just make sure to build your map within the constrainst of where the grid manager would expand to if you were to increase GridSizeX and GridSizeY.

hi mono

  1. new build run the experimental- split animation map
  2. climb a ladder
  3. as soon as the climb start you will get two warning in the log .

i fixed it in the turn manager in the show selection, i input an active unit in the queue action and in the follow actor function. it as some troubles with the current action- actor index 0

Ah, there it is, thanks. You can solve this by inputting an empty actor into the ShowSelection queue in the Climb event of BP_Unit_Anim_Ex:

https://i.imgur.com/rxunYQ1.png

An inelegant solution, though. I will add validity checks to the FAction getters in the next update to allow for checking variable validity within an action.

Hi ,

Great day! I intend to make a plan phase and execute phase in every turn encapsulating both individual unit of each team. For example, in a game where there are 2 opposing teams with 1 unit per team, the turn 1’s plan phase is when team A plans the unit’s movement and action then store it in a variable then team B does the same. Then the plan phase is done and the execute phase starts by implementing the stored variables for both team A and B at the same time. Then that ends the execute phase then turn 2 starts by going back to another plan phase. I would like to ask for your help on how to go about it please.

Hi, sorry did not see your message until now. Seems like Epic held it for review, as they sometimes do for first posts. Thanks a lot for the kind words! The toolkit has been in constant development, and probably won’t stop for a while more, so it is difficult to recommend some future date to start when the toolkit is “final”, as I don’t know if that is a state I will ever reach, as I always come up with new ideas for features or refactors :slight_smile:

Hey , first time posting in the thread but I’m another one of those long time lurkers and owners of the toolkit, I believe since 2015 :eek: Thanks for doing a great job with all of the updates over the years as I’ve checked back in periodically to see how things are going and I’m always impressed with the improvements!

I’ve recently been inspired and have begun working on my own project, but I wanted to see if you had at least part of a solution to what I’m trying to accomplish. So what I’m looking at doing is having an amount of points that each player is allowed to spend on various unit types that each have their own cost. This should be simple enough by adding a “cost” stat to the units and referring to it when building your team, but the tricky part is I’d like to have it where some types of units are actually groups of individual units - not just a stack of units HoMM style - and these groups would be called Troops. For example, let’s say we take the generic ranged unit from the default map and pretend he’s part of a Troop called Gun Guys that costs 50 of your allotted points: it would be a group of 3 of that same exact ranged unit, all have the same stats, abilities, etc.

The first goal here is to be able to purchase Troops in multiples; if I were to spend 150 points on Gun Guys I’d get 9 ranged units total. This may not be as difficult as I’m making it out to be, I just may have not figured it out because I’m not sure how to group the units, which leads me to the next goal.

The second goal, which is what I was looking to get help with the most, is to be able to have these Troops play in a certain manner compared to regular solo units. So in the game a player takes a turn with a unit and then the next player may take a turn with a unit and so on. What I’d like from the Troops is when it’s their turn you are allowed to take a turn with up to their base amount of units: using the example from before, I have 9 Gun Guys units on the map, and since Gun Guys is a Troop made up of 3 units, I may take a turn with up to any 3 Gun Guys units I own no matter where they are located before the turn passes to the next player.

Hopefully I explained that all well enough and didn’t drone on for too long, I just wanted to get things out as clearly as I could. I’d appreciate any help you could give me and I realize the whole points thing doesn’t necessarily align with the toolkit from it’s base features, but if anything I was most curious if the multiple unit group turn was able to be done and figured the points explanation might give some insight into my overall direction of having a scaling group of individual units. Thanks again!

Hi , thanks for your answer around my multiplayer questions. As I mentioned I focused on pass and play for my project.

In order to play test with friends, I’ve been trying to leverage Remote Desktop softwares, or screen sharing with control with programs like Zoom. That way the game is running on my computer and players are controlling the actions remotely, so it sort of simulates online play. However, there are some issues like the connection being laggy, and the fact that it requires me to host locally on my computer.

I’m wondering if you have any experience or ideas around this or other similar approaches. In other words, what is the best way you can think of for allowing people to access the game online without actually needing to make an online compatible game, since we discussed the challenges there. Also thought it may be a useful idea to mention here in case people hadn’t considered it.

wath is need to set ?
https://forums.unrealengine.com/core/image/gif;base64

​​​

2015 is when the toolkit was released, so that is about as long as would be possible :slight_smile: Glad you have the time to work on a project with ATBTT now. I’m afraid that despite your through explanation I’m still a bit confused about what you want to achieve. I don’t really understand how the troops are different from HoMM troops? Is it just related to how many actions you are allowed to use with them and how much they cost? Are you struggling with creating a UI for buying specified numbers of troops or is that not the case? Getting the cost of three units of a type is of course as simple as taking the cost variable and multiplying it by the amount of troops, so I’m guessing you’re asking something different.

The final question is a bit more clear. You have a set number of actions before your turn ends, and units with more troops in them take more actions to use their abilities. Is that correct? If so you could keep a PlayerActionPoints integer variable in the Game State, and when you would normally subtract unit CurrentAP in an ability you would instead subtract it from this value (multiplied by a NuberOfTroops variable or the like, which you can add to your “troop holder” unit). Then you would check the value of this PlayerActionPoints, and if it is 0 you would call EndActiveFactionTurn from the TurnManager. I’m probably not answering your question precisely here, as I am a bit confused, so please give me some more info now that you have heard my interpretation of it.

Hmm, I know that Steam has Steam Remote Play, which is essentially simulating couch co-op over Steam. It works out of the box for anything that supports couch co-op on steam, but I am unsure if you are able to use it through the regular Steam API that UE4 uses. Worth checking out, though.

If you want the tile markers to appear correctly on a landscape, set Heightmap in BP_GridManager to OneLevel and set UseDecals (also in BP_GridManager) to true

UOTE=GENESIS EMMANUEL;n1762345]
[USER=“455402”]GENESIS EMMANUEL[/USER]

Hi ,

Great day! I intend to make a plan phase and execute phase in every turn encapsulating both individual unit of each team. For example, in a game where there are 2 opposing teams with 1 unit per team, the turn 1’s plan phase is when team A plans the unit’s movement and action then store it in a variable then team B does the same. Then the plan phase is done and the execute phase starts by implementing the stored variables for both team A and B at the same time. Then that ends the execute phase then turn 2 starts by going back to another plan phase. I would like to ask for your help on how to go about it please.
[/QUOTE]

Hi Emmanuel, that question is a bit more difficult than the one I thought you were asking on the store page. The first part of storing target locations for abilities and then executing them automatically at a later point is a bit of a challenge, but very much doable. The second part of having all of those actions play out simultaneously is a much larger challenge. It goes against an assumption built into the toolkit, which is that actions resolve serially. That is not to say it is impossible to work around it, but you will need to be creative and put in a lot of work.

Let me give you something to get started if you still want to give it a try, though.

First I’ve created a duplicate of BP_Unit_Anim that I’ve called BP_Unit_Simultaneous. It is identical, except that it also has a variable called MoveTargetIndex, that it uses to store a grid index it has previously chosen to move to. I set the default to ‘-1’, which I will later use as an indicator of the value being “empty”.

Then I create a duplicate of BP_Ability_Move, which I’ve called BP_Ability_SimuMove. I make a few changes to it.

In EventServerInteract, after checking that a clicked tile is valid, I check if the owning unit has a value other than ‘-1’ stored in its MoveTargetIndex variable. If not I set this value to the clicked tile and end the unit’s turn (setting CurrentAP to 0 and calling SignalAbilityExecuted). If it does have a stored value, I set ClickedIndex to this value, and continue the execution chain as if this tile had just been clicked.

https://i.imgur.com/NwutpMC.png

Make sure to remove the SignalAbilityExecuted at the far right of the Click comment box so it is not called twice.

Now at PlayActivate, after RunPathfinding is called I check if there is a MoveTargetIndex stored from last turn. If not, then I activate the ability as normal. If there is one, however, I call ServerInteract with the stored variable as input, essentially simulating a click on the stored tile immediately after the ability is activated at the start of the unit’s turn:

https://i.imgur.com/yzFoANa.png

So far so good. We now have a setup where each unit chooses their move target first, and then we play both of them automatically, in sequence:

https://i.imgur.com/2JUq8cl.gif

To get them moving simultaneously we need to get a bit hacky. Ideally you would want to make some major modifications to the ActionManager to keep it clean. Here is a starting point, at least.

In the Move comment box in Event Graph of BP_Unit i set the InstantDeactivate input in both QueueAction macros to true. This means that the action manager will immediately skip to the next action as soon as this movement has started. I also Remove the EndAction call that is called at the end of the MoveTimeline, since EndAction is called automatically if InstantDeactivate is true.

What we have now looks like this:

https://i.imgur.com/LSpWw6o.gif

Almost there, but there is an issue. Since we just skip over all actions, the toolkit has no way of knowing that is should wait to start the next turn, so the next turn is starting immediately, with a new pathfinding being generated from where one of the units ends up after it has moved. Normally the TurnManager would wait for all queued actions to end before doing, so but since we’re calling EndAction immediately this does not happen.

To get around this I add a new variable to BP_Unit that is set to true while it is animating and then false when it is done. When the turn manager wants to start a new turn it continously checks if all units have animating set to false before starting the next turn. I set bAnimating to true at the start of MoveToIndex in BP_Unit and set it to false where I would normally call EndAction after a move (Bottom right in the Move Timeline comment box).

Then I add the following function to BP_TurnManager that checks if there are currently any animating units:

https://i.imgur.com/XAXyUVp.png

and I do a delayed loop on BeginNewTurn that does not start a new turn until no more units are animating:

https://i.imgur.com/CN7n8Ks.png

And finally we have simultaneous movement that looks decent:

https://i.imgur.com/bP1rIlL.gif

Ok, so that is something, at least. You would of course need to modify all other abilities in a similar fashion, designing around issues such as two players selecting the same tile etc. This is to show that while simultaneous turns are not inherently impossible, I would not recommend going that way unless you feel extremely confident in both your blueprinting abilities and your knowledge of the inner workings of this toolkit.

I’m sorry that I didn’t completely understand your question when you asked it in the store page. I hope you did not buy the toolkit under the assumption that implementing simultaneous turns would be easy, based on my reply. If so, feel free to ask Epic for a refund request on the toolkit. It is, in its present state at least, tricky to work with if you plan to make a game that is not fully turn based.

Hi ,

Using the newest version of the toolkit we got the tiles to spawn how we want them using our own meshes, but instead of using the UpdateTilesInRange function we are using a box trigger and spawn the tiles where we want them to.


Do you see any potential issues doing it this way?

https://imgur.com/a/ZlTS1Vl

Also, why do we get an infinite loop error if we try to make the grid bigger than 100x100? How would you suggest we prevent tiles from spawning outside the bounding box? We do have a finite amount of tiles to spawn in mind (36 in total) but it appears it COULD go outside the bounding box because we will have corner tiles that allow the players to extend left or right.

I might have explained it a bit poorly. UpdateTilesInRange is necessary for the setup that I’m suggesting. You see, the Grid Manager is always of size 999*999 tiles. GridSizeX and GridSizeY simply defines the area that the Grid Manager adds to the GridLocations and GridEdges arrays at startup. So you do not need to have a super high grid size, since you are doing this manually as needed (using UpdateTilesInRange).

As for placing stuff outside the bounding box, I recommend simply adding your starting tiles at the center of the grid (999 tiles divided by two, times the default tile size of 200 UU ~= X: 10 000, Y: 10 000). Then you can add tiles in any direction without crossing the boundary.

Hi ,

I was wondering how did you make the health bars for two reasons. 1. I want to make my own health bar art and 2. I want to place in these Icons that can be swap and change during the gameplay to tell the player what element type the unit is.

Secondly, how do I add animations to the pre existing animation blueprints and lastly, how to switch gamemodes so when the player is in the main menu its not ATTB but when they open and level it is ATTB.

Thanks, EagleEyeGamma.

Good day i can"t found this blue print BP_Unity_Anim can you just add a scene to the nex update with multiple creature on hexagons and add plea a return attack one time at turn the mele respond to melee and range to range. thankyou vary much.

Hi ,

I’m still confused, so should we be using the UpdateTilesInRange function with how we’re spawning them? Will that prevent the issue of ever going out of bounds?

The health bars are very basic. They are a material billboard with a material parameter that fills to a specified point (Check out the M_HealthBar material). I used a material billboard as a way to limit the amount of ticking actors, as a billboard will always face the camera without the need of a ticking event.

However, if you want to make something more fancy, setting everything up in a material becomes quite awkward, and I recommend using a widget blueprint which you rotate to face the camera on tick. Check out the EventTick of BP_Unit_Anim_VR for how to get the camera location and rotate the health bar. For this actor, a mesh is used, but a widget is probably better for your purposes.

For the animation blueprint question I’ll assume that you know how you would normally add animations to an animation blueprint in UE4 more generally. It works much the same in ATBTT, but there are some quirks because of the action system. The way BP_Unit is set up, any action that is passed to AnimateAction in BP_Unit that does not have an implementation (not found in the name switch after AnimateAction) is passed to the AnimateUnit function. In BP_Unit_Anim this function is overridden so that it further passes along the action to the animation blueprint. Then within the animation blueprint you can decide how the unit animates based on the incoming action.

To take it step by step, if you call QueueAction with ExecutingActor = a BP_Unit reference and ActionName = “Jump”, this is passed to the action manager. The action manager then goes through all queued actions until it reached this action, at which point it calls AnimateAction on the referenced BP_Unit, passing in the stored FAction struct. BP_Unit then looks at the name of the action, and as there is no “Jump” defined in the name switch it goes to its default value, calling the AnimateUnit function. In BP_Unit_Anim this causes the unit to call AnimateAbility in ABP_Unit. Another name switch checks the name of the action. Since it finds no “jump” in the switch, it goes for the default, which is an attack animation. To implement your jump animation you would add the name to the switch in ABP_Unit and then call whatever code you want to animate the unit.

Hi ser.man, I don’t think those are generic enough features that I’d want to include them in the base toolkit. I might do something like that in an example map at some point, but I have many other things on my list before I get to something like that. I can help you to implement it in your game, though. When you’re saying multiple creatures on hexagons, what exactly do you mean? Something like in Civilization, where they are really a single unit, but has multiple skeletal meshes? Or something else?

Also, could you elaborate on what you mean with responding? Are you talking about something like a counterattack? That triggers whenever the unit is attacked?

Yes, if you do not update the underlying arrays (GridLocations and GridEdges) the GridManager does not know that the new tiles exist. Adding a mesh somewhere does nothing in itself. UpdateTilesInRange looks at the collision of meshes etc. in a defined tile area and adds them to the grid arrays as appropriate.

The bounds mean that you can never go lower than 0 on the X or Y axes relative to the in-game location of the grid manager. That is not really a problem, though, as you can just place the tiles your units start on to the very center of the grid (which always has a size of 999*999 tiles). You can use UpdateTilesInRange for this as well, but subgrids are simple for predefining areas of the grid that you want to be added to the grid at startup.

So we GridSizeX and GridSizeY to 1 (maybe I should allow a size of 0 in the future), since we don’t want to add any tiles in the far northwest corner of the grid. Then we add a BP_Subgrid at X=100000 and Y = 100000 (the center of the grid). We place a unit on this subgrid. Now we can add new tiles during runtime in any direction:

https://i.imgur.com/iBqyKK0.gif

Hi ,

So, how would I add the UpdateTilesInRange function to the blueprint code below? This is in the mesh blueprint with the trigger box, so a tile always spawns in front. The clicking on a spot method doesn’t work with the way the game is designed.

Would the UpdateTilesInRange function prevent the player from being able to click outside the mesh because there are still invisible tile spaces to click on? Would need it so they can not click outside the existing mesh that is spawned. I suppose I could use invisible walls.

Also, it seems like the obstacles will block the spaces just fine as long as the meshes are always lined up exactly with the gird below.


Hi , from Youtube here.

I had a question about the tile movement costs. I had asked about the 0.5AP tile movement cost, but what I had meant to ask was - How can I make movement reduce AP per tile? I’d like to be able to move one tile at a time without ending the movement ability but I can’t find where to accomplish this. I also would like to be able to move after using certain abilities, but moving once costs my AP, and ends that part of my turn. Is this easily adjusted somewhere?