[SUPPORT] Advanced Turn Based Tile Toolkit

Thanks ! That worked! Adding the extra casts was quick enough to do. Now I can focus on messing with the camera some more. Trying to make the cursor more free cam friendly.

Cool, thanks a ton!
Hopefully your new update will be online soon.
Iā€™ve just done it quick and dirty way, I was wondering if rotation could be stored on grid generation, in fact tiles donā€™t move.

Thanks for the update! :slight_smile:

Great that you managed to get it working, and good luck on the camera controls :slight_smile:

No, thank you :smiley: After considering your solution of finding rotation based on tracing I did some experimentation with doing traces at startup to get info about the underlying terrain. Using traces and decals Iā€™ve managed to have the grid conform to any underlying terrain, irrespective of tile placement, and have the displayed grid conform to said terrain. Itā€™s still a bit rough, but it looks promising:

Wow! This is amazing!
Great stuff , canā€™t wait for the new update!

First of all Geart work here. I have been clowning around with it for a few days.

I have 2 newbie questions

Is there any way to make the enemy pawn unable to know where the player pawn is. For ex: Ouy of the box If I place an object wall between the enemy and the player, the enemy will still always know where my player is. I wanted to try and create a stealth based prototype using turn based squares?

Using this template is it possible to create nav meshs so that my Ai patrols certain areas on its turn ?

Many thanks

Hi RugarEk, good to hear youā€™re enjoying the toolkit, and Iā€™m excited to see it used for a stealth game. The two things you want to accomplish should be pretty straightforward to implement.

For enemies ignoring the player until they have seen them, the simplest thing to do is to create a new ā€œFind Tiles in Rangeā€ node in front of all the AI logic, like this:

This way the AI wonā€™t activate if there is not a player within 10 tiles that is not blocked by terrain. You might want to change the hard number 10 to a new public variable housed in the Unit_Parent_BP instead. This works, but has a few weaknesses you might want to adress. Firstly, the AI will stop following the player if it loses sight again. You might therefore want to create another public variable (boolean) called ā€œchase playerā€ or something which is set to true once the AI sees the player, and is checked before the new nodes pictured above, bypassing them if it is set to true. Another possible issue, depending on what youā€™re going for is that visibility will only be checked on the AIā€™s turn. So if the player moves in front of the AI on his turn, but ends his movement outside of sight the AI will be none the wiser. There are a few ways you could fix this. The simplest would be calling range traces towards the player for each AI every few ticks while the player is moving. This becomes a real time element, so if you donā€™t like this solution there are many examples of live line of sight solutions on this forum. Another possible problem is that the current find tiles in range does not take the rotation of the pawn into account. If this is important you could, after a trace has confirmed that a player pawn can be seen, check the look-at-rotation between the two pawns and compare it to the enemy pawnā€™s current rotation. Depending on how close these are you could decide to decide that the player was not seen after all.

As for patrolling there are certainly many ways to do this as well. One solution would be to create two new variables in Unit_BP_Parent: an array of integers you could call Patrol Index List and a simple integer possibly called Patrol Counter. In the Patrol Index List you could add all indexes youā€™d want the AI to patrol to in order (A simple way to find the index numbers of each tile is to drag a pawn or tile on it in the viewport and see what its index variable changes to). Then, when itā€™s the AIā€™s turn and ā€œchase playerā€ is set to false, have it do pathfinding and move to the index equaling the value of Patrol Counter. At the end of movement, increase Patrol Counter by one, unless it is equal to Patrol Index List length -1, in which case you reset Patrol Counter to 0.

I hope these suggestions help, or that they have at least given you ideas to how you might solve it.

Hi ,

Iā€™ve a further implementation question.
My game requires that the pawn have a bunch of AP (action points) at every turn start. Player can use these AP to move their pawn, use objects/special abilities and attack other pawns.
Your toolkit right now implement a bit different solution where you have two phases: the movement phase and the attack phase.

In my game idea, if a pawn remains static it may, (if pawn stats allows him) for example, attack twice in a single turn.

Where should I act to make such changes and not break entire toolkit functionalities?
I know this question may be a little harder than other ones, but it will be great for me to have an answer.

It should actually be quite simple to add. There are of course many ways to do this, and it will depend a bit on what you want to accomplish. I will assume that you are trying to do something akin to the original Fallout games or Arcanum, where action points can be used to walk, and attacks can have varying action point costs. Say, you have 9 action points where you for example use 2 to move, 5 to attack with a shotgun and 2 to kick. Hereā€™s one way to accomplish this:

