[SUPPORT] Advanced Turn Based Tile Toolkit

Ok, thanks. I’ll check it out as soon as I’m back.

Everything in the toolkit is made with blueprints and you have access to everything I have access to. The AI is done through the abilities (as well as the Ability System to a lesser extent for units who implement this component ).

Most of the important AI code is in BP_Ability, with specific abilities overwriting and adding to the code of this parent blueprint.

To check out how it works I recommend adding a break point on the selection of an AI unit and then stepping through the nodes one at a time to see the entire system in action.

The AI works in a similar fashion for all of the included abilities. First the ability finds all potential targets of the ability and assigns a value based on some criteria (health of the target, for instance). Then it assigns a value to all tiles that can be moved to from which the ability can be used.

It finds the highest product of these two values and compares it to the equivalent product values of any other abilities the unit has (if it implements the ability system). The highest value determines the ability to use, the tile to move to and the target to use the ability on.

​​​​​​​The devil is in the details, of course, and AI is one of the more complex parts of the toolkit. Let me know if you need any more help in figuring things out after stepping through the code.

Thanks again,
Loco

I have changed the damage in my character blueprint instance,but then I ran the game,damage is still 35.And then I found that this damage is deal with DamageRange in BP_Ability_Laser BP.
Does that means the shoot can only have same damage between any type of character?

No worries :slight_smile:

What damage value is used depends on the ability. BP_Ability_Laser was designed with the assumption that each unit might have multiple abilities with different damage values, so it uses the Damage variable within BP_Ability_Laser by default, instead of the one tied to the unit.

Thanks for your quick reply,I have another question,Why does enemy always goes to my character very closed,and shoot.I think it should shoot in a long range.
Just like in my video.

If you’re using the laser ability enemies try to get as close as possible in order to increase their accuracy (while take into account the cover value of tiles). You’ll need to tinker with the AI for that ability if you want it differently. If you use Ability_MoveAttack it is set up to look at the unit’s PreferredRange variable, which can be set to prefer long range.

Hey, hope everything is well :slight_smile:

I’ve been working with the toolkit on a full time basis and been really enjoying it. Have been trying to get all the easier tasks for my project done this week while you were away.

If you’re back, I would love to revisit the two questions you said wished you were home for.

  1. Attackable objects on the corners of square tiles. In my case, these objects only need to be attacked when a Unit is within the 4 adjacent squares that the corner object resides on. So we might be able to use collision to our advantage somehow. However, I will need to have the objects belong to the factions (Player, Enemy, Faction 3) both for the aura effects i mentioned on their 4 adjacent squares and because any object that doesn’t belong to your faction will need to block pathfinding for movement and abilities (in this regard, I’m happy to have my Units only be able to move 1 square at a time if that makes everything significantly easier).

  2. Selecting multiple Units to be able to attack together/add their damage together for a single attack. This is also a case where range isn’t an issue, the Units only need to be able to attack adjacent enemies and adjacent corner objects.

Anyways, i’m more than happy to spend a lot of time trying to get it right, looking forward to continuing to work on it :slight_smile:

Hey, all is well and I’m back home. The next three weeks are going to be pretty busy, as I have a lot of catching up to do on work after my vacation, but at least I now have access to my computer :slight_smile:

I had some fun testing out options for your first questions. Did not make anything complete, but this should hopefully be helpful to you. I made some pegs in the corners of tiles and an ability that can be used to hammer down any single peg clicked or hammer down all four surrounding pegs if a tile is clicked. Here it is in action:

So how does it work? Well, first I made a peg actor (BP_GA_CornerTower). It is a child of BP_GridActor to enable grid snapping and automatically setting a GridIndex variable. For components it has a static mesh cube scaled to look like a pillar with a blue material. It is parented to the GridAnchor and offset by 100UU in the X and Y axes. The pillar blocks Visibility and no other channels in its collision settings.

At the start of the game this actor adds itself to the GridObjects array in BP_GridManager. It also implements the BPI_Interact interface, which is used by the grid manager to interact with objects in the GridObjects TMap. It has custom events for hovering and ending hovering which changes its material and an event for getting hammered into the ground, which is also called if an interact interface event is called (Pastebin):

https://i.imgur.com/L6QODFd.png

Next I made an ability that can be used to interact with the above pillars. It is based on BP_AbilityBase instead of BP_Ability, as BP_Ability has a lot of stuff in it which is mostly useful for unit based abilities, which is not needed here.

This ability basically checks if there are any pillars under the cursor when hovering or clicking. If yes it highlights them (for hovering) and hammers them (for clicking). Hovering or clicking a pillar also prevents the regular grid hovering and interaction code from running. If the player clicks a tile instead of a pillar it will interact with the four surrounding tiles corresponding to the surrounding pillars and hammer them down through GridObjects interaction (Pastebin):

https://i.imgur.com/sjXAxLm.png

Lastly I added a way to activate this ability by pressing a key (Just a simple way to test it):

https://i.imgur.com/EC9abgO.png

Hope this gets you on the right track. I’ll see if I have the time to look into multi-unit selection some other day.

Edit: forgot to include the GIF I mad if it in action:

Hey everyone, seems like Epic have rolled out a new review system for marketplace assets! Finally I can get notifications when people leave comments on the asset page. Comments have also been split into reviews and questions. I still prefer people to use this forum thread for questions, though, as it is still not possible to include screenshots etc. in the questions section.

The only downside to the new marketplace is that all previous comments on the toolkit have been hidden from view in a “View Legacy Comments” section. Currently it looks pretty sad :frowning:


