This definitely pointed me in the right direction. The health is now being correctly displayed when factoring in defense. Your example was also very helpful since it gave me some direction as to where to implement things like hit chance, critical, and multiple attacks.
Sorry about the late answer, people. Yesterday got really busy. Iāll get to your questions now
[quote=ā, post:3471, topic:21930ā]
Ok, here is a hardcoded example to give you a starting point. This creates tiles and add them to the grid in a hexagonal donut at a specified grid index:
https://i.imgur.com/i04elB8.png
https://i.imgur.com/N5jOGpp.gif
Note that DefaultTile does not have collision, so you would want to add your own mesh instance with collision that blocks PathTrace
Ah, sorry. I assumed you were using meshes. For decals, change the value of TileMarkersDecal (and for BP_Ability_MoveAttack also TileMarkerMoveDecal). Both are variables in BP_Ability and its children.
Yeah, this is my mistake. Seems like the material is being unnecessarily overridden due to an old setup that is no longer needed. Go to the DisplaySplineWithSplineMeshes function in BP_GridManager and remove the SetMaterial node.
AI is a bit more complicated. Generally AI abilities try to find all reachable tiles, with a move range defined by the PossibleMove variable in the ability. If the unit has only enough AP left when assessing an ability to use the ability, but nothing more, PossibleMove is set to 0 (in UpdateAttributes) and the unit will only use the skill if it can do so from its current position.
That error indicates that there is no value stored in the float array of the action. You need to pass the damage into the QueueAction(death) macro where it is called.
Maybe you forgot to connect the ForLoop to the Add node in BP_Ability_Move when you deleted the branch? Check your code and make sure it looks like my screenshots.
Many different ways to do this. Not sure which is best. Perhaps create a grid TMap that holds the number of units on each tile and when a unit wants to enter a tile, check the number, reference it against an array of predefined relative locations and make this the end point of the path? Something like that.
Hi Munchydo, that is a very common mistake people make with the toolkit, and understandably so, since the game logic/action system distinction takes some getting used to (check out my tutorials on the action system if you have not done so already). Iām making some changes in the next update that will make it more difficult to make these sorts of mistake.
The problem is that you are damaging and killing the unit in the game logic, but you are not sending this information to the action system, which asynchronously displays this to the player. So in other words you need to make sure that any time you deal damage you also queue and action to display that damage being dealt. Infest has been kind to show one way of doing this. If you are using the TakeDamage directly you can also set the AutoAnimate boolean to true, which will automatically queue the appropriate hurt animation and health bar change dependent on the input damage.
Hello , i have a question about ai. I am using the hybrid mode. During the the third person mode I have an ai controller controlling ai. The problem is when combat starts my ai still follows me. I have added my ai character as a child to another grid unit so other characters movement and attack tiles reflect where my ai character starts at begin play (meaning they block movement and can be attacked) but as my ai character is moving around following me as their āgrid anchorā for the ai stays in the same place and does not move or attack. I can click on where the grid unit is to see attack range but thatās it. Iām thinking I have to set my ai controller to maybe the default controller at the start and end of combat. Any thoughts or ideas?
Hello ā¦ thanks for the help, just what I neededā¦ Just built a ryzen 3950 computer and workin out the bugs now I am ready for Raytracing !!
Thanks again you Turn Based GOD !!
Hi, it depends a bit on how you have set up your code for following, but in principle it should not be more difficult than adding a branch to check a bIsTurnBased boolean or similar (on the unit or elsewhere) and not call your follow code if it is true. Could you show me how you have set up your real time movement code?
Great stuff! Always a great feeling when you have just completed a new rig.
In other news, the Dungeon Crawler Toolkit is now live on the marketplace! Check it out on the marketplace, and below is the feature trailer:
The grid manager right now of course makes a square grid, I want to figure out how to make it a hex. I am thinking it can be done by changing the edge that the grid grows from on the starting hex.
Hell, even if I was to be able to simply set a premade hex grid in as the base static mesh of the BP_GridManager_Hex and it have all the other properties that is given in that BP it would suit my needs. I tried replacing the Static mesh in the BP view port but it still populated the original single hex mesh.
Hi Arragoth, so for this you can use GetIndexesInRange and spawn the tiles accordingly. In BP_GridManager_Hex you can override the SpawnTileGrid function like so:
https://i.imgur.com/LpCTliG.png
This gives you the visual result you are after:
https://i.imgur.com/ba6qai8.png
However, we are not done, as the gameplay grids need to know that these tiles have to be added to the appropriate arrays at startup.
So we can similarly modify CreateGridLocations:
https://i.imgur.com/wzWwlFo.png
In the above screenshot Iām modifying the part of the function if heightmap is set to false. If you have a different heightmap setup modify the other parts of this function as appropriate.
Weāre almost done, but there is one thing missing. To improve performance on very large grids, individual tile mesh instances do not have collision enabled, so they will not block the grid generation traces on startup or the trace under the cursor for interacting with the grid.
Normally this is solved by having a collision plane component that resizes to appropriately cover the grid. We could code something similar with an automatically resizing flat hexagonal mesh, and I might do so in a future update, but for now let us just do it manually, since Iām assuming you know the size of your map beforehand (let me know if this is not the case)
So here I simply place a SM_Hex static mesh on top of our grid manager, resize it as appropriate, set its collision to block PathTrace, and set bHiddenInGame to true:
https://i.imgur.com/xrAoOs6.png
And weāre golden:
https://i.imgur.com/aJEXeHh.gif
Note that there might be issues with this setup that Iām not seeing as I have not tested every feature of the toolkit against this setup. Let me know if you run into any problems. For now it is probably at least smart to set GridSizeY to the same size as GridSizeX to avoid some potential conflicts.
I have followed everything youāve given me in Discord and here for creating the Hex shape but I am not getting the result you are. Here is what I have done in case you can spot a mistake I have overlooked.
So the issue here is the ConvertGridIndexToGridLocationNaive here, which you told me you could not find in your project, so you made your own (above). I sent you the wrong function there, as you need to use the one overridden in BP_GridManager_Hex, which looks like so:
https://i.imgur.com/MHI4NUP.png
but you should have access to this function already, which is very odd. It is one of the newer functions, so are you certain you are using the latest version of ATBTT (created for UE4.25)?
Is there a way to freely draw a path for moving instead of automatically reducing to the shortest path? For example, navigating through a series of land mines by snaking through them.
Iāve looked over the overwatch ability, but I want to customize it for general reactive abilities like stances. A dodge status effect where a unit moves out of the firing line / range of an attack to another tile. If tiles in range are free to move to, they avoid the attack, else theyāre hit. Or a counter status effect where a unit automatically deflects or destroys a projectile that enters an AOE, to defend other units.
As part of the counter mentioned above, is it possible to give abilities movement speed, collisions, nonlinear paths to interact with instead of just being a hitscan damage function? Speed could be compared with a unitās reflex value to check if they can dodge it. Collision could allow it to bounce off walls to hit out of sight units. Paths to avoid unit detection, or to hit multiple units in the path. The answer is probably spawning some projectile actor on ability execution, but then how do you allow the projectile to act within the turn manager?
Multiple actions per turn, where a unit can take as many actions as resources allow, and where they can be selected multiple times during player phase to take actions between other unitsā actions.
Yes, there are a few ways you could do this, depending on what youāre after. Takes a bit of work, but not a huge amount. Essentially you would have an ability that starts out much like BP_Ability_Move. However, when a tile is clicked, instead of calling on the unit to move you would store the Grid Indexes of the current displayed path in the ability. You would then clear the pathfinding array and call a new RunPathfinding function with the clicked tile as the start point. When you now click a new tile you would append the current path to the one previously generated and so on. Finally when the player has completed the path and signals the unit to move you would use MoveCustomPath on the unit, using the appended path array as input.
You can take the overwatch or trap examples as starting points for these sorts of interruptions. Interruptions are not that hard to do if each thing happening can be called as an independent action. You could use event dispatchers for this. For instance, you could have a dispatcher fire when a unit attacks another unit, which could be bound to an event on the target unit to trigger a counterattack. For interruptions when ending movement on a tile you already have the OnUnitEndMovement event dispatchers, which are called from the grid manager.
Interrupting in the middle of an ongoing action (as with overwatch during movement) is more tricky, and the current setups for this are admittedly a bit hacky (which is why they are in the experimental folder). Improving this is one of my main aims for the current update I am working on, so if you can focus on other systems for a while it might be a good idea to wait for the next update before delving heavily into action interruption stuff.
Sorry, Iām not really following this question. What is a hitscan damage function? There is already dodging and accuracy in the JungleRaid example map, but I take it you are talking about something else. Do you mean firing a physics based projectile or something like that? Could you explain a bit more?
Sure, that is more or less enabled already. Just make the units have several action points and donāt have bUseEndsTurn set to true in your abilities.
Is there a way to āsubscribeā to events that are fired. Iām only using this asset for the movement and cover aspects. Iām trying to figure out:
The tile the user has clicked on to signify the target tile to move to;
On tile enter and on tile exit events;
Once I have the destination tile, how do I extract cover info from that tile?
My focus is on AI programming, so Iām just getting used to UE4. I understand how to build on existing functionality, but not how to extract movement information. Any help would be great.
From what youāre describing I think you want to look into Event Dispatchers. You define an ED inside a blueprint, from which you can call it. Any other blueprint can bind events to this ED through a reference to the actor with the ED. From then on, whenever the ED is called, all bound events will also be called. These events can have inputs like any event, meaning you can pass data to multiple actors in this way.
If you look into the OnActorEnterTileSimulate (and an equivelent Exit event) you can see how I have set this up (and that also goes towards answering your second question.
Data in tiles is stored within TMap variables. Most of these are in BP_GridManager. You have GridLocations, where you can find the location of a tile by inputting the grid index, for instance. The cover TMap follows the same principle, but it resides with in the cover system component. You can get the cover data of a tile through a grid index.
Yes, a projectile that can move independently and interact with the environment. I was thinking that it could be a temporary BP_Unit spawned with a unique projectile AI given its own turn. Though I wonder if it wouldnāt get too expensive for my idea of a bullet hell like attack where dozens of projectiles could be on screen at once.
By hitscan damage, I was referring to simply doing damage to a selected target on ability activation. I want my attacks to have a physical presence in the world so they can be affected in numerous ways. Like a laser that can bounce off certain surfaces or be reflected by units themselves to hit out of the way targets. Or a bomb that can be kicked into small holes or moved around by environmental effects like wind or slopes. These can be done relatively easily in real-time, but Iām having difficulty fitting them into ATBTT. Of course, thereās a difference between an instantaneous attack like a laser, and a persistent actor like a bomb so I imagine theyāll have completely separate implementations.
Also a couple more questions:
Is it possible to do something like Shining Force 3 where you can freely move your character until the edge of their movement range, and on starting an action, automatically slide the character to the middle of the closest tile? Iām considering combining this with the free path idea, where a unit subtracts from its move variable with each step and the blue movement tiles shrink in response to limit the edge movement. Like a stamina system in grid form.
Body parts and unit height. Possibly representing a unit with a cube volume instead of a 2d tile so that their head, body, arms, and legs can be hit separately according to the height and direction of an attack. This would include crouching and laying down to decrease a unitās height at the expense of movement. Iām considering separate actor components for various body types like humanoid, four-legged, or vehicle, and height should be as simple as adding a variable to BP_Unit that can be modified based on stance and level height, that compares to a height value for each attack ability. Ideally you should be able to crouch underneath an attack, or turn to take damage to another body part that has enough health to survive.
Hybrid real-time, turn-based. Iāve been playing around with the experimental hybrid map, and itās pretty much perfect for something like Underrail that Iāve had in mind. Real-time movement out-of-battle and in stealth, while still being able to use attack abilities to initiate combat. As well as a seamless transition back to real-time when enemies are no longer aware of where you are. Would you recommend building on top of the hybrid example, or should I hold off until itās out of experimental? It seems easy enough to begin and end turn based mode, though Iām not clear on how youāre anchoring the units to the center of a tile on begin turn based mode. That is, how would real-time patrolling enemies move to their appropriate tile when turn-based mode begins?
Sorry if Iāve rambled on, itās just that ATBTT is such an amazing base to work with, that I just canāt stop thinking about what to add and expand. Iām sure many people are thankful that youāve continued to work on it for so long while still being so active with the community. I certainly am.
not sure if is a bug but if is not a bug it seem very weird to leave it like that, so here the problem. . ( there is no custom bp make)
full hp 100
in the BP unit anim, there a damage, let say we set it 50
in the bp ability moveattack , i turn off the use unit attributes , and set the damage, let say we set it 10
the unit atk 2 time , there is no death animation. and say the game is over.
if is the other way around that
in the BP unit anim, there a damage, let say we set it 10
in the bp ability moveattack , i turn off the use unit attributes , and set the damage, let say we set it 50
the unit atk 2 time , and death animation play and the unit is gone, but the game is not over. so the game is stuck.
Hello there, I posted the runtime question on the marketplace the other day.
I was wondering if the tile system could be used essentially for a base builder sort of game (like clash of clans). players would need to ābuyā walls, and other tiles to drag into their levels. in essence itād probably need to be saved as an array or something that populates on startup of the level. gameplay would be non-simultaneous. there wouldnāt be any turn-based action going on while walls are being placed. the concern is really being able to set and save walls outside of the editor and if itād function appropriately.
This part still eludes me. I see that FCover is a struct and that FCoverArray is simply an array of these structs. FCover, however, is composed of an int and a float. I can also see that the value for full cover is 0.5 and itās 0.25 for half cover. I still donāt see what that float references. Iād assume that each edge of a tile is assigned a value but I canāt get further. Can you tell me how the data is stored, and is the data in the edges, or the tile itself? Thanks for all of your help so far. If Iām asking too much, please say so.
Yes, sounds like something that could be handled by a unit. Having dozens on the screen at once should not be a problem. Units donāt do anything on tick and are pretty inexpensive.
The implementations for these things will vary a lot from case to case, I believe. If you could describe one of them in more detail I will try to point you in the right direction.
Sounds a bit like the hybrid example map to me. You could convert the location of the unit to a grid index to check that it stays within the bounds and push it back if not, or you could maybe spawn an invisible wall at the edges of the movable area (a bit more difficult). I have not played Shining Force, so speculating a bit here.
From the start of your question am I right in assuming you are using sprites for your units? Is it top down similar to the 2D example map? That makes many things more simple compared to a 3D game, if that is what you are going for.
As for the rest of the question there is a lot to unpack. Nothing here seems like it would not be achievable, but it all depends a lot on the rest of your game.
The hybrid example is an okay base, but in this particular case you might consider waiting to implement this part of your game. That things are in experimental does not necessarily (or even usually) mean that I will be moving them to the base toolkit at any point. They are mainly there to provide examples of ways to implement various features, but in a non-commital way, where I might scrap things or make heavy changes between updates. For the hybrid stuff specifically, though, I am making some pretty big improvements in the next update. Primarily in letting people use characters instread of actors to represent units.
I like your enthusiasm, and understand that you want to get a rough picture of what you can do while you are planning out your game. When you have a clearer idea, though, I recommend homing in on specific features that can take you step by step towards your vision. At that point it will be easier for me to give you more definitive answers and suggestions.
Yeah, this is a bug. The action system and game logic seem to get different messages of damage taken when the ability is set up in this way. Thanks for making me aware of it. Seems like I set it up incorrectly in the ExecuteAbility function of BP_Ability_MoveAttack. The action queue gets the damage from the abilityās damage variable, which is set to be the damage variable of the unit if bUseUnitAttributes is true, but keeps its default value is not. Meanwhile the TakeDamage node gets the damage value directly from the unit, so it always uses the unitās value no matter the value of bUseUnitAttributes. If you change the function like so it should fix the issue:
https://i.imgur.com/QQSFOt6.png
Sorry about the bug. Iāll make sure to fix it in the next update.
The game you are making is a bit different from what it is designed for, but adding tiles and walls during gameplay is certainly possible. Tile actors spawned during the game will add their edges to the grid, but with some limitations. They can remove edges (blocking movement) or increase movement cost, but adding tiles will not reconnect tiles or reduce movement cost. But there are many ways to achieve this end. The simplest and most versatile method is to use the toolkitās procedural system for finding walls (check out the third tutorial in the ābasicsā series for an explanation) combined with the UpdateTilesInRange function. This function will get all tiles in a specified area and update the edges and locations of tiles in that area based on the collision properties of the meshes placed there. These can be any old mesh or actor that can block collision channels, which you can drag onto the scene through any means that you want.
Yeah, it is not very intuitive. The various values mean the following: The key represents the tile that āhasā cover, meaning if a unit stands on this tile the unit might have a reduced chance of being hit by attacks depending on the data in the value on that key. The value contains arrays of cover structs. These structs hold two values. The integer holds the grid index of the tile that a tile has cover towards. The float holds the percent accuracy reduction the cover in this direction provides. This was a bit tricky to describe in words. Letās try a screenshot:
https://i.imgur.com/54cvyyt.png
The cover here is between tile 1001 and 1002. It is low, so it would provide āhalf coverā or a 25% reduction in accuracy when attacking units behind the cover.
In the GridCoverTiles TMap in the cover component we would find just two keys, 1001 and 1002 (since those are the only tiles on our grid with cover). The value of key 1001 would be an array of one item (since we have cover in just one direction), and this item would be a cover struct with an integer value of 1002 and a float value of 0.25. Iām sure you have more questions, but does this part make sense?
I understand the design, but I donāt understand how to use it. Iām guessing that there a function that would help, but there are a LOT of functions, so itās a little like trying to find a needle in a haystack,