[SUPPORT] Advanced Turn Based Tile Toolkit

This should not be terribly difficult. You could do this by defining some rules in your movement ability, increasing or decreasing the action points of your unit as appropriate depending on the tile you are moving to. You could store tiles previously moved to in a Set or Array temporarily in the ability blueprint and use this for your action point rules.

“Hovering” over tiles on mobile is handled through double taps. One tap to show the mouse hover stuff and another tap on the same tile counts as a mouse click. You can see this demonstrated in this video.

Thanks for the reply.

I just bought the toolkit and I couldn’t find an option I thought existed. Do you have the ability to connect multiple BP grids and have the playable characters move from one BP grid to another? My board game will have separate tiles that get randomly drawn and connect to the existing grid(s) and I need the players to be able to move from one grid to the next.

4.24.2 update? When?

Hey!
Great work as always, just checking out the newest edition of the build. Two questions
Now that the main index array for the grid is a Map, how would you go about calling a random tile? Something that sounds simple but anything iv tried is a flawed system that includes indexes with no tile so the unit spawns fail.

And two, really intrigued by the new turn managers but is there any info as to how/why they’re different?

Thanks!

The toolkit does not support multiple Grid Managers. However, the single grid manager can handle multiple, separated grids. Essentially you can get the same effect as having multiple grid managers by just having separate walkable areas within the bounds of the grid manager (which extends 1000 tiles in the X and Y axes).

So to add new tile pieces to the grid as you describe, you can add their locations to the grid manager in GridLocations and connect them to other tiles through GridEdges. If you see my answer to BorrowedLadder above, you can see how you can update the entire grid. However, this is overkill if you just want to add a few tiles at a time. For large grids this could also cause lost frames.

What you can do, however, is to add each new tile to the grid manager separately, by doing the same sorts of operations that are done to the entire grid in SetupGridArrays at startup in BP_GridManager. This is not entirely straightforward, though. Mainly because of how the edges between tiles work. Each tile stores what tiles can be moved to from that tile, but not what tiles can move into the tile. This means that you will need to update both the added and the surrounding tiles in the right way. The approach here also varies a bit depending on whether you are using heightmaps, hex grids, multilevel grids etc.

I am currently working on a function that does most of this work for you. I want to make this a general and flexible function that I can include in the next update, so it is taking some time to get it right. I hope I have the time to finish it tomorrow, and if so I can share it with you here. It believe it should be well suited for the sort of use case you are describing.

I generally send out a new update when a new full version of Unreal Engine is out. Are there any features that I’m currently working on that you need?

Hey Luke! You can get a random grid index like so:

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

For the turn manager, the default one orders units in initiative based on their faction. This is quite similar to how it is handled in XCOM. TurnManager_Initiative functions more like the old default, ordering units based on their initiative attribute, similar to D&D. TurnManager_Strategy is similar to the default one, but with no units selected at the start of the game and no unit automatically selected after the previous one has ended its turn. This is similar to for example Fire Emblem.

Thanks dude! Hope all is well on your side, really glad your still working on this

[quote=“, post:3176, topic:21930”]

*The toolkit does not support multiple Grid Managers. However, the single grid manager can handle multiple, separated grids. Essentially you can get the same effect as having multiple grid managers by just having separate walkable areas within the bounds of the grid manager (which extends 1000 tiles in the X and Y axes).

So to add new tile pieces to the grid as you describe, you can add their locations to the grid manager in GridLocations and connect them to other tiles through GridEdges. If you see my answer to BorrowedLadder above, you can see how you can update the entire grid. However, this is overkill if you just want to add a few tiles at a time. For large grids this could also cause lost frames.

What you can do, however, is to add each new tile to the grid manager separately, by doing the same sorts of operations that are done to the entire grid in SetupGridArrays at startup in BP_GridManager. This is not entirely straightforward, though. Mainly because of how the edges between tiles work. Each tile stores what tiles can be moved to from that tile, but not what tiles can move into the tile. This means that you will need to update both the added and the surrounding tiles in the right way. The approach here also varies a bit depending on whether you are using heightmaps, hex grids, multilevel grids etc.

I am currently working on a function that does most of this work for you. I want to make this a general and flexible function that I can include in the next update, so it is taking some time to get it right. I hope I have the time to finish it tomorrow, and if so I can share it with you here. It believe it should be well suited for the sort of use case you are describing.*