Iā€™d first create a new public integer variable for Unit_Parent_BP called ā€œMax Action Pointsā€ so that different units can vary in this attribute, and that it can easily be modified from other blueprints. Also, create another called ā€œcurrent action pointsā€. When a unit moves, subtract the length of the path holder array (minus one, since it includes the start index) from its current action points. When it attempts to attack, first call a branch which returns true if current action points is greater or equal to whatever action point cost the attack has. If itā€™s true, resolve the attack and subtract the cost from Current Action Points; if not, display ā€œnot enough action pointsā€ or whatever best gets the message across. At the start of each new turn make sure to again set current action points equal to Max Action Points.

Edit: Forgot one thing. With the current setup, turns automatically end after an attack is resolved, which would have to be changed. I would add a new branch at the end of movement checking if current action points are 0 and in that case call the End Turn function. Youā€™d have to replace the End Turn function at the end of an attack with something similar. If there are still action points left after attacking youā€™d set Combat Mode to Choose attack (not sure if Iā€™m using the exact names. Iā€™m at work and donā€™t have access to UE4) and call find tiles in range again. Youā€™d have to implement a way for players to end their turn with remaining action points. Either a UI button or clicking their character during choose attack. Also if youā€™d want the player to be able to do the reverse: first attack, then move, it would take a bit more work. Youā€™d have to call both find tiles in range and pathfinding at the same time at the start of each turn and rework the on tile clicked logic to reflect that these combat modes have been merged. Iā€™m working on implementing this, actually, but that wonā€™t be for a couple of patches.

Thanks for the answer, anyway by reading your answer I think that my previous question in this case was not too clear.
I think that the most difficult part is not to create and manage the logic that implement action points instead of toolkitā€™s default behaviour, but instead to manage the pawn attack as an action to be used ā€œon demandā€.

For example, I might want to attack first with my pawn: if the enemy pawn do not die, I will like to flee in cover behind the closest high wall.
Right now, for example, I cannot attack and then move because attack is the final phase of every turn.

Iā€™m afraid that I have to ā€œdestroyā€ a lot of toolkitā€™s basic logic in order to achieve that, and also Iā€™m not very sure on ā€œwhereā€ should I act for doing it safely in the grid manager.

Sorry for the confusing last question, I hope this time my question will be clearer.

Edit:
I saw that your latest post been edited with additional info, so you finally answered my question. Thank you :smiley:

I suspect you begun replying to my post before I had written the edit (edit: and it seems I did the same thing), where Iā€™ve adressed some of these questions. I will reiterate and expand upon what I wrote now that I better understand what youā€™re asking:

Currently movement and attacking are kept in separate phases. Creating code that can change between these two are easy enough; just take a look at how it is done at the beginning of initiative when movement is called or at the end of movement when finding visible targets for attack is called. This switch can for example be bound to clicking/re-clicking a weapon icon.

If you want both modes to be available simultaneously you need to do some work, as I created the system to avoid calling both at once for performance reasons, and thus some of the logic is split into different modes. Now that Iā€™m close to achieving efficient calculation of pathfinding and visibility over multiple ticks, calling both at once will not be a problem in the future, and Iā€™ll want to add the option to having a combined attack/move mode. Honestly, for most games the current system is fast enough to call both at once as it stands, but I want to make sure there is no perceivable lag for things like VR and mobiles.

If youā€™d rather want to be able to toggle between modes, like I describe above, that can be done a lot more easily. Like I said in the previous comment, call a branch at the end of attacking and movement and only call End Turn if current action points are 0. Include another option the player can select to call End Turn early.

Hi . Your toolkit is providing something that Iā€™ve been trying to accomplish on and off since UE4 was released! And now that yours is done Iā€™m glad you did instead it of me because it does so many little things I never would have thought of. It really is amazing, great work.

I would like to pick your brain on a couple things Iā€™d like to do. For example, how would you go about building a floating tile dungeon like the one pictured below? Actually I have managed to do it, but right now I have to manually place a bunch of invisible walls to get the line of sight to work properly.


As you can see the walls donā€™t allow line of sight to travel across corners though.


Personally, I would like to be able to build dungeons out of prefabbed groups of tiles and walls like this. My goal is to be able to just drop finished rooms and hallways down onto the grid manager and have it all just kind of link together, and I wanted to see if you might have any suggestions.


By the way, do you have any plans in the future to include larger than one tile units? For example a monster that takes up 2x1 tiles or 2x2 tiles?

