Hey Mewbits, glad to have you back Big units were originally not planned for 1.8, but while Iām waiting for UE4.19 Iāve been working on it, so it will be included in some form. I might mark it as experimental dependent on how much I get done. Iām focusing on getting it to work with square grids first, but the solution Iāve found is quite generic and should be relatively easy to convert to hex grids. Not sure if Iāll have big units on hex grids ready for UE4.19, but if so Iād make a tinyupdate later to add hex grid support.
Looking forward to it.
As to the square grid - is there a quick way to make attack range not diamond-shaped, but cross-shaped (exclude diagonal tiles completely)? I think I found a needed function in grid manager (get indexes in range I think) but unfortunately Iām having a hard time following calculations.
You could code a new pattern similarly to how Iāve done it in the Get Indexes In Range function, but you can also do something quicker and lazier. Take the output of GetIndexesInRange and loop through it. Compare the index of each arrray element with the origin index of the GetIndexes function. If either (IndexX % GridSizeX) == (IndexY % GridSizeX) or (IndexX / GridSizeX) == (IndexY / GridSizeX) keep it. This should give you a cross-shaped pattern.
Itās working, thanks! Although seems a little tricky solution in my case as I may need more complex custom attack patterns in the future. So I have to learn how it is calculated myself.
@ClaimedInfinity : Finding algorithms for patterns on the grid requires some thought, but it is not terribly difficult, especially for square grids. Try drawing it out on graph paper or in excel first. Remember that for square grids, adjacent tiles are index +/- 1 for right and left tiles and -/+ GridSizeX for tiles above and below. Because of this, Index % GridSizeX gives you the column and Index / GridSizeX gives you the row of an index. Keep this in mind, and remember to add checks to prevent the pattern from going outside the grid, and you will be able to create many different patterns with just a moderate amount of work.
Hey ,
Iāve been trying to experiment with changing edge costs at runtime. Basically what Iād like to accomplish is have the player stuck in a room and unable to leave until they click on a door. Once the door is clicked it calls āGet Hit Tile Location and Indexā goes to āSet Edge Costsā then its my understanding we would need to rerun the āPathfindingā event, all referencing the grid manager. Iāve only dabbled in unreal on and off for some time and I just purchased the toolkit a week or so ago. Its very possible Iām misunderstanding how these functions interact with each other. Any input you might be able to offer would be greatly appreciated.
Hi Gameran, youāre thinking along the right lines. Iāve thrown together a quick and dirty solution which should be enough to get you started. I first duplicated TileCloseThinWall_E, called it Tile_Door_East and colored it green + scaled it a bit (for visuals). I then changed the collision settings of its mesh to block everything but PathTrace (so it registers click events, but ignores the trace in the Player controller that uses PathTrace).
Then I added the following to the doorās event graph:
https://i.imgur.com/ZX7hn8M.png
Here Iām using UE4ās built-in OnClicked event to register the player clicking on the door.
I then use the AddEdgeBothWays function in BP_GridManager to connect the tiles on either side of the door. Since this door is a copy of the east wall actor, which during setup removes its eastern edge I want to re-add this edge. In the toolkit east is +1, west -1, north - GridSizeX and south + GridSizeX. You would likely want to set up a less hard-coded implementation in your game, but this works fine for a demonstration.
Then I move the mesh out of the way with a timeline. This does not pathfinding, but is just for looks. You would want a more proper animation, of course.
Lastly I reactivate the current unit. Since the current unit was originally activated before we altered the edge array, the pathfinding it ran was using the old edges. We want it to take the altered edges (and change in visibility now that the wall has moved, for that matter) into account.
Hope this helps you implement doors how you intended. Like I said, this was a very quick and dirty solution, but if you understand the steps you should be able to build on it and make something better. The first step would probably be to move this to being part of the click event in the player controller, so you can have more control over when it activates. Best of luck, and let me know if you need any more help.
First, the toolkit is awesome and exactly what my team was looking for. As a novice to UE4 it gives my team a jump on transferring a real life TB game model into a mobile version as well for cross promotion. With that said, is there any possibility of tutorial on player HUD design in the future? When we run the HUD, it compiles correctly but does not show on the progress bars. We are assuming it is due to the casting to pawns, and not actually finding the pawns through the grid system. We noticed you used billboards instead of traditional HUDs, which may be the reason why this was done. Any insight would be appreciated as we continue our game progress. Thanks again for this system and the many tutorials you have provided.
@jeff_northrop : Happy to hear the toolkit has been helpful to your team! UI and HUD is not on the top of my list of planned tutorials, but Iāll be happy to help you with your specific problem. Iām not sure if I completely understand your question, though. Do you mean the health bars when you say progress bars? They do appear in the default toolkit, so what have you changed so that they disappear? I use a billboard so I do not have to update the health bar facing every tick, but instead exploit the fact that billboards always face the camera. If it helps you can take a look at the VR example map, where I use meshes instead of billboards, since billboards to not work properly in VR.
Hi @, thank you for the super awesome toolkit! I have one question, if I want to make a basement level in another map, how do I preserve the pawns on previous maps? For now I only store and load data for each map. But if possible I want to make it seamless with level stream for UI and pawns consistency. Sort of like Divinity: Original Sins.
@drpsyko : Depends a bit on exactly what you want to achieve. There ar quick and hacky ways to achieve some of this stuff, but depending on what you want you may need to make larger changes. I plan to add the option to have multiple grid managers in the future, but until then there are some other things you can do.
So if I understand your question correctly, youāre not asking how to preserve say the heatlh and other attributes of units across maps, but rather having something like a basement in a level where combat can go on simultaneously while it is also happening on the floor above, with unit turns hopping back and forth between the levels as they are activated. Is this a correct interpretation?
If so, here is a quick hack you can try. Set Heightmap to multilevel in the Grid Manager. Set Max Grid Height to something really high (say 10000). Then create your various levels on top of one another, making sure that the distance between them is higher than the maximum zoom distance set up in your grid camera.
Already all of these layers should function as separate grids, though you can always add edges to allow movement between them. Now what you need to do is make sure layers below cannot be seen when on levels above. You can do this simply by having a landscape/plane mesh between them or you can use cull distance volumes, object hierarchies with visibility set through blueprints or whatever.
Last thing you need to do is prevent the camera from moving smoothly when switching between units on different layers and instead jump instantly. Look in the event graph of grid camera in the comment box āFollow the current active unit unless the player is currently panning the cameraā. Here you can see I use lerps for smooth movements. Promote the lerp alpha to a variable and set it to 1 whenever you switch between units on different levels (you can do this by comparing the height of the previous and the next unit in the ChooseNextPawn event in ATBTT_GameMode).
Seems to work pretty well for Divinity-style instant switching between multiple grids. A bit hacky, sure, but looks good in game.
Just noticed that the number of marketplace ratings for the toolkit just reached 100! Thanks to everyone who rated and to everyone making great stuff with ATBTT
t is now almost exactly three years since I released the toolkit and I love working on it as much as ever. Still lots of features to add, and Iām looking looking forward to UE4.19 when Iāll release my next, big update!
Thanks for the quick response and sorry for my late one. What you suggested worked perfectly. Iām currently working on making that coding a bit more dynamic by reading the edge the door is on then updating it accordingly.
Yes, that is exactly what I meant! I was thinking that maybe I could make the bp_manager ref unique to each stream level. But really need to unload most of the stuff from ATTBTT gamemode to level, and add arrays for each pawn per map. Havenāt tried it yet though, as Iām guessing it would break a lot of pawn turns
For now Iāll use both method - load/save state and multi-level to compensate big map. Thanks, and really looking forward for the multi-grid manager!
Hello again @, I need a bit of help with a couple of things. These are both probably very simple things that I donāt know how to do so please excuse my ignorance. I tried to see if these had been answered before with a brief search but didnt find much. How is the camera restriction controlled? Is it based on the size of the grid? Just curious how to control that for different styles of level. Also how do I set it up so that the player can press an assigned key for selecting a particular character instead of having to click them? It would be a little bit more convenient for the number of units I intend on using.
The wait for 4.19 is getting tough!
Ok, great! That is how you definately should do things. Best of luck and let me know if you need any additional assistance.
Great, sounds pretty reasonable. I would generally avoid using level blueprints for functionality that will be used by most levels, though, if that is what you are suggesting. Youāll have to experiment, and Iāll be interested in hearing what solution ends up working for you.
No worries, there is a lot of stuff to look throuigh!
If you look at the event graph of you will see in the Zoom comment box that zoom distance is capped by the ZoomRoof and ZooFloor variables, while panning is controlled by the CheckOuterBounds function. This function is informed by the size of the grid.
For your second question take a look in ATBTT_PlayerController. In the comment box āIf CanPlayerSwitchPawns is true and a pawn that has not acted is click, switch to this pawnā youāll see how to set up switching to a friendly unit. You can duplicate this code and replace the reference to the unit on the clicked tile to any other unit. You could for instance get the unit from Index 1 (next unit) of the InitiativeOrderArray in the game mode, check that the faction is the same as the current unit and if so, switch to that unit.
Donāt worry, itās close
Thank you so much for supporting this toolkit so heavily. Noobs like myself greatly appreciate it!
Taking what Iāve learned so far Iāve started a new project and intend on using the Jungle Raid blueprints/pawns as they already have the weapons and skill setup, and incorporate that into other levels as I make them with my own meshes and skeletons. I would like to keep this project as organized as possible within the folders so Iām curious how I would go about replicating those things into another folder without losing any targeting for code, meshes, etc. For example, what I would like to do is make a duplicate of the Medic class and later replace the skeleton and mesh. What all would I need to copy / edit into the new folder to make this duplicate work properly?
Edit : If this is unnecessary and there is a better workflow for what Iām trying to do Iām completely open to it. Learning as I go.
Edit 2 : I messed around with the files for a while and realized that there isnt any problem caused as long as I do all of the file moving within Unreal and not in the folders themselves. Basically I just tucked ATBTT away into a parent folder called āengineā with my other engine based things and everything is still working fine.
Problem solved, disregard this message.
@OperatorCrux : Sorry for taking so long to reply, but Iām glad you figured it out. After moving stuff around I recommend right clicking the affected folders and selecting clean up redirects (or something similar. cannot check right now) to make sure you do not run into any errors from moving stuff around.