Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    To clarify more on my problem, Whenever the attacking unit deals damage it should print out the defending unit's type and deal the damage according to that type. However it seems to print out its own type instead and deal normal damage, how am I able to change and make it so that it recognizes the attacking unit's type and deal the appropriate damage.

    Thanks, EagleEyeGamma.

    Comment


      Originally posted by EagleEyeGamma View Post
      To clarify more on my problem, Whenever the attacking unit deals damage it should print out the defending unit's type and deal the damage according to that type. However it seems to print out its own type instead and deal normal damage, how am I able to change and make it so that it recognizes the attacking unit's type and deal the appropriate damage.

      Thanks, EagleEyeGamma.
      Ok, so we're talking Pokemon style damage modifiers? Meaning fire attacks would be universally good against grass type defenders and always result in a consistent damage modifier? Not a Pokemon expert, so partly guessing here.

      I tried my hand at something like that. The most awkward part is finding a good clean way to store and access the damage modifiers, but I've at least found something that works. Using a data table in some fashion would likely be preferable, but here you have something to build on:

      So first I created two new enums. EDamageType, which stores the various damage/element types (I used rock, paper and scissors), and EEffectiveness, which describes the various kinds of damage effectiveness (I used NotEffective, Effective and SuperEffective). I then created a struct which holds a TMap of these (EDamageType as keys and EEffectiveness as values). I called the struct FDamageTypes.

      I then needed a place with easy and universal access to store damage modifiers. I chose the game state, but this choice was pretty arbitrary. In the game state I created a new variable, which is a TMap with EDamageType keys and FDamageTypes values. Note that doing this is a bit clunky, and a reason why data tables are probably better suited, but works as a proof of concept:



      Next I added a function to the game state where you can find an appropriate damage modifier based on the attack type and the defend type. I use magic numbers for the modifiers here, which you would probably want to convert into variables:



      Next I added an EDamageType variable to BP_Unit called Type. If you don't want to modify the base blueprints you could instead add it to your custom BP_Unit child blueprint and access it through casting or an interface (interfaces are generally more performant).

      I then created a new ability duplicated from BP_Attack and added a DamageType variable to this ability. In its ExecuteAbility function I get the game state and find the damage modifier through the function above. I print the type of the defender (as you wanted) and store the modified damage in a local variable, which I then input to the Attack QueueAction and the TakeDamage function (remember that these values must always be the same, or the game logic will differ from what is displayed to the player). Here is the relevant part of the function:


      Hope that gives you enough to build on
      The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

      Comment


        Hey Knut,

        I've been working on merging the 2 player controllers from both your toolkit, and the card toolkit today, and I've got all the conflicts resolved, except the mouse input and touch input.

        Before tackling that I wanted to get your advice. The card toolkit is obviously expecting a card to be interacted with, and yours a BP_Unit. I was wondering if you had any idea on some logic that said.. If we aren't dealing with a card, then run through the tile toolkit mouse/input functionality? Or if you have a better idea I'd love to hear it Thanks!

        Comment


          Hi Knut,

          I am having the same problem as Telapicus, when I go into turn-based combat mode on the hybrid map it just locks up. Is it possible it has something to do with the Anim Class? I noticed the problem started when I switched from the hybrid anim class to my own.

          Thanks

          Comment


            Fixing incorrect info
            Last edited by McNuggets87; 10-21-2019, 12:53 PM.

            Comment


              Originally posted by Zennisin View Post
              Hey Knut,

              I've been working on merging the 2 player controllers from both your toolkit, and the card toolkit today, and I've got all the conflicts resolved, except the mouse input and touch input.

              Before tackling that I wanted to get your advice. The card toolkit is obviously expecting a card to be interacted with, and yours a BP_Unit. I was wondering if you had any idea on some logic that said.. If we aren't dealing with a card, then run through the tile toolkit mouse/input functionality? Or if you have a better idea I'd love to hear it Thanks!
              I might be missing something here, but it sounds like you're describing a simple branch statement? I assume there is some code set up when you click a card. You can set a bCardInteracting boolean to true when this happens and to false when you let go of the card and use this for a branch after the input events. Or is the card setup to complicated for this to work somehow?

              Originally posted by McNuggets87 View Post
              Hi Knut,

              I am having the same problem as Telapicus, when I go into turn-based combat mode on the hybrid map it just locks up. Is it possible it has something to do with the Anim Class? I noticed the problem started when I switched from the hybrid anim class to my own.

              Thanks
              Ok, then perhaps you can help me figure out where the issue is, since I have not been able to replicate it. Can you give me the precise steps you have done before this happens? How do you create your anim class? Is is a duplicate or child component? What code do you add to it and how, and have you made any other changes?
              The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

              Comment


                Heya Knut,

                I think I found the problem, I missed redirecting 2 of the Cast to ABP Hybrid references. User error, I appreciate your response and consideration. Thanks

                Comment


                  Originally posted by McNuggets87 View Post
                  Heya Knut,

                  I think I found the problem, I missed redirecting 2 of the Cast to ABP Hybrid references. User error, I appreciate your response and consideration. Thanks
                  Great that you found the issue! Telapicus: Might this be the problem on your end as well?

                  Zennisin: Hey, sorry about the delay for figuring out the mobile touch problems. I set up UE4 to deploy to Android today, but my phone is not being compliant (as in not able to launch any UE4 project). I will give it another go tomorrow.
                  The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                  Comment


                    Originally posted by Monokkel View Post

                    I might be missing something here, but it sounds like you're describing a simple branch statement? I assume there is some code set up when you click a card. You can set a bCardInteracting boolean to true when this happens and to false when you let go of the card and use this for a branch after the input events. Or is the card setup to complicated for this to work somehow?
                    I think I got this figured out

                    Originally posted by Monokkel View Post

                    Zennisin: Hey, sorry about the delay for figuring out the mobile touch problems. I set up UE4 to deploy to Android today, but my phone is not being compliant (as in not able to launch any UE4 project). I will give it another go tomorrow.
                    Thanks for looking into this! I really appreciate it

                    Comment


                      Hi, I just bought the toolkit yesterday. Seems very flexible. I think I've got my head wrapped around it enough to ask some intelligent questions

                      First, is it possible to dynamically build the grid underneath the landscape at runtime? So, I want to do something similar to your hybrid map but I had a much larger world in mind. Just playing around with the grid manager, I can see that it limits you to 200x200. For what I had in mind, it seems like it would be more efficient to just spawn the grid manager when needed then destroy it afterwards. In my head, I picture most gameplay to be realtime but combat would be turn based. What I had in mind was when combat is triggered, the grid manager would spawn with a 20X20 grid and the player and his group at the edge of the grid.

                      Second, is it possible for static meshes with collision to automatically make grids they overlap impassable? This directly relates to the first question. Watching the tutorial videos, this looks like it has to be set up manually for each and every static mesh and these meshes would need to be placed "on-the-grid" rather than the landscape. I don't think this would work for my purposes. It's possible I just don't understand how this part works. What I specifically had in mind were trees where I would want to just paint these on the landscape without having to make sure each one is perfectly placed in a grid square. Also, i want tree animations with wind, etc.

                      Looking forward to your reply.

                      Comment


                        Originally posted by Zennisin View Post
                        I think I got this figured out
                        Awesome!

                        Originally posted by Zennisin View Post
                        Thanks for looking into this! I really appreciate it
                        Still working on it... I'll let you know when I have an answer.

                        Originally posted by rackley View Post
                        Hi, I just bought the toolkit yesterday. Seems very flexible. I think I've got my head wrapped around it enough to ask some intelligent questions
                        Thanks! I'll do my best to answer them.

                        Originally posted by rackley View Post
                        First, is it possible to dynamically build the grid underneath the landscape at runtime? So, I want to do something similar to your hybrid map but I had a much larger world in mind. Just playing around with the grid manager, I can see that it limits you to 200x200. For what I had in mind, it seems like it would be more efficient to just spawn the grid manager when needed then destroy it afterwards. In my head, I picture most gameplay to be realtime but combat would be turn based. What I had in mind was when combat is triggered, the grid manager would spawn with a 20X20 grid and the player and his group at the edge of the grid.
                        I've though about the possibility of implementing something like this before, and while it might work okay I think I have a better solution. I have recently converted most of the toolkit's expensive functions to C++. This includes the expensive map generation functions. Using the C++ versions, creating a much larger grid becomes possible. I've tested 500*500 tile grids without issue.

                        I cannot include these functions in the toolkit because of Epic's policy of only allowing C++ code in plugins, but I can host a separate download of the cpp files and create a guide for converting (it is a bit time consuming, but not terribly so). This will be useful for developers with special requirements, as in your game. It will still take me some weeks to get it to a state where I'm happy to share it, but if you can develop on a smaller grid for now and have a bit of patience, I think this will be the best approach for your game.

                        Originally posted by rackley View Post
                        Second, is it possible for static meshes with collision to automatically make grids they overlap impassable? This directly relates to the first question. Watching the tutorial videos, this looks like it has to be set up manually for each and every static mesh and these meshes would need to be placed "on-the-grid" rather than the landscape. I don't think this would work for my purposes. It's possible I just don't understand how this part works. What I specifically had in mind were trees where I would want to just paint these on the landscape without having to make sure each one is perfectly placed in a grid square. Also, i want tree animations with wind, etc.
                        This is possible by default. The toolkit includes multiple ways of modifying the grid. The hand placed tile actors was the first method I implemented, so I focus on this in my early tutorial videos. However, I have also included a procedural approach that generates walkability based on the meshes placed in your level.

                        This will create grid locations by tracing from the sky to the ground and finding meshes blocking the PathTrace collision channel. If selected, the toolkit will also trace for walls from each tile in all directions, removing tile connections (edges) if the line trace (using the WallTrace channel) is blocked between adjacent tiles. You can enable these settings by setting heightmap to OneLevel in the GridManager (for the first one) and bTraceForWalls to true (for the second).

                        So in other words, make sure that anything you want to walk on blocks PathTrace and anything you want to block movement blocks WallTrace. Animations on trees etc. should not matter. Just make sure the collisions are set up how you want them.
                        The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                        Comment


                          Great! Looking forward to getting the code. I will check back in a couple of weeks.

                          Comment


                            Hi, Monokkel

                            How did you make this happen?


                            From, EagleEyeGamma

                            Comment


                              Originally posted by rackley View Post
                              Great! Looking forward to getting the code. I will check back in a couple of weeks.
                              Might take more than a couple of weeks, as I'm working on lots of stuff in parallel, but it should at least me done by Christmas.

                              Originally posted by EagleEyeGamma View Post
                              Hi, Monokkel

                              How did you make this happen?

                              From, EagleEyeGamma
                              Right click the struct output (blue node) and select break struct (or is it split, I always forget).
                              The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                              Comment


                                Hi, Monokkel

                                When I did spilt the struct it became this instead of a map

                                Comment

                                Working...
                                X