[SUPPORT] Advanced Turn Based Tile Toolkit

: Ok, I’ve cooked up a solution that should give you a good starting point.

I’ve added the following code to the player controller (just as an example).

The “O” event disables turn based combat by calling a new event in the Turn Manager. This event clears the active unit, disables the active ability and initializes the action queue so that the ability deactivation is actually shown to the player. I also hide the active actor marker.

The “K” event simply shifts the location of all actors a couple of tiles to the side. Just a stand-in for your free movement system.

The “L” event clears grid unit and adds all the units back to the grid based on their current locations, making sure to update their GridIndex variable in the same fashion. Then I begin the turn of the first unit in initiative and show the active actor marker again.

One last thing: The DeactivateAbility interface function in the player controller by default activates the BP_AbilityBase_Idle when an ability is deactivated. You will have to disconnect this particular functionality (just disconnect ActivateAbility at the end of the graph). This is what causes the marker to sporadically appear even after you’ve deactivated the active unit. If you still need this functionality during turn based combat add a branch instead of disconnecting it entirely and set it based on a player controller variable you set to true or false as you enable/disable turn based combat.

Hope this gives you a good starting point.

Here are the pastebins for the Player Controller and Turn Manager

@ wow! Thanks so much for your effort and the in-depth information! This seems to be the perfect starting point for us to continue thanks ! : )

@ I am trying to make a large size turn based boardgame of sorts but there is def something amiss with grid manager. I tried deleted landscape and only using a 100X100 grid. same thing happens after I moved like 20 times. though there is much actual grid left on the map ther is a solid line made from the passable blue tiles but cannot move further past that area
I would be happy to share the project with you it is only proto type nothing even added except the tile toolkit… I have not modified any bp’s or anything if you could message me your email I will share with you … I really want to use this for my project I think it will work great but gotta figure out what causes this sudden stop in tile access for sure maybe you have not tested fully with 100x100
to reproduce you could make a 100x100 grid and just keep moving out in a certain direction and you will end up at a point you cannot move further though the grid is still more room

Hey - regarding the infinite loop error - We faced that problem a couple of weeks ago - you can increase the Maximum Loop Iteration count via Project Settings > Engine - General Settings. That should help to get bigger sized grids calculated : )

Happy to help :slight_smile:

Ok, if you’re not able to figure out how to consistently reproduce the issue in a way that I can test you can send me a download link to your project in a PM and I’ll take a look when I have the time.

to reproduce make a 100X100 grid and just kkeep moving in a set direction and before long you will reun into a line you cannot pass though the grid continues

Yeah, I’m still not able to reproduce the error. I guess you’ll have to send your project over.

@ Hey - now things work quite well - we can trigger and stop combat from anywhere in the world - but as soon as combat reached game over state we’re doing something wrong with resetting . we set currentTurn back to zero, reset TurnState to Turnbased - clear the GridUnits array and disable the GameOver widget - but somehow no unit want’s to start it’s turn when a new combat begins after the previous combat reached GameOver state - do you know anything regarding this problem?

Are you setting bGameOver in the turn manager to false?

@ Hi, an update and a new question on creating a random damage system. We finally came through with a solution that seems to work just fine but I would appreciate a quick look at the solution to make sure we are getting it right.

We will probably have more variables that can effect the damage in the game so created a function in BP_Unit called Calaculate Damage. For now it just take two variables, Damage Min and Damage Max, and set the variable Damage via Random Float in Range.

This function we call in the BP_Abillity_MoveAttack before the QueueAction and set a local variable DamageTaken to the value in Damage. This value we then use in QueueAction and as input to the TakeDamage function.

Now to my question. As input to Target in the Calculate Damage function we use Owning Unit and it’s seems to work just fine. When I look at the the input to Target in the TakeDamage function, and some other functions, you use a Grid Manager Ref. Is it because the Target is the targeted unit or should we use the same syntax as input to Target in our Calculate Damage function for some reason? If you have any other input to the solution feel free to point us right. I’m still trying to get the right feeling for working with blueprints.

