[SUPPORT] Advanced Turn Based Tile Toolkit

Hello, I’m considering buying and would like to ask a few questions if it’s ok.:slight_smile:
Im a nooby for programing, but am a production artist and I would like to goof around and make a classic roguelike similar to your 2d example except with 3d tiles featuring 2 lvls of height.
Would your awesome toolkit be able to accommodate these things?
I’m well aware that your development goes more in a direction of xcom similar strategy that’s why I’m asking. Then there’s attributes and skills - at what lvl is that supported?
And another one, is the unity store turn based toolkit also yours? If so, are they at the same lvl of development?
Thank you a lot for your time, and happy holidays :slight_smile:
Can’t wait to play around with your toolkit :slight_smile:

Hi there. The toolkit is not built with massive, continuous worlds in mind so if this is your end goal you will need to to quite a bit of modification. The best approach depends a lot on the requirements of your game. This is also not something I have tested myself, so my suggestions of what will work best is based on a fair amount of guesswork.

If your game world is real time and free-roaming until combat begins (like in Fallout 1 or 2, for instance) then you can have movement controlled through some other means and when combat starts, place down a grid manager encompassing the combatants, running grid setup, adding the units to the grid and starting combat. For large grids or if the grid manager uses a lot of procedural grid building options this might cause you to drop a few frames, though, so manual conversion of startup functions to C++ would be recommended.

Other options might be possible depending on your requirements. How is your world built? Do you have multiple overlapping levels? What is the maximum movement and range of units in your game? Is it important that units can keep moving to any tile anywhere on the map even after turn based combat has started? Do you need to be able to display the entire map at any time for the player to look through?

I would probably not recommend trying this if you’re just starting out as a programmer or with UE4 generally, but I might be wrong, of course. It might be that you can achieve your desired results through only moderate modification of the toolkit, or you might have to build a lot of it from scratch. A bit hard to tell beforehand, unfortunately. This is the sort of thing I would want to test out personally if I had more time, but time is in very short supply for me at the moment. Let me know if you make any progress or have any additional questions.

Thanks, that is very kind of you :slight_smile: You got the name sloghtly wrong with Advanced Turn Based **Grid **Toolkit instead of Advanced Turn Based Tile Toolkit, but that is my bad for choosing such a horrible name in the first place. There is a story to why the name is so bad and I regret the choice daily :frowning:

Hello there! Although the examples used in the toolkit lean toward an XCOM-style I have always tried to develop it with all sorts of grid and turn based games mind, so it should hopefully suit your needs. The ability system is created both as a system for abilities that can be activated, but also as a practical way to encapsulate and make modular AI and other game functionality. It should be a good fit for most abilities that are activated and have explicit effects. For a skill like say, persuasion, that simply confers a bonus to some game aspect that all characters can do you can get away with just using simple variables or data tables.

Turn Based Toolkit in Unity is made from a different developer so I can’t be sure when it comes to what features it has.

No problem , I edited the comment to change the name. Also I think it’s a descriptive and fitting name :]

Christmas update on my own stuff: I managed to make my CharacterPawnBP spawn a unit (BP_Unit_Anim_Adv_Heavy for now) in its place before finally deleting itself when entering turn-based combat! Then all units can move, fire and reach win/lose condition normally. I’m so happy.

To do this, I delayed the ActivateATBTT event in Game mode to start only when this unit is spawned, by casting to the game mode from my CharacterPawnBP, before deleting itself. It seems to work just fine, though I wonder if you guys think this is not an efficient or organized-enough solution of solving this? The casting, I mean.

Merry Xmas too! Eat chocolate or fck or spend it with your loved ones guys. Or do all three!

Hello,
I see that everybody is calling you by your name here. So please excuse me for doing so as well.
I have bought your toolkit just few days ago. Iam absolutly new to the whole programing scene but i have strong vision and need to make my own game. Unfortunetly as i said my experience is almost zero. I know that you have a lot of work with your school in these months but i would realy want to ask you for some new tutorials. Since you are working with features that i know nothing about i am almost incapable to improvise and try my own stuff. That means that i need as much data as i can get straight from the source :))

