Hey all, after looking into the big unit stuff for @jh0620 I realized that I’d forgotted to fix something in the newest update, causing marker meshes to not resize and reposition appropriately for big units (this is unrelated to @jh0620’s reported issue, which I have not been able to replicate). I also tested out a few other things and realized I was a bit quick to send out the last update without doing some more testing. Just some very minor changes related to the example maps (Hydra’s Lair and JungleRaid). See my Trello for details (see the v.2.31 card). I have sent a new update to Epic already.
Here are the steps:
Copy the PostProcessVolume from the 2D map
In whatever ability you are using select the TileMarkers you want to render in custom depth. Set their material to something non-translucent (DefaultMaterial, for instance) and in its rendering settings set RenderInMainPass to false and RenderCustomDepth to true.
That should do it. Note that it can often look a bit wonky in a 3D-world, though, but it depends a lot on your levels.
I’ve tried this method a couple times and despite the output log verifying a random index from said array per iteration on the forloop, the entire grid’s tiles still instantiate from one sole element from the array. Any idea why this may be?
Thank you for responding. I hope to achieve multiple effects such as allowing a unit to move again, giving them an ability and/or to do damage around them. Also when tested out my current panels it should give them an ability however it seem that instead of the unit’s hitbox registering it hitting the camera hitbox instead for passing on an ability.
You have not fully understood how instanced static meshes work. When you create an instanced static mesh component, all instances tied to that component must use the same mesh. You are changing the mesh of the component, which causes all instances tied to that component to change. If you want different tiles you need multiple different components (one for each mesh). You can use multiple AddInstancedStaticMeshComponent nodes, set the static mesh of each and store the output (of AddInstanced…) in an array of instanced static mesh components. Perhaps you have three instanced (grass, dirt, stone). When you want to add a stone tile you would get element 3 from the instanced static mesh component array and add an instance of this component to the world.
I recommend checking out the 2D example (in the Maps/2D folder). In this map there are examples of picking up weapons, healing potions and trigger plates.
Hello, been following this since i purchased it some time ago. I like that it keeps getting updates and improvements. I would like to make a hex grid that is not rectangular in shape, but “hexagonal”, that is, it extends out a radius of hexes from a central hex. Does ATBTT currently support this and I don’t see it? If not, is this something that is doable with minor tinkering to the hex grid BP?
Hey Luthervian, you could do this by using a rectangular grid and just not spawning tiles on the corner locations. This is what I have suggested before, but I had some free time today, so I threw together something a bit more elegant.
First in BP_GridManager_Hex I set GridSizeY to always equal GridSizeY, as this would always be true for a hexagonal shaped grid:
Next, in the CreateGridLocations function, I use GetIndexesInRange (which is overridden to use hex math in BP_GridManager_Hex) to get grid locations in a hexagonal shape. I use some simple math to find the center and radius of the hex grid (note that I’m just replacing the code for a flat grid in the example below, but the same should work for the heightmap setup in the same function):
Next, in SpawnTileGrid I spawn the tile instances using the output of CreateGridLocations:
Finally, I make sure CreateGridLocations is run before SpawnTileGrid in BP_GridManager’s Construction Script:
Hey Knut - still unable to figure out the initiative problem but we got something different to bother you with :(
For some reasons the walk path spline and the cover markers when hovering over tiles are only displayed when holding the right mouse button - have you ever experienced something like this?
What was the result of my last suggestion for the turn order stuff? What is the last action printed?
For the right mouse button stuff, what you’re seeing is probably the suggested path. In MoveAttack and some other abilities I added the option to display a suggested path (using the AI functionality of that ability). So I guess that part is working as intended, but you’ve somehow broken something in the regular hover functionality? I’d recommend printing strings along the hover execution chain (starting in the player controller, through Ability_Base, Ability and the specific ability you are using to see where it breaks.
Thanks for your reply - will check out your hints tomorrow - one more issue we found: AI controlled units somehow start their attack animations way too early - during the first moments of movement towards player faction units - seems like we broke a lot here
I’ve been I’ve purchased your plugin and I have been trying to go through the tutorials and the example maps but I am having a little trouble. First off I can’t find the map Bunkers or the Heightmap_example folder. Also in the Jungle Raid demo map, when I play it, no UI shows up on the screen and once I move the first unit, all the units just start moving themselves in a never ending sequence, even my team. What am I doing wrong?
1.the map Bunkers or the Heightmap_example [FONT=Helvetica,Arial,Verdana,sans-serif]is not in new build, only in the older version .
2. in the the Jungle Raid demo map if I remember correctly, I think the player on the map all set as aicontrolled that’s way they are moving by themselves - just unchecked the aicontrolled box in each of the player you want to control.
hope its help
Hey samtsion, you’re not doing anything wrong, as both of these things are not in the current version. The bunkers map was removed several updates ago as the JungleRaid map demonstrates click through platforms as well, so I felt it was a bit redundant.
The initiative bar was disabled in JungleRaid in the most recent update. This is because I made changes to the initiative system and felt an initiative bar does not make much sense for a game set up with initiative grouped into factions. If you want to change that map back to how it was before, change the game mode in JungleRaid to BP_ATBTT_Initiative and set bUseInitiativeBar in BP_GridManager to true.
The player units being controlled by the AI is a mistake on my end. I like to test for bugs by watching combat between AI teams when I make a new version. I just forgot to turn it back to normal. I sent a new update to Epic a couple of days ago where this was fixed. Just select the player unit and set bAiControlled to false for the same result.
Edit: Thanks, [USER=“641905”]leo bar[/USER]. Seems we started writing at the same time.
Lately, I’ve had some time and made some changes to the toolkit. These changes led me to a clear understanding that I needed to split some of the functions(SetupGridArrays and RunPathfinding) to work over few ticks. (Especially after I tested the system on computers much less powerful than mine - the bottlenecks get a lot more emphasis).
Since I don’t want to use c++(It just makes me very sad to use it :)) I looked and saw you have some macro for this kind of things (like the ForLoopPerTick ect…). The problem is that I probably couldn’t quite use these macros correctly and couldn’t get the results (the truth is that I mostly got the computer stuck :).
So what I really need is your Guidance. I understand this is a little abstract and big question and not very urgent either, so I would love to have some directions when you have time.
Thank you for your answer. I got the latest version(v2.2) and tested it, but the big unit still has a problem. After placing the Grid Manager at the level, you changed the value of the Diagonal Movement variable value to false. After that, the range of movement of the unit is not displayed. The result is the first screen shot.
Identifying the cause of the problem does not proceed with the corresponding node of the second screen shot in GridManager’s SearchAndJacentTilesBig function.
Afterwards, we modified the function like the third screen shot, and it comes out of the wrong way. The cost of obstacles within the range of travel, such as a fourth screen shot, is not taken into account.
I want the same pathfinding as the fifth screen shot. What should I do?
I am having a little trouble finding something to help me understand how this toolkit works, I have watched the tutorial series but I get the sense that some of the older ones do not reflect all of the changes in the toolkit.
I’ve been reading through this thread, but have been unable to find what I need so I figured I’d ask here. If I missed something obvious, I apologize and hope that you can point me to where it was answered.
My question is “where are the rules that dictate how the game is played are?” I know that is cryptic so let me explain: I have found the parts that handle actions, movement, things like that. But I have been unable to find the part that manages “here is how damage from an attack from player A to player B effects player B’s health”.
What I expected to find is perhaps an Attack_Action, Move_Action, that has some logic in it that says how this is done.
If that isn’t clear enough, let me try an example. I would like to modify the game so that a player can move or attack in one turn. They cannot do both, they have to choose. Additionally, I would like to make attacks have a chance to miss.
I hope I was clear enough, and I hope this isn’t too obvious for you all.
Hey Leo, too bad you’re seeing performance issues. I’m curious to know about what it took to run into the bottlenecks. What sort of hardware are you testing at, what functions seem to be too slow and what paramaters are you feeding into them (move ranges etc.)? The macros I’ve made for splitting stuff up into multiple ticks were mostly made early in the toolkit’s creation. While I was learning blueprints I struggled a lot with performance, and they seemed like a good solution. Later on I was able to speed the hungriest functions up significantly, to the point I felt delayed loop functions were not needed for most types of turn based strategy games. There are of course exceptions to this (especially if you want to generate a new edge map during gameplay), but I hope what I have is sufficient for most peoples’ purposes.
Also be aware that Unreal Engine runs much slower during Play-In-Editor. Play standalone is quicker, playing a packaged developer build is a lot faster and a shipping build is faster still. I’d try your game on a shipping build before prematurely optimizing if you have not done so yet.
All that being said, if you still need to improve performance and you’re allergic to C++, splitting up heavy functions over multiple ticks is certainly a solution. I recommend using the macros I’ve included ending in “_Delayed”,as these are newer and simpler to work with. They can for the most part be used just like regular loop macros, only you need to specify how many iterations you want per tick. The issue with them is that macros with delays cannot be included in functions, so if you want to use a slow loop in say RunPathfinding you’ll need to create a new macro where you copy-paste over all of the RunPathfinding code and replace the relevant loop(s) with the delayed macro.
Another problems is that macros unfortunately cannot be called from other blueprints. You can solve this by tying a macro to an event in BP_GridManager’s event graph. If so you’ll need to make sure the macro has run through before continuing the execution chain on whatever blueprint you called it from. This can be done with event dispatchers (see examples of how to do this in my blueprints. For instance the AnimateAction nodes in BP_Ability_Laser).
Hope that helps!
No problem. It took me a while to understand ISMs when I started out as well. Very useful thing to know about the engine, though. Especially in the old days when UE4 did not do all the fancy mesh instantiation under the hood.
So let me see if I understand this correctly: You want to have big units that cannot move diagonally? As you found out the big unit setup code does not work if bDiagonalMovement in BP_GridManager is false. However, you can get the same result by modifying the pathfinding code. In SearchAndAddAdjacentTiles_Big add the following to prevent diagonal movement:
This seems to work fine on my end:
I hope this gives you the result you want.
Hey angelbane, I’m sorry that my old tutorials can be a bit confusing when using the new toolkit. I’m making new ones and I have several fairly new tutorials that are up to date, but there is still loads more to make when I get the time. For now feel free to ask here about anything that confuses you. No need to apologize as this is what the support thread is for, and I’m happy to help
When you ask about how the rules of the game are dictated, for the most part that is done in the various abilities and in BP_TurnManager. These blueprints are made to be highly modular (this includes the turn manager in the latest update) to make changing the rules of your game relatively painless.
The turn manager starts the game and has events and functions for starting and ending the turns of units etc. Abilities are what the player uses to interact with the game (the player controller sends input to the abilities which interpret the input and decide what to do).
To give an example related to what you’re asking, when a unit ends its turn it signals the turn manager, which (by default) deselects this unit and selects a new unit. SelectActor is run for this unit, which causes it to activate an ability, telling the player controller of the player that owns this unit to do this. The player controller sets this ability as the active ability and runs ActivateAbility (which often runs code for finding and displaying relevant targets for that ability). From now on, mouse hover events and clicks are taken by the player controller and funneled into the active ability, running first through the BP_AbilityBase and BP_Ability code (unless this is overriden in the ability itself) and finally in the main ability.
In BP_Ability_MoveAttack, for instance, the cascade of events following a click ends up triggering EventServerInteract, which then checks if the clicked tile contains a unit, which it uses to decide if the active unit should move, attack an enemy, swap to another unit or do nothing. For damage, in this ability if an enemy in range is clicked, it runs the ExecuteAbility function, which for BP_Ability_MoveAttack results in calling the TakeDamage event on the enemy unit (causing its CurrentHealth variable to decrease) and queue the Attack action, causing the active unit to animate an attack and animate the enemy’s health bar depleting (Which is done in EventAnimateAction in BP_Ability_MoveAttack, as called from the action manager blueprint).
To answer your specific questions, if you want your units to be able to either attack or move, but not both, you can change BP_Ability_MoveAttack so that moving sets the units Action Points to 0 (instead of subtracting 1, as is currently done). For having a miss chance, I recommend looking at how I did this in BP_Ability_Laser.
I recommend checking out my tutorials on the action system and ability system, as they are pretty much up to date and covers important topics needed to understand the toolkit. The turn manager videos might also be useful, but these are unfortunately outdated as of the last update, where I made some serious changes to the turn manager code. They might still be informative, though.
I hope you learned something from my description, and let me know if you have any further questions.
all my testing is done in the standalone mode or in a packaged developer build
It is important for me to emphasize that I am really happy with optimization of the toolkit as it is, its perfectly fine. On a reasonable computer everything ran wonderfully. The reasons I wanted to make the changes and use loop per tick are:
I deliberately tested my project (at least what I have done so far) on a much weaker computer than mine ( intel core 2 duo e4700 2.6 GHz ), just wanted to test the limit of the hardware people can use.It’s important to note that on this processor too, everything ran quite smoothly except for a little bit of delay when the run pathfinding was running (I also have a range of 14 tiles).
The second reason is because my tiles are smaller and have quite large maps and I get into the problem of max loop iteration count. on the weaker computer the problem is of course more serious.
The solution to the problem is easy (changing the number of the loop iretation in the project settings ) But I do not feel so confident that the values there are so high (they put this limitation to avoid potential problems)… Apparently I’m just too strict but I still wanted to see if I could solve both of those things. I will try what you have suggested.
again if there is one thing I learned during this testing is that blueprint and your toolkit can handle this type of game very well (Contrary to what many people think or claim )