Download

[SUPPORT] Advanced Turn Based Tile Toolkit

Yeah, I designed the big unit sight range with square shaped visibility in mind. If you want a different pattern you will have to change the math a bit. The easiest way is probably to start with the square visibility and then filter out the tile indexes you don’t need.

The SizeAdjustment is 0 in the current abilities, yes, but when you make abilities for big units you should input the size of the owning unit for visibility to be calculated correctly.

As I mentioned initially, big units require a lot of extra work since they impact so many other systems. In the upcoming update I have moved the functionality into an experimental map to make this clearer.

Late reply but thanks for the help, i tried looking all over for answers, alas i fear i will receive no beer :slight_smile: decided to stick to the decals for now and moved on to poking around in other parts of the toolkit.

I do have another question, I’m currently testing out animation blueprints, I am trying to get a units rotation to animate before starting movement along the spline as the sharper turns are obviously instant i even tried throwing in an interp to constant as last ditch attempt to smooth out the rotation couldn’t figure out how to do either. any insight would be great.

Thanks again the toolkits been great for a UE newcomer.

Thanks for trying :slight_smile: As mentioned, I’ve experimented with various methods and some of them have almost made the cut, but haven’t found one I’m perfectly happy with just yet. It is a problem that I always keep at the back of my mind, so one day I’ll crack it :slight_smile:

There are a couple of ways I think you could go at this. The first would be to implement a turn-in-place animation before the unit moves along the spline. This would be a general UE4 thing so you should be able to search for how to do this. However, for ATBTT you would want to make sure you do it as part of the move action (or queue it as a separate action before movement). In any case, make sure it is appropriately queued so that it animates at the appropriate time. Check out my videos on the action system if you have not done so already.

Another method that might potentially be both simpler and better, but which I would have to test out, would be to change the movement spline in BP_Unit. When the spline path is generated, normally the first spline segment would be angled in the direction of the displayed spline meshes. However, you should be able to angle the first spline tangent in the direction that the unit is facing. I believe this should let the unit begin movement in the direction it is facing and smoothly turn into its spline path. There might be some unforseen jankyness at certain path angles and lengths, but that would have to be tested. I might test it myself one of these days when I have the time.

The turn in place animation is what i was after, as you said queuing it properly before movement i think is the part im not grasping yet, ill go through the tutorials again see if im missing the glaringly obvious. Thanks.

The general idea is just to make sure you animate the turning within an action, so that it happens when it is suppose to. It should be fine to do it as part of the move action that already exists in BP_Unit. Before running the normal movement code there tell the unit to turn in place. You will hold off the rest of the movement until that animation is completed. You can signal this using an event dispatcher.

I’ve just sent a new version of ATBTT to Epic. This version is a major refactor and the largest update this toolkit has ever had. I’ve put a lot of work into this one and hope it will make it a lot easier for people to modify ATBTT to their needs. With an update of this magnitude there is bound to be a few bugs, so be prepared for a hotfix or two the coming weeks. If you run into any issues, please let me know. I have just made public a video showcasing the major new features of the update. Take a look:

https://youtube.com/watch?v=9sUJ2RB8hTU

New features (see my Trello for a more complete list):

v3.0 (sent to Epic)

  • Refactored action system. Actions are now separate actors. This makes it a lot easier to keep track of actions and enables the manipulation of actions in many new ways.
  • Split units into BP_Unit, for data and game logic and various Puppet actors. Makes the game logic/action distinction less muddied and makes it simpler to for instance use Character actors for units.
  • Moved all UI code from abilities into separate BP_GridUI actors.
  • Moved pathfinding functions into modular BP_Pathfinding objects.
  • Widget-based screen space health bars
  • Hex grid can be generated in a hexagonal shape
  • Mouse look for Grid Camera
  • Simplified splitting movement and interrupting actions
  • General cleanup and refactoring of most blueprints included in the toolkit

Hi again Monokkel. Thank you for your help on my last issue a while back. I also love the new update since everything definitely looks a lot cleaner and easy to use. For now, I have a question about pathfinding using the newest version.

My question is, is it possible to make the tile costs come from the unit rather than from the tile itself? For example, I would want one unit to be able to traverse water tiles freely while another unit would have a movement penalty on the same terrain. My original idea was to have a struct of integers representing the cost of each kind of terrain within the unit BP and an enum for the terrain type of each tile (forest, water, etc.) in the tile BP. Then I would be selecting the cost based on the tile’s enum from the values in the unit’s struct within the pathfinding BP. This approach ended up not working though, and I’m not sure if I was just missing something silly.

I am curious to see how you would implement this kind of pathfinding, as I am a bit stuck.