Ok, thank you for the detailed response. The implementation of our tiles should be fairly straightforward, there will be 3x3 rectangle tiles that when drawn in game, will connect to each other as the player’s progress. There won’t be varying heights, or multiple levels, they will be straight and corner tiles only, the corners will be mostly using meshes to block one way forcing the players the other way. They connect like this: https://images-na.ssl-images-amazon…AC_SL1500_.jpg

As I am just starting the project and you are currently working on finishing this function, I’m fine waiting on your update.

Thanks :slight_smile: I’ve got a few other projects now that I’m working on in parallel, but I always come back to ATBTT. I feel it is more or less feature complete at this point, but there is always more stuff that can be added in the form of utility functions, gameplay examples etc.

Ok, thanks for the explanation. This should indeed be a good fit for the new function. I finished it today. It will be included in the next update (which I’ll likely release along with UE4.25), but you can have it now.

Here is the main function (pastebin link)

https://i.imgur.com/4Xgrll6.png

First nested function (pastebin):

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

Second nested function (pastebin)

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

The UpdateTilesInRange function works by getting grid indexes in range of a source index and adding them to GridLocations and GridEdges in much the same way as happens for the entire grid during startup. As mentioned, the edges entering into a tile is generally stored in the adjacent tiles, so you need this function to cover a tile area of one tile more in each direction than the GridIndexes you are adding to the grid.

If you have not done so already I recommend seeing this video to understand how the toolkit indexes tiles. Let me know if you run into any difficulties.

Hello, could you point to location where decals are drawn and how you detect when and where to draw it? Thanks!

I’m not sure if this is a known issue, and if not where I should report bugs, but I was getting a friend into using ATBTT and when going to show him the initial example map (unmodified) there are many problems and bugs now. Sometimes units run to the wrong tiles, sometimes shows the path marker for AI and will stay while the enemy is moving, etc. This issues occur randomly and not every run. Are these known issues?

The calls to draw decals are done from the current active ability in the SpawnTileMarkers function. Static meshes in UE4 can be set to receive decals in their settings under Rendering -> bReceivesDecals.

Hey Asheron, sorry to hear that. This is the right place to report bugs. These issues are news to me. Could you give me some more info? Are you using the latest version of ATBTT and latest version of UE4? Are you using a Windows computer? Could you tell me the precise steps to replicate the issues you are having so I can test it myself? Also, if anyone else following this thread are having the same issues, please let me know.

Hey , it’s with the latest UE, ATBTT, and on windows. The problem is completely intermittent and so quite hard to debug as it seems quite rare only happening off and on. I just created a fresh project to show him, and the second character I moved ran to a random tile. It happened again a few games later where a character randomly moved to an enemy tile and was on the same tile. Twice it has shown the path line draw for the enemy and it stays there until it has moved. I saw the behavior while showing him and he found a few on his own (without modifications)… I don’t see any of this behavior in my actual game project though. If I can find a repro case I’ll jump in and debug it and/or post here.

My project partner and I have attempted to add these blueprints in and are having issues getting it to compile. Would you happen to have a more accurate time on when you will be pushing the update with these new features?

What sort of compile errors are you getting? Perhaps you just need to add some new local variables? I’m planning to release the next update whenever Epic decide to release their next major engine update.

Hello could you please show me how to set a online match i followed the steps on page 135 and i can get both players to join a match but player 2 acts like a spectator and can not control any character. I am running this on 2 separate PC’s both with different steam ID’s i have set two of the enemy characters default owning player as 1 and i have two player characters have their default owning player set as 0. Thanks for your help

The error is with the “convert grid index to grid location” function.

I’ll have to rule out some possibilities here. Does it work during Play in Editor? If you set Number of Players to 2 and the default owning player of a unit to 1, does it work correctly?

Oh, sorry. Forgot that was also a new function. Here you go (pastebin):

I managed to get it working by setting one the characters to Faction 3 and the default owning player as 1 and then left the other one as player faction and owning player as 0. I than added some more factions and tested them they all seem to be working fine. Does this mean i am not to use the enemy faction for multiplayer ? thanks again for you help :slight_smile:

Hmm, that is odd. Faction should not affect unit ownership. If you get the same problems in multiplayer and Play-In-Editor, could you give me the exact steps I need to replicate the problem so I can check it out myself?

I got it all going it was a simple mistake on my end i did not check all the attributes correctly. I have a couple of questions the first one is does it matter if i place a casual component around the units ? (I’m using it for a projectile system) the other question is how would i implement a pick up system?say an item on the ground can i make a new actor and have an overlap event for when it picks up the item ? thanks again for you help:)