Download

[SUPPORT] Advanced Turn Based Tile Toolkit

Hey Monokkel - I’ve been lurking for a very very long time. I purchased the toolkit back in July of 2017. I wanted to say that you have been extremely Epic in your support to everyone, so thank you. I find myself waiting to jump in as you keep improving on the content of this asset. I should probably take this “extra” time and actually start. In any case…you have a great product and even better support. Thanks again.

hi mono

in the new build i get a warning if i try to run the experimental- split animation map.

when you climb on a ladder get get this warning - Attempted to access index 0 from array ‘Actors_48_C65EEEEA4722265004E44098B2A1335D’ of length 0 in ‘/Game/AdvancedTurnBasedTileToolkit/Core/FAction.FAction’

leo

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 Monokkel,

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:

Add a function to update the amount text:

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:

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:

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:

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

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

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:


And finally there you have it:

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.

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.

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:

And there you go:

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:

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 Monokkel,

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 Monokkel,

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 Monokkel, 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 Knut, 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 Monokkel,

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.

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:

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:

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:

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:

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

And finally we have simultaneous movement that looks decent:

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 Monokkel,

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?

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 Monokkel,

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 Monokkel,

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?