Well, i hope that you are doing great, thank you for this toolkit and please some more tutorials.

Have a nice day.

Well, the name I gave it is at least descriptive :stuck_out_tongue: Since I’m selling to developers and not the general public this might not be too bad.

Happy to hear you got the character/unit combo working! As for your solution with casting, I think that sounds okay. Casting is mostly an issue if you want to do it repeatedly, every tick or more often. Casting once is no problem. Might not be super “elegant”, but I don’t see any problems with it.

Happy Yuletide to you and all! I’ve had to work every day on my thesis, but I managed to squeeze in an evening on the 24th to eat fatty food, drink aquavit and sing carols around the Christmas tree :slight_smile:

Hey! sorry i didnt reply just been exploring the toolkit and experimenting.
Started also looking at custom Abilities and Status, was trying to find a good way of having them to also be able to affect the caster.
E.g. The Heal ability can also be used to heal the caster, when I noticed there is a variable in Ability called “Can Target Self” but upon further investigation it doesnt work. Is this the same for your version yet to be implemented or have I missed something?

Thanks!

Not sure if someone asked it already but what is the best way to block unit’s attack range if there’s another unit between the current unit and current unit’s target?
I need for units to be able to block attack range of each other but I’ve encountered 2 problems here.
The first problem is when AI picks as a valid target the unit it shouldn’t be able to attack in a case another unit stands between the current AI unit and its target.
The second problem is that AI picks the tile it it shouldn’t be able to attack the target from (in a case another unit stands between the current AI unit and its target) as a valid tile from which it can attack its target.
Tried to add range trace blocking to the pawns (deactivated on current unit activation to prevent self-blocking of traces) but that does not help much because:

  1. If the trace is blocked by a friendly unit the current AI unit does not pick enemy unit as a target even if it is able to reach it by taking a detour.
  2. I cannot see red attack tiles under enemy pawns if I want to use the skill of my own unit on them.

I was able to make a workaround for AI picking valid targets by pathfinding check. But I still do not know how to find correct tiles with actual sight to target (not blocked by another pawn).

upd: it is pretty **** hard to figure with current setup. Range trace check for the tile with sight to target starts from target pawn (which is not current pawn) so I have to block-deblock range trace for all potential targets during the check for all tiles with sight to target.

Hmm, it should be possible by default, but I have not tested it in a while. I will not have the time to test it for a few days either, but here is how I would check it: Add a break point to the server click event of the heal ability, click the unit that possesses it and follow the execution chain to see what happens. If it does not fire. examine the steps of the player activate part of BP_Ability and see how it sorts through unit indexes. I will take a closer look when I have the time, but I’m afraid I cannot make any promises for the immediate future, as the next few weeks are promising to be the most exhausting in my life so far, as I’m rushing to finish my thesis. After it is done I should have more time than I’ve had for almost a year, though.

Yeah, you’re right that this is fairly tricky thanks to how the toolkit is set up. It is made a bit trickier thanks to one bit of the toolkit that is a bit janky. The main complicating factor is that when actions are simulated happens instantly, while when things are animated it happens over time (and after things have been simulated). This is normally not an issue since almost everything important is calculated within the arrays of the grid manager without reference to the game world.

The exception to this is visibility, which is done in the game world using line traces as this is more flexible, simpler and for blueprints more performant than calculating it using grid math. This is normally not an issue, but if you have parts of the map that might change visibility for the map within an action, such as moving units that can block visibility it might become an issue. I solved this is the grenade ability by spawning collision capsules in place of units for a single frame while finding targets for the ability.

However, I don’t think this is what is the issue in your case, from your description. Just something to keep in mind when you expand upon this.

I did answer a similar question in this thread a few pages back. Try to follow the steps I provide there and see if you still run into problems. Make sure to follow the entire discussion I had with @Lexx and not just the first few answers: https://forums.unrealengine.com/unreal-engine/marketplace/31005-support-advanced-turn-based-tile-toolkit?p=1536817#post1536817

