[SUPPORT] Advanced Turn Based Tile Toolkit

Hello, I’ve just bought this tool kit, as it’s what I think, the best starting point for my ideea and I would like to thank you for creating it.
Now, I’ve done a bit of testing around , so fo the next few weeks, I will probably be everyday on this thread asking for your help in solving my noob problems. So, first issue I have, and I’m wondering if anyone else came across it , it’s that when I’m trying to export a blank new , fresh project ( fresh as in it’s just this toolkit in there, nothing else done or modified ) , I get a error in the packing procces ( here is the link http://s000.tinyupload.com/?file_id=31203541819716128527 to download a txt fille with the whole log in there ). The project packing settings were : distribution, windows 64bit.

Thanks for any ideeas you might have, this is a no rush problem, but it would be nice to know it can be fixed before I spend a long time over something that can’t be packed.

Hello strezoiu and welcome to the thread :slight_smile: From your error file it seems like you are trying to package the project using blueprint nativization (blueprint to C++ coversion), but that you do not have Visual Studio installed. If this is correct, try installing visual studio and try again.

Okay, I’m back and have checked the files you sent me. This is a bug (kind of), that I’ve already fixed in the coming update. It was caused by the two different “Find Visible Pawns/Tiles Step 2” functions nested in Find Tiles In Range. Since you unchecked “check visibility” it used the simpler function, which does not have branches for minimum range. This problem should disappear with the new update, but if you want to fix it before then, here are the changes you will need to make:

Hey . How would I make the path spline pathfind around obstacles. For instance if I have a forest tile, full of tree meshes, or other obstructions, it would obviously look really bad to have units pass right through trees.

Additionally, if I have other tiles with specific points where I want the unit to go stand when it moves there. Like a trench, where I have some predefined splines leading to cover points from where the tile can be entered, how would I make the pathfinding spline switch to that for the final tile move so the unit ends up where I want it on the final tile?

What you’re asking is a bit outside my are of expertise, as I’ve only worked with splines enough to get the result I wanted, but I’ll do my best to help. I’ve experimented a bit and made something that works close what I believe you intend with your trenches.

First I’ve created a child of Grid_Actor called GA_Trench which contains a spline representing the trench (and a static mesh just to show the end of the spline for demo purposes). Here are the components of the actor:

Then at the end of the movement of Unit_Parent I check if the tile the unit ended on contains a trench (I do this in a very simple way. Replace with whatever method you prefer). If it does I set the Unit Path Spline to the spline of the trench actor and restart movement. I do a few tricks here to make sure everything behaves correctly.

At the end of movement (the execution pins that exit this screenshot connect to what was previously corrected to the Decide Action After Move custom event):

A small change to the start of movement in Unit_Parent, right after where Unit Path Spline is normally set to the spline found in BP_GridManager. This enables the first point of the spline to be the current location of the unit instead of the center of the tile it occupies:

Another small change to make sure the location of the unit is not automatically set to the center of its current tile when movement ends:

There is a lot of room for improvement, but I think this should be enough to get you started. For moving around tree meshes within a tile you could possibly do something similar, with splines in the tiles coming from all possible entrance points, custom placed to avoid the trees. In this case you would have to detect that you enter a tile midway through movement, switch to the other spline and then switch back. I imagine there are ways you could also modify the path spline before movement starts by checking along the spline and see if it overlaps any actors, at which point you add additional spline points avoiding these obstacles, but here I cannot give you more than guesses on how to go forward. You could also keep the path spline as it is and have a collision sphere surrounding the unit. If the collision sphere collides with a tree you would offset the location of the unit a certain distance from the spline to the left or right vector of the spline at the spline distance the unit currently occupies (built into the Accelerate and Move Pawn Along Spline function). This might be the easiest, actually. I’ll leave you to experiment, but if you become stuck I can give this another go.

Ah thank you, that will definitely help me when I get to working on that.

Best of luck when you get there!

Changing unit attributes based on Actor level

Hey there.

I’m trying to set up a system that allows the player to go from normal 3rd person world exploration to the turn based combat mode. However, I want to set it so that the combat unit’s attributes are determined via a character reference by variables from the 3rd person actor rather than innate to that unit. (So that those attributes will change in accordance with a leveling system that actor has.)

The problem I’ve run into, is that whenever I try to set up a function that will set the combat unit’s attributes to equal the non-combat actor’s…(like so)

This happens. (Ignore the resolution.)

I cannot move or attack with any of the units.

And when I stop testing, I get this error message.

So in short, is there a way of making a units attributes by consistently determined by a separate actor’s variables and not it or it’s parents? And if so, how can I do this?

Hi onewingedcaius! It seems like you have not set up your reference correctly. How are you determining what actor is referenced in Character Reference? References need to be set up to point to a specific actor, in case you are not aware.

Here’s the rundown. The combat unit is set to run the “Set Stats” function right after Event BeginPlay.

The event Stats function uses the variable “Character Reference” that calls back to me “PC_Parent” blueprint to set all the combat_unit stats equal the the “PC_parent”'s current stats.

The PC_Parents stats are all integer variables found here.

I would think it would work okay, since I seem to be able to get the variables from PC_Parent inside the SetStats function okay.

Yet for some reason it still gives me the same error message.

I can’t see where are you setting Character Reference value because it looks like you forgot to do so. You need to set it up in level editor or on begin play event.

@onewingedcaius: tutkarz is correct. You have set up the reference to reference your character actors, but you have not specified what specific actor to get the variables from. As it stands Unreal has no idea how to choose from all the potential characters placed in your game. There are several ways to get a reference, and the best one depends on what you’re doing. If there will never be more than one of a certain actor in the world I often use Get All Actors of Class and get index 0.

For getting references to units in ATBTT, the pawn array is useful. You can use traces and collision to check find actors in certain locations or loop through all actors of a class and search for one that meets a certain criteria. In any case you will need to tell UE4 to reference a specific actor. In your second screenshot you can see that Character Reference in Default Value is set to none, so you will need to change that either directly or through code. Event Begin Play, as suggested by tutkarz is what I often use myself.

Hey @ I’m pretty sure I’ve solved the issues with pass through friendlies breaking, the pathfinding over ticks command in the ai controller under search behind friendlies needed to be set to not continue from last pathfinding in addition to the other changes, as otherwise units that were believed to be in range due to being able to pass through friendlies would not be able to search and find the player unit, as it had already been found, or something like that, I’m not quite sure.

Either way it appears to work now, that just leaves this, which isn’t gamebreaking, but results in the ai making very inefficient moves when it gets crowded. Do you have any insight into what it would take to solve this?

Ok, if that was the reason for the error it is already fixed in the coming update. There are other problems associated with the Search Behind Friendlies part of the AI controller that are caused by the AI reaching its max search range and stopping and then having the search behind friendly units part of the pathfinding reach tiles that have already been searched (a bit hard to explain :P). Because of this I’ve changed it so that if no enemy units are found during the first search, the entire pathfinding will restart from the beginning with Pass Through Friendlies set to true.

Could you give me the repro steps for the issue you are still having? I’m not absolutely sure how to set things up like your example as the target player unit is not visible and I do not know which of your custom tiles are impassable/have higher costs.

Here’s a less terrible example.

https://imgtc.com/i/TXP0UB5.jpg

The two engineers in the middle are set to not move for this example, while the two on the left are set to behave normally.

The first unit on the right moves to the open space to the left of the left engineer, the second one moves to the space behind the right engineer, when the space above the left engineer is open and closer to its target.

I’m guessing this issue occurs because the pathfinding determines the most direct path to the target to be along the bottom, but doesn’t take into account closer open spaces due to it being designed around the standard pathfinding which would never need to take that into consideration.

Thanks for the detailed example, @Selentic. You are correct in the cause of the problem The unit first calculates the quickest path to the tank, ignoring friendly units. This path includes mostly just tiles in the bottom row of tiles in your screenshot and not the ones above them. On this path, the closest possible tile is the one the unit ends up walking to. To fix this you can have the AI evaluate every possible tile it can move to and compare it to a criteria. In this case, after the AI unit has chosen its target you can loop through the Index Can Move To Array and for each index check the distance in tiles between that tile and the tile index of the target using the Get Distance Between Tiles function. The one that returns the lowest value is the index you set to be the target index of the AI unit’s move. You still won’t get perfect results 100% of the time with this solution (it does not take into account obstacles which might make some tiles worse choices), but in most cases it should work fine.

Edit: Actually, scrap that. I gave it some more thought and there will be many cases where this new solution will give you a worse outcome. I have another idea that should work better. After pathfinding store the CanMoveToArray in a new, separate array. Then run a new pathfinding from the tile index of the target unit (the tank). Set the move range to equal the cost of getting all the way to the tank minus the cost of getting to the tile found using the Find Closest Reachable Tile (Pass Through Friendlies) function. In this case that would be 11 (cost of getting to tank) - 3 (cost of getting to the tile the unit moves to in the bottom screenshot). Then, loop through the IndexCanMoveToArray and compare each index to the old CanMoveTo array you stored previously. Find the tile with the lowest cost and you have your target.

This is a pretty heavy duty way of doing this, but it should at least get the best tile every time. If I think of something more elegant I’ll let you know.

I guess it’s not really avoidable since the first solution would definitely cause lots of issues. I already did something very similar for turn changes where it orders ai pawn initiative by running pathfinding on each until it hits either an upper limit or an enemy pawn, so it should be easy enough to apply this here since it’s pretty similar.

thx

E:Also if this helps you work, my solution up above of unchecking continue previous pathfinding can cause an infinite loop where it gets stuck permanently searching in certain circumstances, which is easily rectified by adding a simple boolean to it so that once it starts it doesn’t clear it and start over and functions like you intended, but I spent far too long trying to track that down today.

Hey . Whenever I load/package my levels, the output log gets spammed with messages to this effect.

https://dl.dropboxusercontent.com/u/3332789/asdgwaeasdgfd.jpg

It doesn’t cause any issues, but it does make it a hassle to find information I need under a humongous pile of warnings. Any idea how to fix this?

I’m actually working on a fix for this already. This message log spamming when the game starts is caused by the functions generating the edge arrays trying to access tiles to the north of the norternmost row of tiles and south of the southernmost row. To prevent this I’ll just have to add a branch that checks that we are not accessing tile indexes that are beyond the bounds of the grid. As you say it does not cause any actual issues, but this sort of message spam is of course annoying. My plan is to fix this before sending the new update to Epic.

So 4.15 is here and though I said my new update would be done at around the same time I need a few more days for bug fixing and polish. It is right around the corner, though. In the meantime the 4.14 version of ATBTT runs in 4.15 without any issues.