Looking good! :slight_smile: Its great that you worked out breaking up loops with a tick. Did you just figure out how to break the loop over a tick or are there any good resources online? I havenā€™t even begun to look into that, though I canā€™t wait to start!

Have you taken a look at the procedural room generation tutorial in the learn tab of the launcher? There are a few other procedural room/maze/etc projects about that might also give you some insight.

Hi TychoVII. Glad to hear that my toolkit saved you work. Sight is blocked by whatever you place in the level that has range trace set to block in its collision properties. If there are no walls in the rooms you will thus be able to look into other rooms, enabling creating floating islands and such. You could always place invisible walls if you want to have the look of your first image.

For your second problem with the pawn not being able to look through corners, thatā€™s because youā€™ve placed the tiles on the inside of the floor tiles, which cause them to block the visibility tracing. If you place them on the tile outside instead, they will allow for vision across corners. However, this will also allow for vision through corners in the way depicted below. Iā€™ll be adding a pillar component in the next patch to fix this, though anything placed within or behind the corner, like an invisible wall, should do. Iā€™ve also resized the walls and placed them a bit lower in the screenshot below, since the walls will seem to be floating if they are placed in thin air with their current scale and location. Iā€™ll be changing the wall mesh to make it more visually appealing in the future, though they are of course just placeholders.

GF0pcyi.png

As for placing modular rooms, one way is to do it procedurally like Zeustiak is suggestion. This takes a bit of work, but I created the system with adding procedural generation later in mind, so it shouldnā€™t be too hard to do. Just feed your procedural algorithm into an array the size of the map, then for each index in the array place the appropriate instanced static meshes in the level at locations found in the Vector Field Array. A much simpler solution, however, is to simply group the actors in a room together. Select them all in the viewport and press ctrl + G. Then click ā€œplace actor at anchorā€, and after that you can freely copy and paste rooms across your level that should snap to the grid. This will not give you the possibility of having saved rooms stored in a folder, however, and you would have to have a palette of rooms on one side of the level to construct your dungeon with, which you could copy to other levels. Unreal Engine used to have a feature called ā€œmake composite blueprintā€ that would allow you to save such configurations, but I canā€™t seem to find it. Maybe it has been patched out? Does anyone here know?

@Zeustiak: Thanks for stopping by :slight_smile: I pretty much figured out breaking up loops on my own. I used a similar solution to the one I sent you a PM about a couple of weeks ago. I sent the same to and he seemed to think I was doing the right thing, so I just went with my original idea. It seems to work pretty well. It is still almost as quick as a regular loop if you put loops per tick to infinite. Here are blueprintue pastes of for loop per tick and for each loop per tick respectively. Plug whatever activates the loop into Initialize and a tick event into the tick execute node. It has a regular Loop Body output and completed output as well as a Tock output (I should probably call it tick, but couldnā€™t resist) that fires at the end of each tick after the code for that tick has been fired. These havenā€™t been added yet, but they will be in the next patch. Epic just told me that my previous patch will be uploaded today, by the way.

I did catch the Twitch stream that they discussed that on then got caught up in work and completely forgot to check it out! I glanced at it briefly today and it seems much more complicated than 's solution with all the quad trees and procedural generation. I will likely look into it more in the future because it does do some things I really like. I followed your Map Generator work while I was researching grid based pathfinding before and it looks amazing. Really looking forward to seeing it finished. :slight_smile:

: Thanks for the reply! For whatever reason I assumed that placing walls on the outside of tiles would mess up pathfinding somehow, because itā€™s as if theyā€™re being placed on nothing at all? But glad to see that this solution works.

Sorry about being a bit unclear earlier, I actually do not intend to do any procedural stuff. I need the dungeon rooms to be modular because I intend to make a simplified in-game dungeon editor where the player can drag and drop preexisting modular rooms onto the grid and build a dungeon that way. I did take a step in that direction however by simply importing my own custom shaped collision pieces and placing them around the manually laid tiles. Right now the walls are a bit huge so they block line of sight since my grid assets are based on a grid with a tilesize of 32, so your guyā€™s a bit big. I shaved off the corners so the line of sight calculator would work properly.


I briefly messed with the ā€œMake Composite Blueprintā€ option. Apparently itā€™s been moved to the Blueprints menu in the toolbar at the top and renamed to ā€œConvert selected components to Blueprint Classā€ according to this post: Where is "Replace with Composited Blueprint" in 4.7 Preview? - Blueprint - Epic Developer Community Forums