Hi Munchydo, I thought this question might be of enough interest to other developers that I went ahead and made a video about it. Hopefully this should get you close to what you had in mind:

https://youtube.com/watch?v=8JEzy1Z80xU

Wow!! Thank you so much for such an in depth answer. This is exactly what I was looking for. The video also gave me a bit more understanding for how the pathfinding works, which will definitely help me in the future.

We all greatly appreciate the work you put into this project on a daily basis. Thank you for this amazing toolkit!

Glad you found it helpful and thanks for the kind words :slight_smile:

Hi Monokkel,

I hope you are well. Completly new UE user here with a bit of a question regarding pathfinding in the new version of ATBTT. Reading through the forum I came across a postfrom back in 2018 in which another user mentioned using a movement planning phase. I know that was a long time ago and that the blueprint has undergone major modifications since then but I was wondering if you could please help me with any insight as to how you would implement that solution using V3.0. I would greatly appreciate it as this is a fuctionality I am trying to create myself based on the BP_Path but with little success so far.

That said I wish you a very happy holiday season and end of year.
Thanks in advance.

Hi, things are a bit busy right around Christmas, but I’ll try to get back to you on this as soon as I’m able. Could you be a bit more specific in what you are after, though? Are you talking just about selecting multiple points to create a movement path for a single unit (as shown in the gif of the linked post) or are you talking about something more involved, like planning out the movement of all your units beforehand and then having all of them move at once (including or not including the ability to define custom move paths)?

No problem Monokkel, I understand Christmas is a busy time of year so please take your time I´m in no rush :slight_smile:

As to your question though, what I´d like to do is just as you described: be able to select multiple points in order to have more control of the route that unit will take when it moves.

I hope this helps understand what I´m trying to achieve. Thanks for all the help and congratulations on this amazing toolkit. As a newcomer to unreal I am having great fun learning my way around the engine with the ATBTT. :slight_smile:

Ok, I’ve managed to put something together now. Sorry for the long wait, but it is Christmas this was a bit of work. This is my first pass. Can definitely be done cleaner, but this should get the job done.

All of the custom code is done in a new ability. I created a duplicate of the simple BP_Ability_Move ability to keep things simple, but the same general approach should work for all movement abilities.

I modify this duplicate ability in four places. PlayerActivate, ServerInteract, ServerHover and the CheckIfValidTarget function. I’ve made quite a few changes so screenshotting all of it would be tedious and difficult to read, so here is a pastebin of the three relevant events, and a small one for the CheckIfValidTargetfunction. I won’t describe every last node here, but look through it in combination with my description to see if it makes sense. Let me know if you need clarifications. Note that pastebins like the ones linked can be copy/pasted directly into your event graphs in engine. Much of what is there is default stuff in BP_Ability_Move and only some is custom. You will have to create a few new public variables (the compiler warnings will tell you which).

Ok, so what am I doing here. Almost everything interesting is done in ServerInteract, so let me describe it first. The way I want this to work is that the player can right click to set path points and left click to move. So I keep track of the key that has been pressed. If the player clicks the active unit I want to reset the path, which I do by calling PlayerActivate.

If the player right clicks I check that the index can be reached and if so I store the GridIndexes of the path leading to the end point as well as the end point itself. I then run a new pathfinding from that point, subtracting the move cost of the path leading up to it. I make sure to clear and display tile markers as appropriate.

When the player left clicks I do the same as above, but also pay the move cost and execute movement. One thing I did not include in the pastebin is the ExecuteAbility function, since it is super simple. Here:

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

Ok, so that is ServerInteract. Quite a few nodes, but the general idea is simple. CheckIfValidTarget only has a minor modification compared to the default Move ability. Namely that I return valid if the move cost is 0, which is handled by our custom OwningUnit clicking code instead.

ServerHover is pretty straightforward. I generate two arrays of locations. One for the StoredPath from ServerInteract and another for the one from the end of the stored path to where we are hovering. I append them and display the path.

Lastly, in PlayerActivate I make sure to clear our new public variables so they are not carried over between turns (the same ability is shared by all units).

And there you go:

https://thumbs.gfycat.com/DeadlyMessyBarnacle-size_restricted.gif

That should hopefully be a good starting point. There are some quirks to this approach that you might want to tweak. For instance you can run in circles over your own path if you want to, but what you want to do here is as much a question of game design as it is coding:

https://thumbs.gfycat.com/BadDapperBobcat-size_restricted.gif

Hope that helped!

Hi again Monokkel,

Thanks so much for the in depth explaination and attached pastebins. I´ve been able to implement the solution and it´s working without any errors. I truely appreciate all the help and support especially over Christmas holidays. Take care and have a great end of year. :smiley:

Hey everybody, and specifically Monokkel. I’m wondering if someone could point me in the right direction to find information for how to implement the cover and overwatch systems

Thanks and happy to hear that! Good luck on your game.

You need to add the cover component to the GridManager for the cover system to be activated. BP_GridManager_Advanced has it added by default (as well as the stealth component, which are the only ways it differs from the base GridManager).

To have the cover system affect the game you’ll have to make use of it in your abilities, though. I’d take a look at BP_Ability_Laser and do a blueprint search for the places where it references the cover system component. That should hopefully give you an idea of how to make use of it.

As for overwatch, all you need is to add the overwatch ability to your units and it should work.

Hi guys , i already discussed the topic with @Monokkel on his discord channel but he asked me to repost it in the thread .so here it is =)…

My goal is to make the movement controlled over a chat command system . so i need to generate a grid in range of 1 or 2 around the actor that diplays a subgrid showing a standard “abc-123” grid .
and if a chat command says for example A5 the actor moves to this location .
it doesnt need to be a a set of fresh tiles to be generated . just something like the existing highlighting grid in range but with a coodinate system that never changes visually for the player .and doesnt change position but rotation on camera rotation .

something like that :

](filedata/fetch?id=1848028&d=1609439344)

. then i want Twitch-chat or something like it to vote on the tile to move to from within the blue ones
and then i want to create a new move range around the moved to location and repeat the process…

in this case 1A would be 1003 . so if a chat vote says 1A the actor moves to 1003.

thanks in advance and hopefully this was clear enough .

sry for my bad english

Thanks for reposting the question here. Explaining it will take a bit of time and require several screenshots, so the forum is better suited than Discord. I have managed to achieve something like the effect you are after. Some parts are more hardcoded than I would like and you would need to add better checks for valid input etc., but it should be a good starting point.

So there are a few parts to this. First we need to display the chess board style tile names. First, here is the function for displaying the tile names in a set range:

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

You can see that I have hardcoded the integer to letter conversion here. Might be a cleaner way to do this in blueprints, but it is functional. The ClearChatText function at the start simply loops over and deletes the text objects in the ChatTextObjects array, then clears the array.

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

Next I added some code in the Player Controller for receiving input from the chat and converting it to an appropriate tile index. The tile index here will not be absolute, but relative to the source index. This function needs to receive input in the [letter,number] format. I have not added checks to ensure this, so this needs to be done.

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

The SelectTileFromChatInput function is defined in the Grid Manager and looks as follows:

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

The GetLetterAlphabetIndex being another hardcoded function, looking like so:

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

The Player Controller passes along the index into the current active ability using a new custom interface. The interface contains a single function (The ReceiveDamageInput function you see above).

I’ve created a new ability, a duplicate of BP_Ability_Move. I add my new interface to this class. When activated I spawn the input indicators on the tiles:

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

Note that you should probably rather do this as an action so that it is appropriately queued, but this explanation is long enough as it is, so I’m keeping it simple here.

I implement the ReceiveChatInput interface function like so:

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

If you don’t understand why I’m multiplying by 1000 here, see my tutorial video on grid indexing.

Other than that the ability is the same of BP_Ability_Move, except a small hack I added. I set the action points of the active unit to 0 as part of ServerInteract. This is just so that the turn automatically ends after the unit has used the ability. This might not how you want it to be, but it works for demonstration purpose so that you don’t have to click EndTurn after each input.

Lastly we need some way to enter the input. I’m not adding any Twitch integration for this example, so I’m using a simple editable textbox widget, which should serve well enough as a stand in. Here I’ve just thrown it haphazardly onto WBP_ATBTT:

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

It implements the following event:

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

Ok, I think that should be all of it. Hope I didn’t miss anything. Some of it is a bit hacky, there might be unforseen bugs and whatnot, but this should be a good enough starting point, I think. Let me know if you get it working. Here is a gif of it in action:

https://thumbs.gfycat.com/QuestionableFaithfulAfricanelephant-size_restricted.gif

Hope this is close to what you were after :slight_smile:

Hey there! I purchased this toolkit awhile back and have had tons of fun playing with it and manipulating it in various ways. Thanks so much for your work!

As of right now, I have your toolkit imported into my 3rd person game. The way your toolkit works by default, I have to load a new level for combat to begin. I would like to be able to walk around the map in 3rd person and trigger combat without loading a new level. Basically, player walks into a trigger box, the grid spawns and the player snaps to their nearest grid tile, and combat begins. I would like it to be as seamless as possible, if possible.

Do you have any tips on how to implement this? Thanks again for any help you can provide!