hi everyone

happy new year for you all

cheers

leo

Great, I’ll read it. It seems I found a somehow hacky solution just now. I’ve added a box blocking range trace to all pawns and modified all the needed functions containing Line Trace by Channel by adding “Actors to Ignore” there (whichin my case are the pawns that “radiate” line traces). That is for finding valid tiles. For picking AI targets I’m using pathfinding. Seems to be working but needs testing.

Hey guys, I’ve run into an issue that I can’t seem to find an answer for, so maybe someone here can help. I’ve got the toolkit running with a random dungeon generator I made. I have predefined rooms (as Blueprint Actors), and each contains a BP_Subgrid with the exception of my Entry room, which hold the BP_Grid_Manager. When I run the game, I’m able to cross over rooms (and thus into the subgrids) just fine, up to a point. It seems that 30 tiles away from the start point, I can not move further, usually stopping me halfway thru a subgrid. In my testing its always 30 tiles end-end (or roughly 6000 units). Any thoughts?

Love the toolkit, but i have a problem with spawning units at runtime. They get created and everything, even have the right grid index and they are represented on the initiative bar, but nothing is happening during their turn. They do not move.
Is it enough to spawn actor on the tile or is there some additional configuration that is required to make this work?

EDIT:
after some digging
it sseems that the problem is with the ability system’s begin play, in second pin of sequence there is some wierd loop after that, why is this whole setup neccesary? You create just one instance of each ability in the character controller instead of having every instance of ability actor per component?

Awesome toolkit! I have a question: I’m developing a mulitplayer game I’d like to be across a public server. The game has a home screen (set up as a separate level) that players are to join the server first. It then take them to a central “in game” area that they choose various levels from. The central area doesn’t really use the grid manager/controller but obviously all the other levels would.

The Toolkit seems to set up the server and connect players within itself, which in my case would be within the levels, not the “central area”. If I’m wanting to connect players earlier at the home screen of the game, do I need to remove that server set up from the levels themselves and do this in the separate home screen levels? What is the most effective way to do this?

Best of luck with that!

Just as an update I added a branch in Grid Manage > Keep Indexes with Relevant Units Set - which i believe is called right before it checks all indexes in the array for targets.
Essentially just using the Exclude Specific Unit bool, if yes continue as normal, if no then add the owning actors index to the array before going to the Return Node. :slight_smile:

Hey, sorry for the late answers. My responses are going to be extra sporadic the next couple of weeks, but then things should get better.

I’m not able to replicate this on my end. Are you able to reproduce the issue without your dungeon generator (just using subgrids)? If so can you give me the precise reproduction steps so I can test it out?

Seems like you’ve found a bug. Seems I did not properly test unit spawning after I made changes to network ownership, which is what is causing this. The problem is not the begin play of the ability system, though it is partially ability related.

For the first issue of the unit never being selected, this is because the unit does not get assigned an owner automatically. If there is no player controller that owns the unit it will not be activated. Thus when spawning the unit set its owner to the appropriate player controller (for single player games just use GetPlayerController). I will change this in a future update so that the player controller of the server is automatically assigned if no other owner is chosen.

This will get you most of the way there, but there is another issue relating to ownership. You need to set the OwnerId variable of the spawned unit to the ID of the controlling player’s game state, or player-specific markers will not show up for that player (such as tiles in move range etc.). Before any such ability-specific markers are spawned abilities check that the unit owning the ability is being controller by this particular player. OwnerID is also something I should set to the id of the server if nothing is specified. For now you’ll need to do this manually, but it is pretty simple. Here is a basic setup for spawning units owner by the server:


As for why abilities are spawned the way they are, that is for a couple of reasons. First, for turn based games having multiple abilities of the same type spawned are not really needed as only one of them would be active at the same time anyway. The way I’ve designed the abilities having a lot of them spawned at the same time should not really have any impact on performance, but it is a bit of a safeguard. Another more important reason is that it often takes a while in Unreal Engine from you spawn an actor until you are able to access it (a tick, usually). This is doubly true for clients accessing actors spawned on the server, which might take multiple ticks.

