[SUPPORT] Advanced Turn Based Tile Toolkit

Lots of questions today! I’m a bit pressed for time at the moment, but I’ll do my best.

Hmm, cannot immediately see what is wrong here. You have added multiple different changes, though. Could you try introducing the changes one by one and see at what point it breaks down?

You could add an enum holding your different elements. You could add a map of enum keys and float damage modification percentages to your unit blueprints. Add a damage type enum to your ability. Then in your ability (probably in ExecuteAbility), modify the damage you input to TakeDamage and the action queue you use to display the damage (remember that these values need to be identical). You can modify this by finding the target unit (If you look in ExecuteAbility in BP_AbilityAttack you can see how I get a reference through the GridUnits TMap), finding the damage modifier value in its enum/damage modifier TMap using the element of the ability as the key and multiplying the abilities base damage by this amount.

This is one of many ways to do this, but this was my immediate thought.

The game instance in ATBTT does extremely little at the moment. It is only used in the networked multiplayer menu. Changing this should not affect anything besides this. Definitely not the grenade ability. What exactly are you seeing there? Maybe it is the card game instance modifying and breaking something? I don’t see any reason why merging should not be possible, other than doing some work by copying over stuff from the projects’ respective game modes, game states etc.

Great to hear! Explains why I was not able to replicate the issue.

Player Starts should work. However, it is overridden by at BeginPlay. Remove the SetActorLocation in BeginPlay and using Player Starts should work, I believe. If bUseFollowCam is enabled in BP_GridManager the camera will then pan over immediately to the active unit.

“Player Starts should work. However, it is overridden by at BeginPlay. Remove the SetActorLocation in BeginPlay and using Player Starts should work, I believe. If bUseFollowCam is enabled in BP_GridManager the camera will then pan over immediately to the active unit.”

Thank you for the quick and concise response. Now I just need to rework the camera to fixate on that pawn, and still retain the"freelook" functionality. Thank you again.

Hi ,

I was wonder how to reference other units as the damage works on my elemental weakness/resistance system but I couldn’t find a way to reference other units as it calls its own typing. Here are some screenshots of what I’ve implemented.

Thanks, EagleEyeGamma

Glad it worked! Let me know if you run into any other difficulties.

In the ability you are dealing the damage from you have access to both the target unit, the ability itself and the unit that owns the ability. You could either do whatever you want to do within the context of the ability or you could pass over the unit as a reference to the events being triggered on the target unit.

To clarify more on my problem, Whenever the attacking unit deals damage it should print out the defending unit’s type and deal the damage according to that type. However it seems to print out its own type instead and deal normal damage, how am I able to change and make it so that it recognizes the attacking unit’s type and deal the appropriate damage.

Thanks, EagleEyeGamma.

Ok, so we’re talking Pokemon style damage modifiers? Meaning fire attacks would be universally good against grass type defenders and always result in a consistent damage modifier? Not a Pokemon expert, so partly guessing here.

I tried my hand at something like that. The most awkward part is finding a good clean way to store and access the damage modifiers, but I’ve at least found something that works. Using a data table in some fashion would likely be preferable, but here you have something to build on:

So first I created two new enums. EDamageType, which stores the various damage/element types (I used rock, paper and scissors), and EEffectiveness, which describes the various kinds of damage effectiveness (I used NotEffective, Effective and SuperEffective). I then created a struct which holds a TMap of these (EDamageType as keys and EEffectiveness as values). I called the struct FDamageTypes.

I then needed a place with easy and universal access to store damage modifiers. I chose the game state, but this choice was pretty arbitrary. In the game state I created a new variable, which is a TMap with EDamageType keys and FDamageTypes values. Note that doing this is a bit clunky, and a reason why data tables are probably better suited, but works as a proof of concept:


Next I added a function to the game state where you can find an appropriate damage modifier based on the attack type and the defend type. I use magic numbers for the modifiers here, which you would probably want to convert into variables:


Next I added an EDamageType variable to BP_Unit called Type. If you don’t want to modify the base blueprints you could instead add it to your custom BP_Unit child blueprint and access it through casting or an interface (interfaces are generally more performant).

I then created a new ability duplicated from BP_Attack and added a DamageType variable to this ability. In its ExecuteAbility function I get the game state and find the damage modifier through the function above. I print the type of the defender (as you wanted) and store the modified damage in a local variable, which I then input to the Attack QueueAction and the TakeDamage function (remember that these values must always be the same, or the game logic will differ from what is displayed to the player). Here is the relevant part of the function:


Hope that gives you enough to build on :slight_smile:

Hey ,

I’ve been working on merging the 2 player controllers from both your toolkit, and the card toolkit today, and I’ve got all the conflicts resolved, except the mouse input and touch input.