Hi again, I think your setup looks very reasonable Using a function that you can easily override or modify for getting damage is good practice when you expect you need this in the future. This also means you can easily add completely different damage calculations to different types of units.

For your last question, all that matters is that you reference the correct unit. BP_Ability holds a reference to the owning unit that is set on activation, just to simplify operations such as this one (though you could do it through getting it from the grid manager to the same effect). I do not store the target unit in a reference variable by default in BP_Ability, since not all abilities will have a unit as a target. You could of course add such a variable to your ability if you’re going to reference this unit a lot, to simplify things (and make the operations insignificantly quicker for the cost of an insignificant amount of memory), but it does not really matter.

Yes - maybe it has something to do with the initiative order?

Try testing it using break points. You could for instance add a break point to whatever code you are running to restart turn based combat and then step through the execution chain as it executes to see at which point it stops up. This will give us more to go on.

Edit: incidentally this was my post number 1337! I feel this is really the point where I should have gotten the Elite forum tag.

@ Thank you for this amazing toolkit! I’m trying to get the online multiplayer working but I have hit a little bit of a wall. The multiplayer works great in the editor so I’ve got that first step down. But when I try to make a build and connect to another player online the two instances of the game can’t find each other. I believe a read a comment in this forum last year about someone who managed to get Steam Multiplayer working. Can you help identify the steps I need to take to get multiplayer working. It’s our last big hurdle before doing our closed alpha testing. Thanks so much in advance.

If you want to run ATBTT in multiplayer through steam you need to setup the Steam Online Subsystem. There is no specific setup required for the toolkit beyond what is described in the Unreal Engine documentation. Here is the link. Let me know if you run into any issues.

Congrats to your Elite status ! :smiley:

Just noticed turnmanager - always seems to be at initiative index 0 - displayed as the sand clock remains first in the initiative bar and is stuck in it’s “turn” once gameover state is reached and a new combat is started

Hey @ Thanks for the prompt response. Do I have to use Steam for multiplayer in ATBTT? Or is there an easier way to get it working? Also I’m having trouble with the hover tile marker and spline. They only appear on some of the tiles seemingly at random. They also tend to lag a bit. I’m not sure what is the cause of this. I have made a lot of changes to the toolkit but I haven’t been able to find a solution for this. Any idea how to fix this?

Well, the Turn Manager should be at index 0 of the initiative array, as it signals the start of a new turn. Test it out with breakpoints, starting with the node you use to start a new combat, and see where precisely the execution chain stops.

You can test out multiplayer in the engine itself (though setting number of clients), but to properly test you’ll have to use some networked solution. Steam is the one I have personally used for testing, and I think it is one of the simpler one to set up. Are you having any problems with it?

The tiles lagging and not appearing on certain tiles could be caused by any number of things. Does this happen only on certain clients? Are you using different height levels and it only seems to happen at certain height levels? Perhaps you can record a short clip of it so I can get a better idea of what might be going on?

@

Hello, I’ve been having a blast with the toolkit so far and i’m slowly chewing through the base stats and added some extra’s and i’m currently trying to work through and change the initiative system to suit what I’m wanting, but every time I modify the players Initiative value, it adds 100 to it, then if I change to Faction 3 it adds 200 to it and i’m having troubles finding what’s causing this to happen.

I haven’t actually edited the Initiative files yet, i’m just trying to see what happens when you set two values to the same number.

Good day Kurt. You have lelp me already alot. But i still have a question. Last time for disable selection unit at start game i did what u said:“In the “Begin new turn” comment box in the Event Graph of BP_TurnManager, at the rightmost node that calls EndActiveActorTurn set AutoNextTurn to false.”.And its work nice. But only for faction Player. How can i do same for faction Enemy?