Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Ok Monokkel thanks for your help. So far we've managed to get the switch working. When ending turnbased combat we remove all BP_Units from grid, when starting combat again we place them on the grid with the specific GridManager functions. But somehow the tiles of the previous position of the character who moves in realtime remain unreachable after continuing the turnbased combat. We couldn't figure out what's going on here - is there a method to clear the tilemap or something like that?

    Comment


      Originally posted by Dan.Ott View Post
      When you grab your character and combat is turned off do you notice that the health bar is still in the orginal location? I wonder if the grid manager is still registering something (grid location reference or something other) tied to that unit when you start combat?

      Comment


        Originally posted by Dan.Ott View Post
        Ok Monokkel thanks for your help. So far we've managed to get the switch working. When ending turnbased combat we remove all BP_Units from grid, when starting combat again we place them on the grid with the specific GridManager functions. But somehow the tiles of the previous position of the character who moves in realtime remain unreachable after continuing the turnbased combat. We couldn't figure out what's going on here - is there a method to clear the tilemap or something like that?
        Either your step for removing or re-adding the units to the grid has to be incorrect. How are you doing each of these? For removing you should be able to simply remove the keys corresponding to each unit's GridIndex variable from the GridUnits TMap in BP_GridManager. To re-add you would need to calculate which grid index corresponds to each unit's new location. You can convert a location to a grid index using the ConvertLocationToIndex3D in BP_GridManager. Do this for the location of each unit and add a reference to that unit for the corresponding key in GridUnits.
        The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

        Comment


          Originally posted by Monokkel View Post
          Either your step for removing or re-adding the units to the grid has to be incorrect. How are you doing each of these? For removing you should be able to simply remove the keys corresponding to each unit's GridIndex variable from the GridUnits TMap in BP_GridManager. To re-add you would need to calculate which grid index corresponds to each unit's new location. You can convert a location to a grid index using the ConvertLocationToIndex3D in BP_GridManager. Do this for the location of each unit and add a reference to that unit for the corresponding key in GridUnits.
          We are removing the units from the grid via BP_GridManager's method "RemoveUnitFromGrid". The healthbar remains at the last tile on the grid as the position of the units is only updated when realtime is over & turnbased combat continues. To continue combat we use the method you mentioned (ConvertLocationToIndex3D) and the new location & grid index is calculated correctly. Here we use GridManager's "AddUnitToGrid" method. Everything seems to work fine except for the remove part, we'll try out removing / adding the keys in GridUnits TMap instead of using RemoveUnitFromGrid now.

          EDIT: Allright, clearing the GridUnits TMap instead of using RemoveUnitFromGrid worked
          Last edited by Dan.Ott; 06-24-2019, 02:35 AM.

          Comment


            Originally posted by Dan.Ott View Post
            We are removing the units from the grid via BP_GridManager's method "RemoveUnitFromGrid". The healthbar remains at the last tile on the grid as the position of the units is only updated when realtime is over & turnbased combat continues. To continue combat we use the method you mentioned (ConvertLocationToIndex3D) and the new location & grid index is calculated correctly. Here we use GridManager's "AddUnitToGrid" method. Everything seems to work fine except for the remove part, we'll try out removing / adding the keys in GridUnits TMap instead of using RemoveUnitFromGrid now.

            EDIT: Allright, clearing the GridUnits TMap instead of using RemoveUnitFromGrid worked
            Great that it worked I didn't think about the heath bar thing until now, however. How are you moving the unit? If you move the entire actor the health bar should come along for the ride. Are you only moving the skeletal mesh or something?
            The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

            Comment


              hi knut

              there is a problem with the initiative order I think. in order to reproduce the problem, try the following setup:

              1. place a adv.grid manger on the level

              2. place 2 adv. bp_unit on the grid (player)

              3. place one adv. bp_unit on the grid, make it enemy ai and check the unaware

              when you play you cant swap between unit (you can only for the first click). Of course the same happens if you don't place an enemy.

              I got some fix but its Only true to a particular situation and its not a good generic solution.

              if there is one thing that is very Confusing and a little problematic is the
              initiative
              setup

              Any help will be appreciated

              cheers

              leo

              Comment


                Originally posted by Monokkel View Post

                Great that it worked I didn't think about the heath bar thing until now, however. How are you moving the unit? If you move the entire actor the health bar should come along for the ride. Are you only moving the skeletal mesh or something?
                We're spawning a character on BeginPlay as a child object of the BP_Unit which copies the skeletal mesh of the unit and then destroys the mesh components of the unit. We're only moving that character in realtime and set it's position at the beginning of turnbased combat.

                We found a confusing issue with the ConvertLocationToIndex3D method: there is a "CorrectedVector" output vector which we understood as the corrected position of the center of the tile but in fact it is an inversion of the input vector. Workaround for this: add ConvertIndexToLocation at the end of the ConvertLocationToIndex3D method as seen in the image. Or is the inversion of the input vector intentional and we missunderstood the purpose?

                Comment


                  Originally posted by leo bar View Post
                  hi knut

                  there is a problem with the initiative order I think. in order to reproduce the problem, try the following setup:

                  1. place a adv.grid manger on the level

                  2. place 2 adv. bp_unit on the grid (player)

                  3. place one adv. bp_unit on the grid, make it enemy ai and check the unaware

                  when you play you cant swap between unit (you can only for the first click). Of course the same happens if you don't place an enemy.

                  I got some fix but its Only true to a particular situation and its not a good generic solution.

                  if there is one thing that is very Confusing and a little problematic is the
                  initiative
                  setup

                  Any help will be appreciated

                  cheers

                  leo
                  Hey Leo, you'll get no objections from me on the initiative system being clunky. It has too many assumptions built into it, which makes anything but a D&D or XCOM-style initiative system a bit awkward. There are also just some weird choices in there in general, as this is a part of the toolkit I've been continuously tweaking instead of overhauling, leading to several sections that are somewhat hacked together. I'm finally getting around to refactoring it now, however, and I've begun work on refactoring it. Creating something that is both simple, clean and works as a base for several different types of initiative systems is challenging, but I can at least make something better than how it currently is.

                  To your particular issue, this arises because I've forgotten to update the SwapToUnit function to account for the TurnManager as an actor in initiative order (which was not the case originally). To fix this issue. Connect up the following Execs:


                  Originally posted by Dan.Ott View Post

                  We're spawning a character on BeginPlay as a child object of the BP_Unit which copies the skeletal mesh of the unit and then destroys the mesh components of the unit. We're only moving that character in realtime and set it's position at the beginning of turnbased combat.

                  We found a confusing issue with the ConvertLocationToIndex3D method: there is a "CorrectedVector" output vector which we understood as the corrected position of the center of the tile but in fact it is an inversion of the input vector. Workaround for this: add ConvertIndexToLocation at the end of the ConvertLocationToIndex3D method as seen in the image. Or is the inversion of the input vector intentional and we missunderstood the purpose?
                  Aha, I see. The cleanest solution if you want to keep the health bar might be to make a new one for your character, or possibly to attach the whole invisible unit actor to the character temporarily.

                  As for the CorrectedVector, I think that is something left over from an earlier version, and not something I think I'm currently using. Having this output the center location of the tile makes sense, though. I might set it up similarly to what suggest in the next version. You do not need to use the convert function after the GridManager has initalized, however. Just get the location from the GridLocations TMap, which is more efficient.
                  The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                  Comment


                    Hey Knut,

                    thanks for your helpful replies
                    We now realized that there's a grid size limitation of 200x200(causing an infinite loop error in this dimension - we did not get grid sizes above 128x128 working). As we reduced tile size to 1x1 meter and our levels have a size of ca 1x1 kilometer we need to reposition & recalculate the grid every time realtime movement ends & combat begins. We could not figure out by ourselves how to cleanly reposition the grid and reinitialize it according to the new location and surrounding obstacles etc. Simply recalling the methods which are in construction script does not solve the problem.

                    Comment


                      Originally posted by Dan.Ott View Post
                      Hey Knut,

                      thanks for your helpful replies
                      We now realized that there's a grid size limitation of 200x200(causing an infinite loop error in this dimension - we did not get grid sizes above 128x128 working). As we reduced tile size to 1x1 meter and our levels have a size of ca 1x1 kilometer we need to reposition & recalculate the grid every time realtime movement ends & combat begins. We could not figure out by ourselves how to cleanly reposition the grid and reinitialize it according to the new location and surrounding obstacles etc. Simply recalling the methods which are in construction script does not solve the problem.
                      No worries For huge maps you can increase the loop limit in Unreal Engine in project settings -> General Settings -> Maximum Loop Iteration Count. If you're uncomfortable with having the loop limit very high during runtime when it is only needed at startup you'll need to do a bit more work. I don't think you can reduce the loop limit through blueprints, but I assume this should be simple to do in C++. For a pure blueprint solution you would have to split the grid setup stuff over multiple ticks. I have some custom macros for doing this, but it will still require work.
                      The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                      Comment


                        hi all

                        1. knut - as usual thanks for the help and the time

                        Comment


                          Originally posted by leo bar View Post
                          hi all

                          1. knut - as usual thanks for the help and the time
                          Happy to help. Let me know if you run into any other issues. Thanks for making me aware of this one.
                          The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                          Comment


                            Originally posted by Monokkel View Post

                            No worries For huge maps you can increase the loop limit in Unreal Engine in project settings -> General Settings -> Maximum Loop Iteration Count. If you're uncomfortable with having the loop limit very high during runtime when it is only needed at startup you'll need to do a bit more work. I don't think you can reduce the loop limit through blueprints, but I assume this should be simple to do in C++. For a pure blueprint solution you would have to split the grid setup stuff over multiple ticks. I have some custom macros for doing this, but it will still require work.
                            Dan.ott, also do you have pregenerate gameplay grid checked in your grid manager ? Also I found in some docs setting max loop iteration limit is 2 billion.. that is what I have mine set at. Also, Ramas victory plugin (extra nodes) has a node to for max loop iterations that I have not tried, and I think you can use it to restart loop at certain loop count(have not really looked into it)

                            Also if you have alot of for each loops they all add up.. I have a map with 4 100x100 grids at different heights and alot of units and have not had a problem.. YET.
                            Hope this helps.

                            Comment


                              Originally posted by Monokkel View Post

                              No worries For huge maps you can increase the loop limit in Unreal Engine in project settings -> General Settings -> Maximum Loop Iteration Count. If you're uncomfortable with having the loop limit very high during runtime when it is only needed at startup you'll need to do a bit more work. I don't think you can reduce the loop limit through blueprints, but I assume this should be simple to do in C++. For a pure blueprint solution you would have to split the grid setup stuff over multiple ticks. I have some custom macros for doing this, but it will still require work.
                              Thanks! : )
                              Increasing the loop iteration count won't increase the maximum grid size I guess? So we need to figure out a workaround for the 1km x 1km sized map - of course we don't need turnbased pathfinding for the whole map in a single turnbased fight - so positioning the grid to the player's position when the combat starts would be fine. Which methods from the GridManager's construction script are required for repositioning the grid at runtime? Do we need to clear arrays or TMaps etc?

                              Comment


                                Originally posted by Skulldug View Post

                                Dan.ott, also do you have pregenerate gameplay grid checked in your grid manager ? Also I found in some docs setting max loop iteration limit is 2 billion.. that is what I have mine set at. Also, Ramas victory plugin (extra nodes) has a node to for max loop iterations that I have not tried, and I think you can use it to restart loop at certain loop count(have not really looked into it)

                                Also if you have alot of for each loops they all add up.. I have a map with 4 100x100 grids at different heights and alot of units and have not had a problem.. YET.
                                Hope this helps.
                                Do you use sub grids to get four grids in one level at the same time?

                                Comment

                                Working...
                                X