I think it would be great if new interested developers had at least a few reviews to read through while considering a purchase. If any of you following this thread have previously made a “legacy comment” that can easily be copied in as a review, or if you want to write a new one that would be appreciated. No pressure, of course, but for those of you in the mood for reviewing I thought I’d let you know about the new review tab :slight_smile:

In other news I’ve played around with creating a hybrid Real Time Third Person/Turn Based Strategy mode. I’ll probably include this in the Experiemntal folder for the next update. I got inspired by 's project and wanted to see what I could cook up. Still a ways to go, but what I’ve got is already pretty fun, I think. Take a look!


@Locoweed: Now that I’m back I’ve tried to replicate the issue you were reporting with the turn not ending if the final unit is AI controlled and has remaining action points. The way I tested it was to duplicate the JungleRaid map, use a single Player unit and and enemy AI controlled unit. I set bUseEndsTurn of BP_AbilityLaser to false and increased Current and Max Action Points to 4. I reduced the health of the player so he could be killed by a single shot. The Enemy Faction Wins message shows up correctly when I test it out like this. If you’re still seeing the end game issue in the latest version of the toolkit, could you give me the exact repro steps to reproduce the issue in a fresh project?

I’m doing a posting hattrick here, but I just had to share. UE4.23 is out and they lined up the connections between impure compact nodes! Biggest improvement in Unreal Engine’s history IMO:

I’m going through every function and event graph and lining up all the things!

Hey ,

Apologizes for a simple question but where is the damage being calculated and store for the units. I’ve been trying to figure it out through the Take Damage Function of the BP_Unit but i couldn’t find where the health and damage variables were.

Thanks, Eagle.

Thanks man, really appreciate the in depth responses. It’s been a very good starting point to build in the functionality!

I’m not sure if this fully answers your question, but in the details panel of BP_Unit’s editor you can find and tweak a bunch of attributes including damage down in the Config>Attributes tab. Otherwise if you drag it into the viewport, it is also editable there by selecting it and going under Config>Attributes (i think that functionality is called being instance editable)

No need to apologize as it is not completely straightforward, since the answer depends on the ability. BP_Ability_MoveAttack and BP_Ability_Attack get their damage value from the Damage public variable in BP_Unit (like @behappyandsm1le said). These abilties were designed with the sort of game in mind where each unit has a single attack, so it makes sense to store the damage variable on the unit. In contrast, BP_Ability_Laser and BP_Ability_Explosive were designed for games where each unit might have multiple different damaging abilities. As such, damage for these abilties are defined in separate Damage variables within each ability.

Happy to help!

hi

i am working on the movement part, and I am using the experimental part of the toolkit. I have some problem I hope you can help me with.

so at first i used the code as it is (in my project) and didn’t change it, but I get strange behavior as so:

  1. when I move my character to a ladder to climb he is doing everything as needed but when he gets to his final tile on top and stop, then he Disappear for a moment and then pop back into the grid (to the last tile) from above like he spawned there. any idea what could be the problem?

  2. in the animation of climbing the ladder there is a unclean transition (a liitle jump) from the climb loop to the climb end?

  3. I want to add special edges to all my fence so the character know he can jump over it. I do not want to place them as an actor( I have a lot of them) so I thought to make another trace for that but I don’t know if will be better to make it as a new function or just extend a already working function like the the Adds edges from a tile to neighboring tiles for multi-level grid . what do you think is the better approach for that?

thanks in advance

leo

Specifically the ladder climbing animation is the least elegant part of the toolkit at the moment. The animation I’m using is unfortunately not a perfect loop, which causes the small jump. I’m sure it is possible to work around it through animation transition lerping etc., but animation is admittedly not my strong suit. I will try to revisit the climb animation at some point, but I’m open to input from users more used to UE4 animation in the meantime.

Hmm, I probably wouldn’t be using the function for adding edges for this, if I understand you correctly in that the fences are purely aesthetic and don’t affect pathfinding. Using actors is the simplest way, but I can understand that you’d want to steer away from that if you have a lot of fences. If performance is the reason you don’t want to use actors you could use fence actors in editor, where the fence meshes are editor only and have a function at startup loop through all the fence actors and place ISMs on each of them instead of fence meshes. Using collision and traces is another way, of course. I’d probably make a new channel and set it up similarly to how I do things in the cover system component.

hi

thanks for the answer, i will try to work on an improve animation and will let you know if I have something better.

the fences are not purely aesthetic , they are used as cover and can be jump over by the character.

but the biggest problem I have ( I cant progress because of it ) I wrote you on no -1 (you probably didn’t notice it). I will be glade if you can help me with this one.

cheers

leo

That hybrid third person/turn based mode just knocked me out of my chair this morning. I would love dig into that!

Sorry, I assumed question 1 and 2 described the same issue. I’m not sure I undersatnd what you meant in question #1. If you’re using the experimental ladders perhaps you haven’t moved the 3D widget appropriately to sit over the tile at the top of the ladder?

Good to hear! You won’t have to wait long, as I’ve included it in the next update, which I’m sending to Epic today. It is a tiny bit hacky, but it works. I’ve included it in its own “Hybrid” folder in the Experimental folder.

Just wondering if you could point me in tge right direction for a teleport strike. The way I have it now breaks the unit, causing it to show up on the edge of the map and be unable to attack or take damage after the ability is used.

Depends on what you mean by teleport strike. What precisely are you trying to achieve and what are you currently doing? Teleporting to the edge of the map indicates that you are interpreting a function that returns false as a grid index, causing it to return index 0 (which is at the edge of the map)