Before tackling that I wanted to get your advice. The card toolkit is obviously expecting a card to be interacted with, and yours a BP_Unit. I was wondering if you had any idea on some logic that said… If we aren’t dealing with a card, then run through the tile toolkit mouse/input functionality? Or if you have a better idea I’d love to hear it :slight_smile: Thanks!

Hi ,

I am having the same problem as Telapicus, when I go into turn-based combat mode on the hybrid map it just locks up. Is it possible it has something to do with the Anim Class? I noticed the problem started when I switched from the hybrid anim class to my own.

Thanks

Fixing incorrect info

I might be missing something here, but it sounds like you’re describing a simple branch statement? I assume there is some code set up when you click a card. You can set a bCardInteracting boolean to true when this happens and to false when you let go of the card and use this for a branch after the input events. Or is the card setup to complicated for this to work somehow?

Ok, then perhaps you can help me figure out where the issue is, since I have not been able to replicate it. Can you give me the precise steps you have done before this happens? How do you create your anim class? Is is a duplicate or child component? What code do you add to it and how, and have you made any other changes?

Heya ,

I think I found the problem, I missed redirecting 2 of the Cast to ABP Hybrid references. User error, I appreciate your response and consideration. Thanks

Great that you found the issue! @Telapicus: Might this be the problem on your end as well?

@Zennisin: Hey, sorry about the delay for figuring out the mobile touch problems. I set up UE4 to deploy to Android today, but my phone is not being compliant (as in not able to launch any UE4 project). I will give it another go tomorrow.

I think I got this figured out :slight_smile:

Thanks for looking into this! I really appreciate it :slight_smile:

Hi, I just bought the toolkit yesterday. Seems very flexible. I think I’ve got my head wrapped around it enough to ask some intelligent questions :slight_smile:

First, is it possible to dynamically build the grid underneath the landscape at runtime? So, I want to do something similar to your hybrid map but I had a much larger world in mind. Just playing around with the grid manager, I can see that it limits you to 200x200. For what I had in mind, it seems like it would be more efficient to just spawn the grid manager when needed then destroy it afterwards. In my head, I picture most gameplay to be realtime but combat would be turn based. What I had in mind was when combat is triggered, the grid manager would spawn with a 20X20 grid and the player and his group at the edge of the grid.

Second, is it possible for static meshes with collision to automatically make grids they overlap impassable? This directly relates to the first question. Watching the tutorial videos, this looks like it has to be set up manually for each and every static mesh and these meshes would need to be placed “on-the-grid” rather than the landscape. I don’t think this would work for my purposes. It’s possible I just don’t understand how this part works. What I specifically had in mind were trees where I would want to just paint these on the landscape without having to make sure each one is perfectly placed in a grid square. Also, i want tree animations with wind, etc.

Looking forward to your reply.

Awesome!

Still working on it… I’ll let you know when I have an answer.

Thanks! I’ll do my best to answer them.

I’ve though about the possibility of implementing something like this before, and while it might work okay I think I have a better solution. I have recently converted most of the toolkit’s expensive functions to C++. This includes the expensive map generation functions. Using the C++ versions, creating a much larger grid becomes possible. I’ve tested 500*500 tile grids without issue.

I cannot include these functions in the toolkit because of Epic’s policy of only allowing C++ code in plugins, but I can host a separate download of the cpp files and create a guide for converting (it is a bit time consuming, but not terribly so). This will be useful for developers with special requirements, as in your game. It will still take me some weeks to get it to a state where I’m happy to share it, but if you can develop on a smaller grid for now and have a bit of patience, I think this will be the best approach for your game.

This is possible by default. The toolkit includes multiple ways of modifying the grid. The hand placed tile actors was the first method I implemented, so I focus on this in my early tutorial videos. However, I have also included a procedural approach that generates walkability based on the meshes placed in your level.

This will create grid locations by tracing from the sky to the ground and finding meshes blocking the PathTrace collision channel. If selected, the toolkit will also trace for walls from each tile in all directions, removing tile connections (edges) if the line trace (using the WallTrace channel) is blocked between adjacent tiles. You can enable these settings by setting heightmap to OneLevel in the GridManager (for the first one) and bTraceForWalls to true (for the second).

So in other words, make sure that anything you want to walk on blocks PathTrace and anything you want to block movement blocks WallTrace. Animations on trees etc. should not matter. Just make sure the collisions are set up how you want them.

Great! Looking forward to getting the code. I will check back in a couple of weeks.

Hi,

How did you make this happen?

From, EagleEyeGamma

Might take more than a couple of weeks, as I’m working on lots of stuff in parallel, but it should at least me done by Christmas.

Right click the struct output (blue node) and select break struct (or is it split, I always forget).

Hi,

When I did spilt the struct it became this instead of a map

I’ve tried using a make map node to connect to the find map node but it won’t connect for some reason. In that example you showed me how did you connect them?

Thanks, EagleEyeGamma