Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    Originally posted by McNuggets87 View Post
    Hi, I just purchased the Advanced Turn Based Tile Toolkit and am working to integrate it with my project. For my project I would like players to be able to explore/craft/etc.. without being in turns and use the turn-based system for combat. I was reading through this thread about how to implement this and am undecided on how to proceed. Is there a tutorial somewhere on how to implement these changes? Thanks
    I'm doing the same thing, so I second this question XD

    Comment


      Ok, I've got time to answer a few more questions. Been mountain hiking the last few days, but got some time now.

      Originally posted by HuangNg View Post
      Hi Krut. I just asked you on the Youtube Channel about the chess movement in your grid. I saw you have the diamond shape and square shape. How can I create the cross, linear, diagonal, L shape movement pattern with your toolkit? I really need you to explain step by step because I am a new student with basic blueprint knowledge.

      Firstly, I checked your tutorial steps on the youtube, I didn't find the GridEdges TMap you mentioned.


      I found some script link to my chess game like the direction of the edges. I just make the array from enum direction and choose the direction to make the cross shape. How can I add it in your toolkit? Do you need to create the new construct script base on your direction edges with four cardinal directions like cross shape?


      Do you need to add function like you create the diamond shape in GetIndexInRange Script?

      Moving on this step, How I find reachable tiles by starting at a particular tile and add the neighboring tiles for a specified number of movement points? you can explain clearly this part. I do not get this step clearly.

      The final step, What can we work with ChooseAndRunPathfindingSearchStep function?

      Thanks.
      Sorry for the especially slow reply, HuangNg. It seems that since your reply was your first, Epic held it for review so that I could not see it until later. Ok, to your question:

      So, I try to explain how the grid is organized in some of my newest videos, which you have watched. I'll reference these in my answer. GridLocations, GridEdges and GridUnits are the three most important TMaps for interacting with the grid. They store the actual world locations of each grid index (GridLocations), what tiles each tile is connected to for pathfinding (GridEdges) and what tiles are occupied by units (GridUnits). They can all be found in the variables of BP_GridManager (make sure you look at the real parent blueprint and not child actors like BP_GridManager_Hex). If your grid manager does not have these variables you are using an old version of the toolkit and I recommend you create a fresh project with the latest version.

      If you understand how the grid indexes are related you should be able to create any arbitrary shape you want. As I explain in my tutorials each tile you go in the X-axis increases the grid index by 1000, while each you go in the Y-axis increases the index by 1. So if you wanted to draw a line of four tiles in the positive direction of the X axis from tile 4004, for instance you would want to get tiles 4004, 5004, 6004 and 7004. Add tile 7005 and you would have an L-shape. A diagonal would go 4004, 5005, 6006 etc. For a game like chess, where the movement of each pawn is limited and clearly defined you can get away with hardcoding these patterns. For a more complex games you might want to make your own functions for patterns of arbitrary size and direction. I don't know what you are planning for your game, though. For this you would indeed want to create functions similar to what I do with GetIndexesInRange. There are many resources online for drawing various patterns on grids. If you understand my explanation of relative tile positions as described above and in my videos, applying these resources to my toolkit should hopefully be quite straightforward.

      For a game like chess you probably don't need to use the pathfinding functions at all, as the movement of chess pieces do not curve around and avoid obstacles. In such a game you could just get the tiles like described above, store them, and move the chess piece directly to the end location if a valid tile is clicked. You would do this in a similar way to how I set things up in BP_Ability. You would probably want to first create a generic chess movement ability based on BP_Ability (say BP_Ability_Chess). In the activation of this ability you would have a function that would find the appropriate tiles you can move to (perhaps FindChessMoveTiles?). In ServerInteract you would add a branch that checks if a clicked tile is in the array output by FindChessMoveTiles, which if true leads to an ExecuteAbility function which moves the chess piece and removes any enemy chess piece on the target tile. Then you could create ability child blueprints (say BP_Ability_Chess_Knight) which override the FindChessMoveTiles function with the specific movement pattern of that unit.

      For your question on finding reachable tiles, you should use the RunPathfinding function from BP_GridManager. This function finds tiles in a specified move range from a specified starting point.

      Originally posted by FuTou View Post

      Yeah, it's working. Climbing could be super useful to me, so it would be great if it's not that hacky.
      Though it is hacky, it is hopefully a good starting point. It might be a while before I get to improve it, as there are many other things that I want to fix before I revisit climbing. I'll let you know if I think of any improvements.

      Originally posted by PrayWaits View Post
      Hey Knut, I have what is probably a stupid question. I am trying to give units an attribute for the number of attacks they make with a single attack action, so like Fighters can attack twice with one attack action but Mages would only attack once. I figure this can be done by having animations for the multi-attacks that give the ActionHit Notify more than once before the ActionEnd notify, then which animation you play for the attack would just depend on the value of the NumberOfAttacks attribute, which I created as an integer in BP_Unit as one of the public variables you made like Max Health, Speed, etc.
      However, I have no clue how to reference that NumberOfAttacks variable in the animation or in the execution of the Animate Ability event on the BP_Unit_Melee. I'm sure it has something to do with BPIs, which I don't understand, and I have no clue what to do. Could you help? How would you approach this?
      Thanks for your time.
      Hey, not a stupid question at all. The way the toolkit handles this kind of stuff is fairly non-standard, so I understand if it takes some getting used to. If you have not done so already I recommend you watch my three videos on the Action System and my three videos on Custom Units. They cover the sort of stuff you are asking about here. If you look at the Event Graph of BP_Unit_Anim you'll see that the animations are driven by input from an FAction struct. This struct can hold a vary large variety and number of variables and is used by the Action Systems (refer to the tutorial vids for details).

      The FAction structs are set by the QueueAction macros you see all over the place in the toolkit. This system makes it simple to queue multiple animations after one another without relying on dozens of interface calls, event dispatchers and custom events. It also comes with the added benefit of making everything replicate easily. You have already seen ActionHitNotify stuff in the various attack abilties. You'll see that in the ExecuteAbility functions for these abilities a QueueAction macro is called that is responsible for adding the stuff in the AnimateAction function of that ability to the ActionQueue. This is the macro where you should input your NumberOfAttacks variable. As I describe in my tutorials, do not use any outside variables within the AnimateAction events except those you get from the FActions struct or ones you are 100% certain will not change between the action being queued and animated.

      Now that you've input the number of attacks into the QueueAction macro you can use them within the AnimateAction event. Within this event you can then call a new QueueAction event to animate the attack on the unit (as I do in the offensive abilities). Note that this queue must be set to immediate, as you cannot queue an action within another action. For this action you call on the unit you input the NumberOfAttacks variable you get from the FActions struct output of AnimateAction (it should be index 0 of the integer array). This is then passed along to the AnimateAction event of the unit, which is again passed along to the AnimateAction event of the animation blueprint (by default in BP_UnitAnim). Here you can use this variable to choose the number of attack animations you want to display.

      Hope this makes sense. I know this can seem overly complicated to do something fairly simple, but once you get the hang of it you have a generic solution you can apply to a lot of things.

      Originally posted by PrayWaits View Post

      I'm doing the same thing, so I second this question XD
      I hope my answer is sufficient for you as well, in that case
      The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

      Comment


        Thank you so much, Knut. I'm getting a better grasp of this. I have a couple followup questions, though. The point that I'm supposed to pass in the NumberOfAttacks variable, is that in the Animate Ability message attached to the Event Animate Unit? I'm not seeing a AnimateAction or ExecuteAbility function here. I'm sorry if I should be able to figure this out on my own, I'm very new to this.
        And the place I'm supposed to get that variable from, is that the Animate Ability Event in the animation blueprint? I assume so as that's where the attack is set up, and I was able to attach sounds to the attacks (and taking damage and dying) through there, but I'm not sure how to get the variable I need pulled in. I tried it there before and it didn't work, but maybe I was doing it wrong?

        Sorry. I'm making a single player game and this feels like it was set up to incorporate a lot more than what I'm doing, and I'm getting lost. Not that it's a bad toolkit! I'm just dumb.

        Also, hope you're enjoying your vacation! Thank you for everything you do.
        Attached Files

        Comment


          hi PrayWaits


          Since Knut is on vacation I will try to help you (so that we will not interfere with his vacation too much )

          These are the steps you need to take ( I will use the ability - BP_Ability_Attack Throughout my example, so you can follow step by step):

          1. in the bp_ability attack in the event graph go to the execute ability function and inside put your
          NumberOfAttacks variable(integer) into the QueueAction macros as in the picture




          Click image for larger version  Name:	888.jpg Views:	1 Size:	191.7 KB ID:	1653192

          2. go to the event graph and look for the "event animate action " , and now you have your NumberOfAttacks variable you can take from the
          FActions struct and plug into the attack function (in order to plug the numberOfAttacks variable to the attack function you will need first to follow step 3

          3.
          look down at the attack event (in the same event graph) and press it. now you can put another input to this event - just as in this picture:



          Click image for larger version  Name:	1010.jpg Views:	1 Size:	153.0 KB ID:	1653193

          Click image for larger version  Name:	1030.jpg Views:	1 Size:	197.3 KB ID:	1653197

          4. now you can take the NumberOfAttacks variable from the attack event and plug it to the
          QueueAction macros as in this picture:




          Click image for larger version  Name:	1000.jpg Views:	1 Size:	220.9 KB ID:	1653195

          5. almost there go to your ABP_Unit or whatever you call you animation blueprint and look for the event animate ability and you have your
          numberOfAttacks variable you can use from the FActions struct with your animations. see picture:




          Click image for larger version  Name:	1020.jpg Views:	1 Size:	132.4 KB ID:	1653196

          hope it will help you

          cheers

          leo
          Last edited by leo bar; 08-14-2019, 06:07 PM.

          Comment


            Which blueprint should I modify,if I want every character can do next action after he shoot or finish walk automatic.
            Just like they won't wait for other character's turn.

            Comment


              Originally posted by leo bar View Post
              hi PrayWaits


              Since Knut is on vacation I will try to help you (so that we will not interfere with his vacation too much )
              Wow, thank you so much! This is super helpful. I didn't even realize this blueprint was a thing. May I ask where you created your NumberOfAttacks variable? I made it one of the public variables on the BP_Unit categorized as an attribute (like damage, health, range, etc.), but when I try to get it in the ExecuteAbility function it isn't found. But Damage is. I'm not sure what I'm supposed to do to pull the variable.

              Thank you for the help! Really appreciate it!

              Comment


                hi PrayWaits

                no worries, glad if I could help you, I am also learning a lot from this support tread

                Concerning your question: if you created your NumberOfAttacks variable in the bp_unit And you want access to this variable in the ability attack just go to
                bp_ability attack in the event graph go to the execute ability function and look how its get the damage variable (by the owning unit ref ), just do the same get the owning unit ref and from it get your NumberOfAttacks variable. see picture:

                Click image for larger version

Name:	1040.jpg
Views:	1
Size:	167.9 KB
ID:	1653277

                hope it will help you

                cheers

                leo
                Last edited by leo bar; 08-15-2019, 02:39 AM.

                Comment


                  Holllly **** thank you so much. I'm now able to get the number of attacks variable. Last silly question: Do you know where and how Knuit has the AnimNotify Events set up? I need a way to get the animations of the attacks to transition into each other, and I figure the best way is to put a notify at the end of the preceding swing and then once that notify goes off it goes to the next swing, but I don't really know how to make an event like the ones Knut has for ActionHit, ActionEnd, etc. When I try to create an event they look very different from his, and I don't know where he created these events to see how he did it.

                  Thank you again for the help! You've saved me so much head and heartache already.

                  Comment


                    hi PrayWaits
                    I'm currently out of my house. I am coming back at night and I will help you with a solution

                    cheers

                    leo

                    Comment


                      hi PrayWaits

                      if you want to know how to make actionhit / actionend notify look at knut video tutorial. he explain this very well. it will be better then I will try to explain here. if you still have hard time just let me know.

                      look at the: ATBTT - Custom Units (1/3) - Humanoid characters tutorial at around 11:00 (time) he explain how to add notify event

                      cheers

                      leo



                      Last edited by leo bar; 08-15-2019, 02:40 PM.

                      Comment


                        Thank you so much for helping PrayWaits, leo bar! Great explanation where I have no objections. As for your comments, PrayWaits on this seeming a bit unnecessarily complicated, I can understand and thought I should give a bit of an explanation (I've tried to communicate the same thoughts in my Action System tutorials):

                        Say you did this the simple way instead. Instead of going through all the trouble of passing the NuberOfAttacks variable through various QueueAction macros, why not for example just get a reference to the owning actor in your animation blueprint and getting the NumberOfAttacks straight from there? Well, first there is the replication thing. If you are making a multiplayer game you would then have to make sure to replicate every variable you want to use in this fashion, which is normally taken care of automatically by the action system, but this is not that big of a deal. Also, if you're making a single player game, why should you care?

                        The larger problem is the fact that the server-side stuff and when stuff is animated does not happen simultaneously. For example, on an AI unit's turn it might move to a tile, attack a unit and end its turn. In the game logic (and server side) this all happens instantaneously, in the same tick. As part of this many animations are queued. This would be activation of the unit, moving to a location, playing an attack animation, subtracting health from the health bar and then showing the selection of a new unit. If none of the variables used for the animations have changed between queuing the action and actually getting around to animation the action there is no issue. If they have we have a problem, however.

                        Say that you have an ability that increases NumberOfAttacks for this turn, which ends at the end of the turn. In the game logic you set NumberOfAttacks to 2, deal damage twice, end the unit's turn and set number of attacks back to 1. After all of this is done, the walk animation before the attack just started animating. By the time the attack animation happend NumberOfAttacks is back to 1, so getting this directly from the unit in its current state will get the incorrect value. Now suddenly health has been reduced twice in the game logic, but just once when animating. This will result in all sorts of strange behavior like the unit dying and becoming unselectable, but the unit still standing there animating with a non-empty health bar. This stuff becomes an even larger problem in multiplayer, where latency can cause things to animate at different times for different clients (an added benefit of the action system in multiplayer is that there should never be visible lag for clients, since animations and actor locations are not replicated continuously).

                        So, as long as you are making a single player game and can be 100% sure that the variable you are using for animating does not change from when it was used for game logic it is possible to get a reference directly instead of passing it through actions. Using actions is safer, though, so I would recommend using them whenever it is not highly impractical. The specific thing you are trying to modify is probably the most complicated use of the action system in this toolkit and normally it will be much more straightforward.

                        Hope this explanation helps you understand this better.

                        Originally posted by xermao View Post
                        Which blueprint should I modify,if I want every character can do next action after he shoot or finish walk automatic.
                        Just like they won't wait for other character's turn.
                        Hi, xermao. I'm not sure I understand what you mean. Can you describe in a bit more detail? Are you thinking of something like the player clicking and enemy and then having the unit both move and attack automatically in sequence?
                        The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                        Comment


                          Thank you so much Knut and leo bar . I definitely do want to learn how to use this Action System correctly, as you worked hard to make it work and I assume it is the best way to do things as long as you're not dumb.
                          Thank you for this great resource. I wouldn't have any hope of making my game idea without it.

                          Comment


                            Hey guys! So with your help I've managed to get the animations playing correctly, which is freaking awesome.
                            There is an issue where the animations for the 2 attack and 3 attack swing chains aren't setting off the ActionHit notify multiple times. Like I have the notifies in the montage, but only the first swing is doing damage. I don't know where to find the OnActionHit even that is called in the AnimBlueprint of the unit when the ActionHit notify goes off. Can someone help me with finding that, and might someone know why the attack isn't dealing damage more than once?

                            Comment


                              Originally posted by Monokkel View Post
                              Hi, xermao. I'm not sure I understand what you mean. Can you describe in a bit more detail? Are you thinking of something like the player clicking and enemy and then having the unit both move and attack automatically in sequence?
                              I means just like a rts game,player and enemy are always moving,never wait for other's turn.

                              Comment


                                Originally posted by PrayWaits View Post
                                Hey guys! So with your help I've managed to get the animations playing correctly, which is freaking awesome.
                                There is an issue where the animations for the 2 attack and 3 attack swing chains aren't setting off the ActionHit notify multiple times. Like I have the notifies in the montage, but only the first swing is doing damage. I don't know where to find the OnActionHit even that is called in the AnimBlueprint of the unit when the ActionHit notify goes off. Can someone help me with finding that, and might someone know why the attack isn't dealing damage more than once?
                                Are you sure it is not triggering the notify or just that it is not doing damage? In the included offensive ability blueprints I unbind the event dispatcher which listens for the attack hitting after the first hit, so this is what might be happening. If you are uncertain about what is being triggered, try using PrintString nodes to see how many times something is executed (like the notify events) or use breakpoints.

                                Originally posted by xermao View Post
                                I means just like a rts game,player and enemy are always moving,never wait for other's turn.
                                Ok, I see. The toolkit is made for turn-based games, so if you want to make a real-time game it is probably not a good fit. Everything from abilities to how actions are animated is designed with turn-based gameplay in mind. There are features that can be useful even for real-time games, such as my implementation for storing and accessing data from grids etc., but you would need to scrap most stuff and build a lot of things from scratch. If you got the incorrect impression when you bought the toolkit you can consider asking Epic for a refund.
                                The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                                Comment

                                Working...
                                X