I’ll try to help you along as best I can. Getting one’s head around how blueprints work can take some time. To get an actor to face another you generally just need to get their look at rotation and then modify the rotations of the actors based on the output from the get look at rotation node. From there you just need to make sure you fire the nodes at the correct time. In the toolkit this is done during the attack victim event. If you do the same thing connected up to event tick it will happen every single tick (note that the units of ATBTT have their tick disabled by default). I cannot be sure what you are doing wrong, but if you send me a screenshot I should be able to figure it out.
That is definitely doable. I’ll help you implement the feature if you find it tricky.
Ok,
This is a bug I thought I had fixed in an earlier update, but it seems it is back (though caused by something different). It only happens in the 2D game example, which is quite baffling. It is likely caused by the way the AI controller reacts to the specific layout of the 2D game example map, but I was not been able to figure out the exact cause when I looked at it this morning. I’ll try to find a solution soon.
Honestly outside of this and some cool loot and a tileset this already almost plays how I want it to. I think its pretty cool out of the box. I’ll spend some time looking over the blueprints, so far everything seems straight forward-ish. Having SP and abilities that pop up in a menu would be pretty
Ah!
I wonder if a simple fix would be to skip the turn if the AI simply takes too long to decide.
Ok, so I figured out the problem. A bit annoyingly I realized that I had already found the reason for this issue. Completely forgot about that in the previous busy months. The problem seems to stem from how UE4 handles child actors. I’m not sure of the exact reason, but calling events on a child actors that belong to the parent actor does not seem to work flawlessly.
The problem appears when the BP_GridManager_2D calls the Pathfinding_per_tick event (which is contained in BP_GridManager). To fix this one can simply replace the Pathfinding_per_tick parts of ATBTT_AI_Controller with calls to regular Pathfinding functions. This should not have any real impact on performance unless you are making a huge map where the AI units have a huge search range, you run it on very poor hardware and you choose not to nativize the blueprints for some reason. I will probably just change this to be the default in a future update.
Here is the relevant part of ATBTT_AI_Controller to change, which is at the bottom right of the Choose Target part of ATBTT_AI_Controller’s event graph:
With unreal forums back up again I’d like to ask a few questions. After managing getting the both player and enemy character to turn and face each other on attack, I’m wondering how would I go about implementing “turn in place” animations for when the enemy rotates. I have the “turn in place” animations I would just like some guidance on where to implement such things, would it be a blend space or state machine? I would need to implement both “turn in place left” and “turn in place right” animations, to make the movement realistic.
My second question and I have a feeling this is already covered in one of your videos which I haven’t all watched yet but just curious to know. How would I go about implementing special abilities, like a special attack that plays “x effect”. Would that be something I could modify off the “overwatch” feature that you’ll be adding in your next update?
Also how would I go about implementing a hit and miss or % miss chance feature. Once again I do apologise if I’m asking questions that you’ve covered, if you have just refer me to the video
Hi there, glad to see that the forums are mostly up again.
Animation isn’t something I have spent a ton of time on in the engine, and the one I have implemented is pretty rudimentary, so I might not be the best one to ask, but turn in place animations should be handled with a blend space. You should also be using a state machine to control everything, but the turn animation itself should be contained in a blend space, which should get its input from the state machine. I would recommend Googling for “turn in place animation unreal”, as there seem to be many posts and videos discussing this.
Special abilities is not really something I have covered in my tutorials, though other users have implemented this in ATBTT in various ways. One of the reasons I have not implemented something like this is that special abilities are naturally very varied, and how they are handled will vary a lot depending on what sort of game you are making. Because of this, most people would need to make this from scratch anyway. However I will be implementing one such system in the coming update, which will be close to how it is done in XCOM, with overwatch, explosives, rapid fire etc. There will still be some time until the update is done, however. There are a million ways to implement abilities, but the way I am doing it is creating inidividual ability blueprints that are spawned in the world when an ability is used, that contain all code related to an ability. These actors are deleted after the ability has been used. That is the general idea, in any case.
For hit and miss chance, this is pretty straightforward. You just need to check the value of a random float against an accuracy value every time an attack is made. Here is a simple solution I came up with when I was asked this question some time ago: [SUPPORT] Advanced Turn Based Tile Toolkit - Marketplace - Unreal Engine Forums
Once I fix the hang on AI that cannot path to a player bug I will be in pretty good shape. I am not worried about performance as I am not really looking into making large levels.
Just need to make it so when not in combat and having multiple friendly units that free roaming still toggles on. Once I have that all I need to do is make a special ability system where units can use special attacks at the cost of SP.
If I get that in place ill change the graphics and make something with it.
Not sure what would be the easiest way to do special abilities though. hmm
Thanks for the advice, I’ll see what I come up with. Really looking forward to the next update, does that mean you’ll be adding an ability bar that holds the overwatch, explosive ability etc etc. I feel that once I see your blueprints, I’ll have a better way of implementing my own abilities, will you be making a video with your next update? Also will the AI be able to use those new abilities, like overwatch etc etc.
Also with your hit chance blueprint, how did you create the public floats accuracy and dodge?
Just to let you know the fix was easy to setup but for some strange reason 1 out of every 10 AI turns the game will slow to an absolute crawl and eventually crash.
Sorry for the delayed response. I did not recieve an e-mail notification about the replies.
You probably wouldn’t have to worry about performance in any case, and even if you were to make a game that would have performance issues because of huge move ranges etc. that should no longer be a problem after nativizing blueprints.
I’m not entirely sure what you mean with free roaming toggling on with multiple friendly units. Can you tell me exactly what you are trying to achieve and what is preventing you from doing so? Special abilities can be done in a few ways. As mentioned my plan is to have a new actor class containing the blueprints controlling the special abilities, and creating child actors of this blueprints for each specific ability. When the ability is used I would spawn this invisible actor in the game, run the code, and remove it afterwards.
I do indeed plan to make a video when I’m done with the update. But again note that there is still a lot of work left before the update is done. I intend to have the AI utilize the abilities, though getting them to use the abilities effectively will be a challenge.
As for creating public floats for accuracy and dodge, what I would do is create a duplicate of one of the four base units and have this be the parent blueprint for all your units. Add the floats as public variables to this unit.
That is disconcerting. I will have to look into it and see if I can replicate it.
Its np, I have been going over yoiur blueprints a lot and have learned quite a bit on my own. I have answered most of my own questions already. For example how to make enemy characters have aggro ranges and when and how to set free roam on or off depending on what is happening in game play. So far its working great!
Sadly in the 2d game if an AI is unable to reach its desired destination and its only option is to move closer it pretty much causes the game to hang from the slow down. However this not a problem, like you say, when in the standard blueprint. So I decided to work with that version for my neat fun little project.
I have the free roaming part already figured out now! I have it working exactly how I want and wasn’t even that difficult to be honest. You did a great job with this blueprint setup!
If you are already planning to do special abilities then you pretty much will have done 80% of the work for what I want to do. That’s crazy!
If you are familiar at all with Disgaea, being able to have abilities that are centered around the caster or allow you to point to locations. If the abilities have unique patterns and stuff like that then. Then the template is pretty much already a game, it just needs graphics, levels sound and a HUD basically. I mean I have no trouble hooking up the stats and damage system at that point.
The issues with the 2D game example are very strange. It seems like there might be some inherent issue in Unreal Engine with child actors would be difficult to fix. I’ll keep searching for a workaround, though. In any case I would recommend basing your own game on the regular BP_GridManager and modifying it as you see fit.
Good to hear you were able to get free roaming working for all units. It is not something I assumed would be difficult, so it is good to hear there are no unexpected issues.
I’m not really familiar with Disgaea besides knowing it exists. If what you are thinking of are area attacks such as cones, lines etc. it is absolutely possible to implement, but I will probably just add a simple square explosion for the next game example.
When spawning new units you need to make sure they are added to the Pawn Array in BP_GridManager at the index corresponding to their location. I have made a couple of functions for doing this easily. You can find the Spawn Unit and Move Unit on Grid functions in BP_GridManager under the utility section of the functions.
I am no stranger to limitations with blueprints and this sounds like yet another example. I had an entire first person shooter with over 30 unique weapons fiz out on me for god knows why this year. Be very careful when working with structs and parent child relationships. That stuff breaks down quick.
So far working with your blueprints has been pretty easy. My next goal is to figure out how to setup agro ranges where mobs that are placed in the world can wake up and activate combat mode where free roam is toggled off. So basically if they see an enemy unit they are added to initiative order and combat mode persists until all active enemies are dispatched. I might just use line traces, I think the 2d example game has a basic example of this.
Seems like spawning units is pretty straight forward.
Honestly the only thing left would be accessing a menu to select and activate unique abilities with cones, lines and patterns. With that being functional the rest seems pretty basic. Hard thing about abilities though is the AI needs to understand how to use defense and healing abilities. RIP trying to get that in a functional state.
For the most part I feel that blueprints have very few limitations, and this is probably an issue that will be resolved in the future, but for the moment I will be a bit more careful about using child blueprints for very complex blueprint actors. I’m sending an error report to Epic.
For aggro ranges where you enter turn based mode when spotting an enemy, this is exactly what I’m doing in the 2D example, so I recommend taking a look there. I also describe all the 2D example blueprints in my latest tutorial video.
Spawning units should be very simple indeed thanks to the function I’ve added.
When it comes to AI that is pretty well know to be the hardest thing about making a turn based strategy game. I think it is a really fun challenge, though, and I’m absolutely up for the task.
Hello again, and thank you so much for the answers! Your tutorials are great indeed ^^
I’m trying to implement mechanics very similar to https://forums.unrealengine.com/showthread.php?60108-Advanced-Turn-Based-Tile-Toolkit-SUPPORT&p=509167&viewfull=1#post509167, and suffering problems with one important addition. I added factions variables for cities, and now I need AI units to ignore cities with the same faction as theirs (and switching the faction of the city, if any non-allied unit “conquers” this point). Could you please help with an advice, if there would be some time, how should I make it correctly? Accessing this change through BP_Grid_manager and modifiing the range arrays seems bad idea, or I’m doing something terribly wrong.
Thank you!
I have a had play in your bunker map as I would like to get into multi level maps,
however with a normal spawn unit function, it doesnt put it at the correct place.
It says its the right transform but the pawn array index says something else.
I havent moved the map itself so the grid is still 0,0,0
Adding units to the grid before play does work though http://i676.photobucket.com/albums/vv123/Luked90/Screenshot%202016-09-04%2021.20.31.png
I just ran into a weird issue where every time a enemy unit is supposed to walk up to player controlled unit. The pathing will send them to the 0 index on the grid. So the AI will run through walls and the floor to the top left corner of the map. then turn and attack my unit dealing damage. I am pretty sure I broke something here but not quite sure what. It does report an error saying that a null value was obtained.
This is kind of strange because I didn’t really change anything that I know would cause this.
I’m not exactly sure what you need the range array for. It is just used for temporarily storing what tiles are in range of a unit.
The simplest way to get a city to change faction when a unit moves into it is to use collision. Enable collision for your units (but make sure their collision do not block PathTrace and RangeTrace) and add a trigger volume to your cities in the middle of their tile. In the city blueprint you can get any colliding actors, cast them to Unit_Parent, get their faction and alter the faction of the city.
AI is a bit more tricky. In ATBTT_AI_Controller after pathfinding but before finding if there are any units in range you could get all actors of your city blueprint class, loop through them and use the vector to index function in BP_GridManager to convert their locations to indexes on the grid. You then check if that index in the CanMoveTo array in BP_GridManager is higher than 0 (meaning the current unit can move to it) and that the Pawn Array at that index is empty. If so you should set that tile index as the unit’s target and move it there using the same nodes in the AI controller used for directing the unit towards an enemy unit.
This is one possible solution, at least. I hope my explanation was understandable and that I understood your question correctly.
I have two functions called Make Tile Passable and Make Tile Impassable that should be useful to you. You should first get references to all the tiles you want to modify and loop over them, using Make Tile Passable for each. This should hopefully do the trick. To get the appropriate tiles you could possibly use the Get Indexes in Range function, though you could end up making surrounding tiles passable that you want to be impassable if you’re not careful.
Hmm, that’s not good. This might have been an oversight on my part. I will look into it when I have access to my home computer.
This is an error I have seen a few times, but it should not happen without you changing something. It is caused by the AI searching for player units to attack and one of the functions for finding targets returning false (or 0), causing the unit to move to index 0. Have you made any modifications to ATBTT_AI_Controller?
Thank you, the collision solution seems to be almost ideal one! But how could I make AI ignore its own faction (an allied factions) cities? These cities may stay unoccupied, but faction-allied by default.