I attached a picture of a simple setup I’d like to realise as a starting point, where the key aspects are as follows:
The player can only interact with creatures in his current area (marked in light grey), he can see the adjacent areas he could travel to, but not what’s going on inside of them (I guess that could be realised with something like walls and doors or sth like that).
Inside an area, the player has a certain line of sight (marked green) and a certain movement range (marked in teal) and he can’t see what’s going on outside his line of sight.
When the player has no movement/action points left, the turn ends automatically - enemies/wildlife in the current area move around (shouldn’t take too long), then the player can start moving again (similar to the movement in Cardinal Quest 2).
When the player transitions to a different area, let’s say to the one in the top right, the previous area should grey out and the one on the bottom blacked out (it’s no longer adjacent to the area the player is currently in, this might change if the player is drawing a map or has a follower who is ordered to keep track). Areas that are adjacent to the new area get revealed.
When the player has recruited allies they automatically move with him, but can’t be controlled unless the player uses a specific skill and takes control of one or more allied units.
While the player takes control of an allied unit, he can create a loop (e.g. patrol between point A and B), which will then be followed by this unit unless another order is given or an enemy moves into his line of sight.
I believe your toolkit would prove quite useful for realising some of these points, are there certain limitations I should be aware of?
I’m not sure if this has been noticed before, but I found an issue that makes pawns pathfind ontop of each other.
Steps to reproduce:
Fresh Project
Enable show all visible tiles in friendly pawns
Disable camera following active unit (So that you can keep your mouse on a tile)
You can’t see my cursor in the video but what I’m doing is not moving it off the unit im attacking, and simply clicking it again as each new pawn becomes active. In the second half I move it one tile up and then back for the second unit, and then leave it on the enemy and click for the third.
Thanks a lot for reporting the bug, including the repro-steps, Selentic! I guess this bug has gone unreported for so long because it has hidden by the auto-panning camera. It seems the cause of the issue is that the tick event in ATBTT_PlayerController fires after a new unit is activated, but before pathfinding is done calculating, which is done over a couple of ticks by default when using Find All Possible Visible Tiles. Finding the reason for the bug was difficult, but solving it is very easy. In the Begin Unit Turn comment box in ATBTT_PlayerController move the node setting Current Tile Hover to -1 from at the very start of Activate Unit to the very end (at the far right, after Disable Player Controller Input is set to false):
It may be worth noting that the issue is still present if the modification for having no unit selected (Atleast I’m pretty sure this is the cause, since it doesn’t occur when I revert this change) has been made to the toolkit. If you have the time to check that out too that’d be greatly appreciated.
Additionally is there a way to tell the game to select a specific unit? I’d like to pursue having a dummy player unit to be activated when no selection is made, since leaving it empty spits out a few warnings and causes some weird issues like the one mentioned above.
I attached a picture of a simple setup I’d like to realise as a starting point, where the key aspects are as follows:
The player can only interact with creatures in his current area (marked in light grey), he can see the adjacent areas he could travel to, but not what’s going on inside of them (I guess that could be realised with something like walls and doors or sth like that).
Inside an area, the player has a certain line of sight (marked green) and a certain movement range (marked in teal) and he can’t see what’s going on outside his line of sight.
When the player has no movement/action points left, the turn ends automatically - enemies/wildlife in the current area move around (shouldn’t take too long), then the player can start moving again (similar to the movement in Cardinal Quest 2).
When the player transitions to a different area, let’s say to the one in the top right, the previous area should grey out and the one on the bottom blacked out (it’s no longer adjacent to the area the player is currently in, this might change if the player is drawing a map or has a follower who is ordered to keep track). Areas that are adjacent to the new area get revealed.
When the player has recruited allies they automatically move with him, but can’t be controlled unless the player uses a specific skill and takes control of one or more allied units.
While the player takes control of an allied unit, he can create a loop (e.g. patrol between point A and B), which will then be followed by this unit unless another order is given or an enemy moves into his line of sight.
I believe your toolkit would prove quite useful for realising some of these points, are there certain limitations I should be aware of?
I’m not sure how the issue can persist if you use that modification, because you would need to move the mouse to select a new unit, which would prevent the bug from occurring. However if you add new ways of selecting units without clicking them it would of course cause a problem. Setting the Current Tile Hover of ATBTT_PlayerController to -1 at the end of the game mode (where Activate Unit is normally called in the default toolkit) should probably do the trick.
As for selecting a specific unit you can use the same nodes that are used in the If CanPlayerSwitchPawns is true and a pawn that has not acted is click, switch to this pawn comment box in the Event Graph of ATBTT_PlayerController, just inputting whatever unit you want instead of getting the unit at the index equal to Clicked Tile from the Pawn Array.
Hey Kingdave, I’m glad you managed to get access to the forums. I have already sent you the answer by e-mail which you have replied to, but I’ll repeat my answer here in case it is useful for any other people using the toolkit:
You have some pretty interesting concepts, but it will take a lot of tweaking on your part to get everything working the way you want it. Everything you mention should be achievable, but it all depends on your implementation. I’ll tackle your questions one by one.
Should be easy to do. When the player clicks a tile, check its index and see if it in the allowed area/zone. If it isn’t ignore the input. You would probably want a new array that stores which sub-grid each tile belongs to.
Check my 2D game example for one way to handle line of sight. It should be pretty close to what you’re looking for.
Ending the turn automatically is as easy as running the End Turn event in the player controller.
If you have stored which tile belongs to which sub-grid this should not be too hard. You would loop through the grid array and hide each tile in the appropriate subgrid. Though if the areas are always the same size (as is the case in your screenshot) it would be much more performant to cover the entire area by one large, hexagonal mesh. You would need to find a way to figure out how many zones are between the current zone of the player and the other zones. You could run a function each time the player enters a new zone, check the distance from the current zone to the center of each other zone (you could store these locations beforehand) and cover them up if they are two zones away.
When you take control of your allies this would work just like the toolkit does currently, so that should be relatively easy. As for following the current player it will be a bit more tricky, but doable. When a unit moves it follows an array of vectors called the Path Vector Array. You would need to set it up so that the allies are always moving towards the previous vector in the array as compare to the player unit.
A bit tricky, and I’m not sure if I completely understand you . Are they moving at the same time as the player? You would need to store the path of these units in a separate array and move them along this path in parallel with the player moving along his path.
Like I said, I think all of these things should be doable. I’m wondering how large you want the maps to be in total, though (all zones). The size of the map in your screenshot should be fine, but if you go to more than twice that you’d probably want to implement some sort of level loading from an array, which would take a lot of work to implement. Is the game 2D or 3D by the way? This has great influence on the ease of hiding tiles.
The difficulty of all the things you have asked does of course depend on your skill with UE4 blueprints and ATBTT. You should be quite comfortable with both before tackling most of these, though I’ll do my best to help you along the way.
I hope that helps clear up most of your questions. Let me know if you want me to clear anything up.
Heh, good one I’m horrible at giving time estimates, so I don’t think it would do much good. Work is pretty time consuming and unpredictable at the moment, which makes it hard to assess how much time I’ll have for gamedev. It could take a few weeks or a few of months. I’ve also been using Unreal Engine at work lately which, while fun, has made it less tempting to keep working in UE4 when returning home. I’m done with that work for the moment, though, and I now have fMRI brain recordings of people watching something I made in UE4 which is neat
Instead of giving an exact estimate I can describe some of what I’ve done so far and what I’m still planning to do. I have created systems for cover and accuracy, for using special abilities that can be selected through the UI. I have added the example abilities heal, overwatch and grenades. I have added edge scrolling and units wielding weapon meshes firing lasers. I’ve added working VR controls with a few cool features. I am in the process of updating the AI to use the special abilities I have added, which is pretty difficult. I also want to update the VR map so that it works with special abilities, since I think it will look really cool. I also need to design some better looking example maps, as the ones I’m using for testing are very bare bones. I also need to stop myself from not constantly wanting to add new features, as I keep getting new ideas as I go along. I’ll try to stick to just my planned features, and hopefully it should be done in the not too distant future.
My compatibility update for UE4.14 is out. The only thing that needed fixing was replacing the materials of the tile maps in the 2D game example, so this version is identical to the previous one, so don’t get too excited
I’ve made some progress with the coming feature update, though, and I just managed to add something really cool. The AI now takes cover into consideration when choosing which tile to attack from. They calculate their own hit chance from each possible tile in move range and checks the combined hit chances of all enemy units for that tile. It still requires tweaking, but it is so cool to see the AI make tactical decisions.
@Selentic: Hopefully that should do the trick. If you still encounter a lot of issues you can of course consider adding a dummy unit. This also involves quite a few changes to get working correctly, though. The central thing would be to have the unit in the initiative order, but not in the Pawn array and to always put the dummy unit at the end of the Initiative Order array when switching to another unit while the dummy unit is the current unit.
I’m hyped. Will upgrading to it be as simple as swapping the ai controller blueprint to get these features, or will it require the others to be redone?
I’m adapting how pawns initiate their actions into a fire emblem type menu system right now and so far it’s working around the issue, but it’s good to know in case issues stemming from that appear when I’m done.
I’m also trying to implement units turning gray after they’ve acted to indicate that they’ve used their turn, but I haven’t been able to figure out a convenient way of doing this yet. Using set material is tricky because the parent doesn’t have a mesh to assign it to, and I haven’t come up with a convenient way to fire it off in each player pawn blueprint. Do you know of a good way to pull this off?
also also, I’ve been trying to find the point in the toolkit where it displays the attackable tiles of a unit it’d be great if you could point me to it.
Most of the new features will be contained in example maps that use child actors of the default ones. As such, the modifications to the regular blueprints are not too big, and should not take too long to implement. I try to mark all changes I make clearly so that it is not to difficult to add them to an old project. For the update after this, I might consider taking some of the features I’ve added in the example map and integrating them into the default blueprints, which will make conversion a bit more time consuming.
If you have a blueprint with a skeletal mesh that has Unit_Parent as its parent blueprint you can cast that blueprint to the child blueprint class and get the skeletal mesh reference from the cast.
Check out the Find Tiles in Range function in BP_GridManager. This function contains several nested functions. One for getting all tile indexes in the appropriate range, one for filtering these indexes in various ways (is there line of sight to the tile, are there any units standing on them) and finally one function for placing decals or meshes on the remaining tiles to display them to the player.
Hi , I am using your toolkit and so far I like it very much. The game I am setting up using this is intended to be played as a hotseat game (players switching between their turns). I saw that I can change the faction to easily set this up, however I need different information to be displayed for the two different players. I was looking through the turns part of the game mode blueprint and I see information regarding going between the player and the AI but I am unsure how to distinguish between two different player turns. Each player will see different information during their turns, sort of like fog of war or if you are familiar with the bushes in league of legends, more similar to that.
Thanks for letting me know. The toolkit has gone through so many iterations that some of the less used variables and functions lose functionality. I’ll patch this up for the update.
yeee np dude, there’s no way you can verify all these minor functions every time you make a change, I’ll let you know about any other things I come across.
Hey, having a weird issue. Everything works totally fine in the simulation and standalone when I run from the unreal editor. When I go to package it as a Win 64bit executable then the movement gets all weird. The pawns seem to act like current movement and max movement is set to 0. Printing to the log I can see they are correctly set.
65% sure the issue started when I updated to 4.14. Haven’t been migrating in the updates made to your toolkit since ~4.11. Any ideas?
Hey Jiyko, you are indeed right in that this is a problem with newer versions of UE4. More specifically it is a problem with blueprint nativization (automatically turning blueprints into C++ code), which was added in 4.12, I believe, and has since been set as the default when packaging. For the most part blueprint nativization is fantastic for ATBTT, improving the speed for things like pathfinding more than tenfold. However, there may potentially appear new issues when packaging. The problem you are seeing is caused by the Resize node not working properly for arrays of structs in nativized projects. This can be fixed by adding values through a forloop instead (see my post explaining this here: [SUPPORT] Advanced Turn Based Tile Toolkit - Marketplace - Unreal Engine Forums). Nativization also causes an issue in the nodes in Unit_Parent that check if the game should end when a unit has been killed. You should replace this with your own game-specific end game nodes instead. You can avoid all these problems by disabling blueprint nativization in packaging options, of course, but I think the benefits are too good to pass up.
Great work on the initiative bar (I assume), by the way!
Hey , iam very interesed in your toolkit. But iam missing multiplayer as a main feature. I red through some of the pages in this thread, but couldnt find many answers. Some of your buyers are experimenting with this and yourself talked about it as an upcomming feature, but it hasnt any priority. Are there any new news about it?
Iam very new to the engine and more common with modding of other games. I worked through the multiplayer tutorial of UE4 and iam willing to get through the process. Maybe you have any concepts to start with?
online multiplayer is indeed something that I’ve not attempted to implement yet, as there have been many other features I’ve prioritized. It is on the list, but it is going to take a while before I’m there. So if you need online multiplayer for your ATBTT TBS game at this point I would suggest implementing it yourself. Something you can do is either messaging user Wisdom- who has been working on this or contacting user GS_Liam from GameSparks who has said earlier in this thread that he would be willing to help anyone wanting to use the GameSparks multiplayer framework with this toolkit.
Thanks for the fast response !
What I might do is just migrate in the latest version version on the Toolkit for the GridManager. I’ve kept my game logic super extracted from toolkit implementation so that I can easily slide in the upcoming cover updates