[SUPPORT] Advanced Turn Based Tile Toolkit

Yeah, it is very important to think carefully about the amount of randomess in a turn based game. I think in Sword of the Stars: The Pit the randomness is too high and the game can be frustrating. The Banner Saga or Invisible, Inc. are great turn based games without randomness and the player can learn from his mistakes.

I think your approach is very good and i am looking forward to see more of your Advanced Turn Based Tile Toolkit.

Hey there!
You asked me next time I had a problem/issue to bring it up here so thats what im doing :slight_smile:
I have duplicated out a hex cost tile and want to change it abit so when the player steps on it, there can be an interaction (A HUD widget appears asking if he wants to interact with the tile)
How would I go about that?
I have been looking around the toolkit blueprint but havent found a e.g ā€œPlayer on tileā€ relevant event/function
Thank you!

@Wizard1200: Good to hear we seem to have similar views on this :slight_smile:

@: Generally you can check if there is a unit on a specific tile by checking the appropriate tile index in the pawn array. However there is no built in way for the toolkit to know exactly when a unit steps on a specific tile. You would need to check this manually, but there is a variety of ways to automate it. The simplest way is probably to enable collision on the pawnsā€™ static meshes and above the custom tile (not on the PathTrace or RangeTrace channels) and fire your custom functionality from within the tile on overlap.

Okay thanks I just wasnt sure if there was a built in way or not!
I am also interested in Imoninā€™s question regarding an end turn button switching teams.
This is what i have set up so far, what else do i need? as iv tested and it doesnt work


Note, the completed loop section hooks into the switch on enum faction but that was just trial and error

@: It looks mostly correct, but if youā€™re after the same thing Imonin wanted you want the while loop to fire when the current pawn has faction player, not enemy.

I have just bought your tool kit. Iā€™m not sure how to create a new project with it as the ā€œadd to projectā€ button does not allow me to. When I add it to a project, two projects apear. When I create a new project and then add the tool kit to it, I am not able to drop the grid manager into it (The red circle with the line through it apears). When I right click the grid manager it says ā€œfailed to load assets.ā€. I can not drag the hex one in either. When I try to go to ā€œeditā€ on the hex manager it says ā€œBlueprint could not be loaded because it derives from an invalid class. Check to make sure the parent class for this blueprint hasnā€™t been removed!ā€. If I for some reason try to duplicate the hex manager, unreal engine crashes. I can not drag in any pawns either.

I am new to the unreal engine forums and only did a quick search around for anyone who is experiencing problems like these so iā€™m sorry if itā€™s a commonly solved issue but, I have no idea whatā€™s going on or what to do about it. Iā€™m using ureal engine 4.8.0. I have a feeling this isnā€™t a specific problem with the tool kit. Iā€™ve seen your guide to updating to 4.8 (not even sure if thatā€™s still relevent) but as iā€™m unable to even edit the grid manager, iā€™m unable to do any of that.

/Edit:

Nevermind. After searching around some more I found out that it was because I didnā€™t update 4.8 to 4.8.3. After doing that the problems were solved.

I do have a question now however. Iā€™m currently trying to add pawns that can heal. To do this I want to add friedly fire. This is to have the healing pawns do negative damage as well as to have players need to watch out for any allies while using AoE attacks. I have a feeling you mentioned it somewhere in one of your videos (all of which iā€™ve watched) but, I donā€™t remember which and when. Iā€™ve rewatched them but havenā€™t seen it.

Next would be creating a menu for actions much like final fantasy tactics. Just setting the menu up with a single attack should be enough for me to figure out how to add other attacks and things like deffending but, Iā€™m not sure how to go about starting that. Upon watching your ā€œadding new featuresā€ video, iā€™m sure I can set up each attack; Getting a menu that allows for different attacks to be used is where iā€™m confused. My thought is to create a variable called ā€œActionsā€, Give each button a number (ex. clicking ā€œDeffendā€ on the menu makes ā€œActionsā€ equal 3) and depending on the number, have an If branching statement link something like what you created in the video. It should then be: Menu pops up on playerā€™s turn -> Player clicks ā€œnormal attackā€ -> normal attack makes ā€œattacksā€ variable equal 1 -> When ā€œattacksā€ variable equals 1, and itā€™s the default attack from there. Would this actually make any sense? Iā€™d try it out before asking but iā€™m unsure of how to even do the menu to try it. Do you know any links to tutorials showing how to set up menus that can do this? And lastly (Sorry for all the questions), How would I get said menu to recognize which pawn is active even when iā€™m switching through ones that have yet to act?

I do want to say that this tool kit is awsome and iā€™m planing to do major projects, proffesionally, with it eventually.
Iā€™m still fairly new to unreal but, I learn quickly so iā€™ll probably figure most of the menu out by trial and error after awhile; So if the menu stuff turns out to be really basic feel free to ignore that. Friendly fire seems to be the harder partā€¦