I tried it out after selecting a group of tiles along with one of my custom walls, but the tiles just vanished, so not sure whatā€™s going on there. Once I get some more free time I plan to mess around with it some more though. Also, how difficult do you think it would be to implement pawns/units that are larger than one tile?

Having to place walls on the outside to get visibility through corners is not an ideal solution, anyway, and not that intuitive. Iā€™ll try to change this later. Do your new, shaved off wall meshes work well? I tried making something similar at some point, but I had trouble allowing looking past corners and blocking vision through the corners of two adjacent walls at the same time.

Actually the stuff Iā€™m making for the next update will let you create dungeons without placing a single Tile actor. Iā€™ve created a solution that automatically generates walkability on any terrain and meshes placed in your level, as long as they are set to block path trace in their collision properties. Once Iā€™m done with the update you can simply place room meshes (donā€™t have to be actors) of the appropriate size in the level and it should work instantly. For now I think youā€™ll have to use grouping, though.

Ok, thanks. Iā€™ll look into it and see if I can find out if making composite blueprints is a viable option.

I do want to add this at some point. Iā€™m an avid D&D DM, so one of my goals for the toolkit is to be able to recreate Dungeons & Dragons in UE4. This would require allowing for units taking up more than one tile. Itā€™s Dungeons & Dragons after all; not Dungeons & Wyrmlings. Iā€™ve thought of a few ways to do this. One way is to have larger units follow a separate pathfinding function that whenever it checks if the next tile in a search step is walkable also checks the walkability of surrounding tiles of the appropriate size. It would be slightly less efficient, but not terribly so. Iā€™d still want to keep it in a separate function instead of checking a ā€œis this unit larger than 1 tileā€ bool every search step for all units. I think ā€œlongā€ units that occupy a rectangular area might be a bit trickier, as their rotation will change which surrounding tiles they occupy, but Iā€™m confident I can find a solution when I get to implementing large units.

This is my basic setup for the walls for my modular rooms and hallways. Each terminating edge ends in a 45 degree angle to allow vision around corners. Unfortunately itā€™s a bit ugly since there are little gaps in the floor, but it seems to encapsulate all the line of sight traces just fine. They work great as invisible walls.

Holy **** thatā€™s awesome! I canā€™t wait for that update, it sounds like itā€™s exactly what I need.

Iā€™ve been in many D&D groups myself and I know this would be an amazing thing to have. I can already tell you that Iā€™ll personally push your wares onto my DM when youā€™re done. Iā€™m also really excited to see large units support being added in the future since itā€™s something I too plan on implementing in my game. :smiley:

Hi!

The system looks really cool. I bought it yesterday and Iā€™ve been waiting to test it out, but whenever I try to download, it will only say ā€œsyncing.ā€ Iā€™ve downloaded several other packs from the marketplace and they all work, so I donā€™t think itā€™s a problem on my end. Apparently this happens when packs are released before they are supposed to, but I know that the system has been out for a while and working fine. Iā€™m not sure what to do. Thanks!

To prevent it from looking ugly you should just make the collision volumes that shape, and not the walls themselves. An easy way to do this is to open the wall mesh without cropped corners in the editor, select the cropped wall with the appropriate collision in the content browser and click Collision -> copy collision from selected static mesh.

Yeah, I think this will be a pretty sweet update :slight_smile: Iā€™m scripting with a perpetual smile on my face as itā€™s coming together really well. I just opened

Iā€™m sure youā€™ll find a lot of D&D players among fans of turn based strategy. There are few TBS games that donā€™t owe a huge deal to D&D. It will probably be a long while before I can get to making my own games, though. So many features I want to add first :slight_smile:

Hi! I became aware of this problem a couple of days ago. I sent a message to Epic, and they told me it was because they were uploading the patch I sent them a couple of weeks ago. They asked me to wait and see, but itā€™s still stuck at syncing. Iā€™ve notified Epic, but itā€™s the weekend, so they probably wonā€™t fix it until monday. Iā€™m sorry for the inconvenience, but there isnā€™t anything else I can do about it, unfortunately.

I was wondering how that would work, and it makes sense that you can max the loops per frame out it would self correct when the frame rate slows down. Thanks for posting the examples. I will definitely take a look at them when I implement my own solution. :slight_smile:

Same Problem

I have the same problem, it just says ā€œsyncingā€, downloaded others without problem but canā€™t download this. There is post on answerhub Advanced Turn Based Tile Toolkit stuck on Syncing - Platform & Builds - Epic Developer Community Forums but no answer to the problem.