Hi, I’m helping my son on a project and he have purchased your toolkit as a start for a game.
We are pretty new to Unreal and take it step by step. The toolkit is a great resource!
We are trying to get a random damage system to work and I search for and found a simple solution, I thought I just added a new variable Damage_min in BP_Unit and use it in BP_Ability_MoveAttack with the Damage varible for maximum damage as input to a RandomFloatInRange, the output is the new input to the TakeDamage function, as shown in the picture.
But it will break the KillUnit, in the TakeDamage function, logic in some way so the unit gets killed but is still in the game somehow and when it’s turn next you can’t do any more actions.
We have followed the path in the BP_Unit function Take Damage and can se that it call,s The Kill function but are lost in how to follow it longer.
It’s not possible to watch the Damage variable in the Take Damage function, it’s says (not in scope), but I can se that the Current Health change so the damages works.
Have I made it to simple or is it just one newbie mistake because I don’t understand the UE4 yet?
We are using a clean example map for this testing.
I see. At that point you’re even reaching the hard limits on grid size, which is 999999 (though this can also be increased with more work). In any case this is big enough that you likely want to do something like move the grid, as you’ve suggested. Note that 128128 is still really big, with the biggest Civ maps being 106×66. The main issue with repositioning the grid during gameplay is that you’ll have to run the code for generating walkability at runtime. This is bound to create a noticable frame drop even on powerful computers. You would want to disguise and/or reduce this as much as possible. First consider how big you really need the combat area to be, as this has the largest impact. Next you can add a fly-in “combat start” menu covering the screen or something that can disguise the dropped frames. Converting the grid generating functions to C++ would also help quite a bit, though it would not alleviate the problem, since the line traces are still just as slow. Spreading out the generation over multiple ticks can also help, though requires quite a bit of work.
As for the specific code that needs to be rerun, you’re going to need everything contained in the SetupGridArrays function as well as AddViewportUnitsToGridUnitsArray.
That is great to hear! Seems like a great way to both bond and learn together. I’ll do my best to help you along.
Your setup is reasonable, but you’re making some mistakes when it comes to features specific to this toolkit, which is understandable. The most unconventional part of this toolkit is what I call the Action System, which keeps gameplay logic and what is shown to the player cleanly separated. This is done in order to make it simpler to queue up several different events without having to call back and forth through event dispatchers and the like. It was also added to make networked multiplayer much easier to setup.
If you look at the node right before the TakeDamage node in your screenshot you’ll see a QueueAction macro. This macro communicates with the action system to show the attack animation and to change the health bar of the target when it is hit/show a death animation if the health bar is empty. TakeDamage, in contrast, modifies the CurrentHealth variable of the target unit and removes references to the unit from the grid arrays and initiative order if it reaches 0. Since you’re only randomizing damage for this second part you could have a unit that is animated as if it is dead, but which is still considered alive by the game logic and vice versa.
So in short what you need to do is to input the same damage value into the macro as into TakeDamage. However you cannot simply use RandomFloatInRange for both, as you’ll still likely end up with differing (random) values. So what you need is to get a random float before the QueueAction macro, store this in a local variable and then input this local variable as the damage input for both QueueAction and TakeDamage.
The action system takes some getting used to. I highly recommend watching my tutorials on this, which can be found here.
Hi there, im trying to find a hex behind the hex that i am targetting (for the purpose of long attack hitting 2 enemies in a line in front of unit). How do you suppose i should do that? I guess get tile in direction will be helpful here, but im kinda lost.
Double the difference in the GridIndexes of the source tile and the target tile and add it to the GridIndex of the source tile. So if the attacking unit is at GridIndex 10005005 and targeting GridIndex 10006006 the difference is 10005005 - 10006006 = 1001. 1001*2 = 2002. The GridIndex behind the target is 10005005 + 2002 = 10007007.
This math would only work if the source is adjacent to the target, as you describe in your post. For a more general solution you would need to do something a bit more involved.
Allright we will figure out the best approach for our needs - thanks for your help!
As recalculating the big grid on every level load & engine startup takes a lot of time we came up with a simple serialization solution. Especially when working in a team this can be helpful as you don’t need to recalculate the grid all the time once it’s done.
Here are the blueprints with the additions to BP_GridManager if anyone is interested in this:
Save Grid Function:
Load Grid Function:
Within the EventGraph we added these nodes to the event ActivateGridManager:
I’ve sent a new version of the toolkit to Epic. The major change in this version is a modification to the ActionQueue system that allows you to insert new actions into the action queue while it is being animated. This is very useful for actions that interrupt other actions, such as overwatch shots, spike traps and the like. It seems to work pretty well, but I have one remaining concern. Early in testing I encountered a bug that prevented the action system from continuing during combat. I have not been able to replicate this issue, but neither do I feel that any of the changes I later made should be sufficient to prevent such a bug from occurring. As such I’ve included abilities and actions that use the new ActionQueue options in the experimental folder for now.
Now I’ve begun refactoring the Turn Manager, which is well overdue. If the bug I observed still remains I expect it is tied to the Turn Manager somehow, so refactoring this would also likely resolve this issue.
I’ve first tried to make the Turn Manager more flexible by trying to take into account several kinds of initiative systems in a single blueprint. It quickly became apparent that this would be messy, however. I’ve instead opted for creating child blueprint options that override various turn order functionality as needed. I’m a bit uncertain what I want to have as the default, though. The original toolkit had a very D&D-style initiative system where everyone goes in order without switching between units, and where units act in an order determined solely by their initiative value regardless of their faction. As I kept modifying the toolkit I bent this into more of an XCOM-style, with code for switching between units, keeping units separate in initiative based on their faction etc.
From seeing what people make with my toolkit I get the feeling that most people use a faction-based turn system where the player can choose freely between units and chooses when to end the turn, at which point the entire next faction gets to act. As this seems so popular I’m considering making this the default. I’m interested in what you guys think. The developers who choose to follow this thread might of course not be a representative sample, but I’d still like to know what sort of initiative system each of you are using. Feel free to post below and tell me about any quirks of your current system/how your ideal turn order system would work. As I’m in the middle of refactoring, now is the best time to influence how I’ll modify the toolkit going forward.
Awesome! I have been watching the other devs and your progress on this for a while. for my project I would like to have options for both d&d and xcom style turns.
great, thanks for the input. Just to clarify: Both options will be available, but I’m deciding which one shall be the toolkit default and which shall be set in the derived Turn Manager child class.
Hi , I already bought your Blueprint, but I have some trouble, how can I use another Model outside from your given source? I try to replace your mannekin with my model but my model cannot animate walking, please teach me, Im very2 new in unreal engine… thanks before
hi
sorry for the late input (just came back home).
In my project I am using both method. more of the x com style method, but in some phases [SIZE=13px]I use something like a [/SIZE]chess turn.
anyway I just looked at your new update and again it is awesome!! every time you are making this tool so much more Versatile And the freedom to create new abilities in a much easier way which is great !! (you have some minor error in the experimental folder - the BP_GA_Trap -QueueAction and in the path line high, but there are easy fix).
Yeah, much like you said it’s exactly the faction-based type that lets you switch units. My vote for default goes to that obviously. And like some others have been posting, in my case I’m also looking into switching from the turn-based, grid movement to real-time 3rd person controls once combat is over; though it is understandable if you wont go that specific into these presets.
I haven’t been dabbling much into ATBTT lately cause I’ve been learning Blender to overhaul my 3d modeling pipeline, jumping from Max&Maya. Looking forward to seeing the results of this refactoring you speak of! You will hear more from this fopdoodle as soon as Blender releases me
well I used a 100X100 grid placed it out with a landscape movement works until that point I can’t really tell you more of a step by step because I literally only put the grid out and worked on landscape thought all was well till I made it to that point … sorry I can’t help more . I think it may be number of tiles issue because trying a 200X 200 grid gives infinite loop error
I recently purchsed your product and have been really enjoying going through the tutorial, I have been able to find all of my answers in this way. The only thing I cant find is a way to intergrate other products into the toolkit. I have the mce ans wanted to use it in conjunction with the toolkit but, cant seem to get my combat manager to work due the way damage is handled. Just wondering if this is something you coild help me out with?
Hey - we’re facing some issues with deactivating ATBTT - for some reasons there are unit’s missing in the initiative bar and the grid is displayed sometimes although we disabled ATBTT. Now we’re wondering wether you could have a look on the way we disable ATBTT - as you mentioned before we’re clearing the GridUnits array but maybe we’re doing something wrong here?
We’re using this event from within the Game Mode:
This is called from within BP_Unit to hide the ability markers etc.
This event is used for the reactivation when a combat starts:
I’ve tried to reproduce your issue without success (100*100 grid, a hilly landscape covering all of it and heightmap set to true). I think you will have to give me the step-by-step instruction for reproducing the issue. Where is the grid manager placed? What variables have you modified?
200200 will indeed give you an infinite loop error due to the amount of stuff happening at the first frame to generate the terrain. You can bypass this by upping the loop iteration limit in Unreal Engine. It is also possible to split the loop iterations over multiple ticks (which requires some work), or converting the slowest functions to C++. I’m curious what game you’re making that requires such a huge map, though. 200200 is an order of magnitude more tiles than the largest Civ and XCOM maps.
I don’t know anything about mce, but I could try to answer more generically. I’ll need to know a bit more about the specifics of your problems, though. I’m assuming mce stores damage somewhere. Getting it from there is probably possible though standard blueprint communication techniques. After that you should simply need to replace any reference to damage in the ability you are modifying with this other damage variable.
Hmm, I’m a bit confused by parts of your setup, and it is hard to understand exactly what is not working here. I’ll try my own hand at this soon and will report back to you. Might take me a couple of days, though.