In the video about area of effect explosion gun, you can learn more about affecting anything with AoEs.
https://www.youtube.com/watch?v=CeQMIp44904

I also agree that randomness in games (not just in TBS-games) can be good if they are designed properly, but they can just as easily be bad if they are designed badly.

I recently worked on expanding the toolkit to include randomness and it wasnā€™t that hard to do. Granted it may not have been the pretties stuff youā€™ve seen, but it wasnā€™t that hard to set up something that handles randomness

I want to make an errata to what I said about this (after playing a bit more of Long War). On medium ship maps, some of the outer walls was rotated 45 degrees compared to that of the grid. The grid itself however is not rotated.

I apologize again for taking a while to reply. As mentioned Iā€™m checking the thread and my e-mails somewhat less often while on vacation as Iā€™ve filled up most days with activities. Iā€™ll be living on a boat for some days next week and Iā€™m uncertain if I will be able to check the thread at all during that time, but feel free to post questions and Iā€™ll try to answer them as soon as Iā€™m able.

Great that you managed to solve the problem yourself :slight_smile: I hope it didnā€™t take too long to figure out.

Cooleyo has linked to the correct video in his comment above (thanks!). In it I cover how to make area attacks with friendly fire. Iā€™m uncertain if youā€™ll be able to simply input negative damage in the receive damage event in Unit_Parent to heal, but it should be trivial to modify the code to accept this if itā€™s not the case. Even if it works you will probably want to add an if-statement that prevents unit from being healed beyond max health.

I think your solution sounds pretty reasonable, but it might be able to make it even simpler depending on what youā€™re after. Creating a switch that runs a different piece of code each time Attack Victim is called in Unit_Parent is useful if you want to input your custom attack and run all the code that usually leads up to a custom attack (like the unit moving to the victim before attacking). If so Iā€™d use a switch like you suggest, but Iā€™d use an Enum instead of an integer, so you can more easily distinguish between the different attacks by looking at your code. If however you want to add effects that can trigger instantaneously when you click whatever action button you have added you can simply have clicking the button trigger a piece of code directly, without going through a switch. This depends on what youā€™re after. I must admit that menus and buttons is one of those things I know very little of, as I havenā€™t used them in UE4 yet (Iā€™m pretty specialized when it comes to my skills at the moment). Iā€™m positive itā€™s very simple to set up, though, but I cannot check from where I am at the moment. I imagine you can look at any tutorial for UMG and you will learn how you can run a specific blueprint event or function by clicking on a button you have added. Then youā€™d simply need to change your enum variable and/or run your attack code.

No need to apologize. Thereā€™s a lot of stuff to figure out once youā€™re starting out and Iā€™m happy to help. Currently the current pawn is whichever pawn is currently selected, which means that if youā€™re switching between active pawns there is no way to figure out what is the ā€œrealā€ current pawn (since there is no such concept in the toolkit). If you have a situation where a different pawn is selected, but another pawn is actually the real current pawn youā€™ll have to add that yourself. I would add a new variable of type Unit_Parent in ATBTT_GameMode (called real current pawn or something else) and set this up when the current pawn is set up/switched in the game mode, but not switch it in ATBTT_PlayerController when you switch between units by clicking on them (the part in the bottom right of the blueprint graph if I remember correctly) if this is what youā€™re trying to achieve.

Thanks! Iā€™m looking forward to seeing what youā€™ll make. Feel free to ask me anything youā€™re unsure about in this thread, and Iā€™ll try to answer as soon as Iā€™m able (which will be quicker once Iā€™m back from vacation at the end of this month).

Yeah, randomness shouldnā€™t be hard to do. Itā€™s mostly just if-statements tied up to a random number in range which is again based on the value of some stat. Glad to hear you found it simple.

Ok, thanks for letting me know. That makes a lot more sense for me, as I thought it was odd for Firaxis to add such a fundamental change to the underlying grid system just to achieve a minor change on some maps. Rotated walls should be simple enough to do with the toolkit.

Hello , I have successfully added another character and replaced his animations. However I ran into a roadblock trying to create entirely new animations. I already added the new animation to the state machine and a transition, but I donā€™t know how you call your transitions. I see that events are called to change it, but I havenā€™t found where they are called from nor where to add a new one. If you point me in the right direction I think I can figure out the rest.

Hi Torint,

the transitions are run when a specific boolean is set to true. For all animations except for movement these booleans are set by custom events within the various unitā€™s event graphs (Unit_Player_Melee etc.). Transitions back are done when that boolean is false. This is done by animation notifies at the end of the animations that fire a custom event in the event graph of the animation blueprint that sets the boolean to false. For movement the animation is set in the top part of the animation blueprintā€™s event graph, where it modifies a blend space based on the speed value of the owner unitā€™s current speed float.

I hope thatā€™s enough info to help you out!