If we keep spawning in and deleting abilities every time a unit is created we would have to add several checks to make sure the ability actors can be accessed before they are, for instance, passed to the action system to be stored for later animation, to avoid issues. By keeping the amount of times abilities are spawned minimal and keeping these checks in a central location (the GetAbilityOrAddIfMissing function in BP_PlayerController_ATBTT) we can minimize the problems caused by this spawn lag.

Hey JPhilmore, glad you like the toolkit. I do not think the setup I have within the levels would need to be removed. You could always create a central area where the players meet (which is not turn based) and then have them join new levels. All the checks I’ve added do is to make sure turn based combat does not start until all players that should join have joined the level. Even though you have players connect up in a central HUB I assume you still want to wait with turn based combat beginning until all relevant players have joined that particular level? If so I think you should be able to keep things the way they are. Let me know if you run into any issues, though.

Thanks :slight_smile: Yes, that seems like the right place to look. Did this solve your problem?

Thanks for the response man. I removed my generator like you asked and it does seem like that is the cause to part of the issue as I too was unable to replicate it by just placing my room BPs or using a (much simplified) version of my generator to mimic the adding of the rooms at runtime. However, part of the issue I was able to replicate, but I’m not sure if there’s really anything that can be done as I believe its just part of the way the toolkit is engineered because of the tile indexing. If a BP is placed so part/all of the child subgrid goes beyond the 0xy of the main grid, it ceases to become functional. I noticed that if you place a subgrid in the scene, it wont even let you move the thing beyond these limits due to the aforementioned theoretical limitations.

I honestly believe I just need to reimplement the toolkit and my dungeon generator a bit differently, as the current way the indexing works for the grid/subgrid is going to make using the subgrids within a BP placed at random locations this way impossible. No worries though, I’ve already got a more semi-random placement method in my head, just need to map it out (no pun intended).

https://i.imgur.com/TlmqwWC.jpg

Hello. I am fairly new using your blueprint. I am having an issue Adding characters without the UE4 skeleton. I seem to be real close, most everything is working except exiting from the TakeDamage and Attack states in the UnitStateMachine. The animations begin and loop over and over, never having the bTakeDamage and bAttack being reset to false to exit from the state so the game freezes in the animation loop.

I checked in in the Anim Preview Editor. If I click true/false there for bTakeDamage and bAttack it works as expected, but not at run time.

My Parent Class for my Animation Blueprint is BP Unit, and copied blueprint code from BP_Anim_Unit with Advance blueprints for Abilties, Attributes, and Stealth added.

Any ideas why the bAttack and bTakeDamage would not being set to false when the animation should end.

EDIT: Figured out the problem. I had to add Notifies into the animation frames of the model I was using. Like notify HitEnd, ActionHit, ActionEnd, DeathEnd, etc.

Thanks, Loco

Another quick question, how would you gather neighbours of a tile? GA_Tile seems to have an array of edges, but grid manager is having all the connections held in a map?

EDIT: Problem solved, i thought for some reason that costs are keys to the map, while its the target tile, hurr

Glad you figured it out :slight_smile: Edges for a tile is indeed represented by the nested GridEdges map. This will only give you connected neighbors, though. If you want to get all surrounding tiles, including the ones that are not connected by an edge you can use GetIndexesInRange with a range of 1 or, if performance is extremely important, use GetBaseEdges (adding the index of the center tile to the output array).

Yeah, it does indeed not work if you go beyond index 0,0. I thought long and hard on how I wanted to do the indexing, but ended up doing it this way as it made the indexing more intuitive. If you want to be able to place the rooms anywhere just place the grid manager so that the center of your dungeon is at index 50000 and you should have plenty of space to either side. No need to change how the indexing works.

Hey, glad you figured it out. Sorry for the late answer.