Hey !

I looked through all the threads and couldnā€™t find anything that related to my issue, so I hope this is not a repost, but I think I found a few bugs. Either that or I am definitely not selecting an option correctly?

Issue #1: When creating a custom grid (dropping tiles on a grid then hiding the default tiles), If I hover over the bottom portion under the tiles in the game play window it is setting the hover marker to the default tile grid 0 index, as shown here;

Issue #2: I am attempting to setup drag and drop units instead of click to move, when grabbing the unit and setting its location to the current mouse location it ends up ā€˜snappingā€™ to the default tile index 0. (I have selected ā€˜Ignore Snap to Custom Gridā€™ on the Unit Parent and the child itself just to be sure.)

Hi, . You have indeed found an unresolved bug there. I usually test on much larger maps, in which case this bug will not be visible. This is happening because Iā€™m using a large, invisible collision plane to detect collision (including hovering and clicking) on the tiles. Iā€™m doing this because individual collisions for every tile is inefficient. This is unproblematic on square maps, but for hexagonal maps there will be small, empty triangular sections along all edges that are overlapped by the collision plane.

When the toolkit looks for tiles on these locations it finds nothing and returns false, which in turn causes it to return index 0 for the bottom of the map, or the index on the other side of the map and one row up/down for the left and right side. To fix this the best way would be to modifythe Get Hit Tile LLocation and Index function in BP_Grid_Manager and add a branch that checks if it returns an out of bounds value.

I canā€™t tell you exactly what you want to add as the input to this branch, as I cannot test it myself until Iā€™m home in a couple of weeks. Iā€™ll make sure to add it to the next update, though. Thanks for letting me know!

As for your other problem I cannot know exactly what is going wrong without knowing how you have implemented drag and drop. It seems likely that something similar is happening here to the first issue, and that the Get Hitā€¦ function is returning 0. Grid snapping does not affect gameplay, only when working in the editor, so that shouldnā€™t matter. Tell me more of your drag and drop implementation and Iā€™ll hopefully be able to provide more help.

It was definitely the collision plane issue. Just fixed it by creating a grid larger than the viewing area for the default grid so that the collision plane would exceed the bounds of the window and never default to 0 index. The same held true for the drag and drop functionality. Once I changed the grid to be 20x20 instead of 9x5 and updated the index of where to place the pawns all was well. I should also mention that I set the camera to never move, I doubt this would have been an issue if I had camera follow on lol.

For a custom grid with all kinds of possible weird shapes I can understand the difficulty of setting the collision plane to a specific bounds, but it would definitely be nice :slight_smile:

I appreciate the assistance!

Glad that sorted it out! After the next update you should be able to shrink the grid appropriately again. Until then it should be sufficient to extend the grid one tile in every direction. It might even be enough to only extend the grid only south and east by one tile.

Hey , I have a doubt regarding the performance and ease of usability between decals and instanced static meshes for tiles. In the latest live stream, Epic mentioned that decal support is coming to mobiles in UE v4.9. Usability wise, I think decals are easier to work with. But Iā€™d like to get your opinions as well since youā€™ve worked a lot on decals yourself. As for performance, arenā€™t instanced static meshes generally far less expensive compared to decals if there are like a few hundred of them in the scene?

Hi . Iā€™ve only really tested the performance impact of the two methods for desktop, in which case both ISMs and decals had little impact even for units with extremely high movement ranges. I still suspect ISMs should be slightly better, but for desktop it doesnā€™t really matter. For mobile I would also expect ISMs to be slightly better. However the default ISMs use transparent materials, which is not ideal for mobile. I canā€™t test it now, since Iā€™m still on vacation, so I suggest you run a simple test using decals and ISMs with and without transparent materials and see if there is a difference in fps.

Hi,
I am making multiplayer game with more than two players, where everyone have only one pawn(hero). I saw in the blueprints the way that youā€™ve managed to set the order of the pawns but i want this only with the players and in specific order, that is set by default?
Can you give me some ideas or tips? Thanks in advance.

@Mariyan:
With the way ATBTT_GameMode and ATBTT_Player_Controller are currently setup for a Single Player experience using Initiative order and Faction switching, you would be much better off creating and using your own Game Mode and Player Controller for this type of implementation. Otherwise you will need to heavily modify what currently provides.

I would highly suggest going through his Blueprint Tutorial videos so you can get a better understanding of how each one is handled and what features are included with the asset. :slight_smile:

Uhm this is kind of wierd and it might be a 4.8 incompatibility but the starting point of a unit seems to be constantly locked to the first tile, so the camera always jumps there and shows a pawn teleporting to the first tile, then moving across it and teleporting to whereever you clicked ._.

Ive had the toolkit for a long time and i know it used to work before, is it just 4.8 messing with the blueprints?

Kind of what described, except i changed absolutly nothing and it happens in the example map.