Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Originally posted by alukach View Post
    ...
    Thanks for the screenshots. I can't really see anything that would be causing this issue. Are you using the included default abilities or have you made any modifications to them? What ability is the unit using?

    Originally posted by 猫狗乱舞 View Post
    Now it's the big unit and AI problem. The target selection has been made,


    I don’t know how to get the pathfinding right. AI is a black box.

    maybe i need a switch to add decal in AI SimulateMovement, will be better for debug


    Assuming that uA is the target

    if my understanding is correct, uA should be ReachableUnits in "run pathfinding"(Should be use "run pathfinding until index found" as an AI?)
    Click image for larger version

Name:	02.jpg
Views:	113
Size:	18.3 KB
ID:	1832224

    And I hope he can ignore the Unit(uC) and obstacles on the path (the monster will destroy him)

    As a big unit, it seems that uA can be attacked in both the blue area and the yellow area.how to control the choice of AI

    I am now using "Search and add adjacent tiles pass through friend" to modify, adding a Monster Type, but there is no big unit modification
    Click image for larger version

Name:	06.png
Views:	101
Size:	101.8 KB
ID:	1832225
    Finding targets to attack is not really a problem when it comes to big units finding small units as targets (big units as targets is a bit more tricky for AI, though, but luckily you don't need it in your game). The range of the big unit just needs to be increased to include all tiles around itself, which is done by default in the included abilities.

    For your pathfinding you need to create a new pathfinding type based on Big, where tiles are still added to LocalOpenListChildTiles even if there is a unit on the tile. Your small units still need to use the regular Big pathfinding type to prevent them from entering one of the spaces of the big unit.

    With this in place, both uA, uB and uC should appear in ReachableUnits, provided they are in move range. You should not have to restrict the pathfinding by using "run pathfinding until index found". All that does is to cancel pathfinding when an index is found. If you know beforehand what your target is going to be then using it might save you a tiny bit of processing time, but it has no other benefits.

    I just remembered that you need to be aware of one more thing. Normally when you are using big units you want your small units to have a size of 1 and not a size of 0. What this does is to modify the big tile sizes so that big units are not allowed to move onto adjacent tiles where they would overlap the unit. The big size map is not modified when units end their movement if their size is 0. Since you want your big units to move onto the spaces of small units, small units in your special case should have Size set to 0.
    Advanced Turn Based Tile Toolkit (Marketplace - Support)

    Dungeon Crawler Toolkit (Marketplace - Support)

    Discord

    Comment


      pathfinding type based on Big
      Just connect it like this?
      Click image for larger version

Name:	08.png
Views:	84
Size:	78.0 KB
ID:	1833002

      The size modification did not work. On the picture, the monster chose 5002 as the moving target, obviously because 5002 and 5004 are the same distance for him.
      And with unitA as the target, move to 5002 is not right

      Click image for larger version

Name:	03.jpg
Views:	77
Size:	137.5 KB
ID:	1833003


      I understand that the possible problem is that the pathfinding type is changed in the loop
      Click image for larger version

Name:	07.png
Views:	74
Size:	114.9 KB
ID:	1833004

      Since I don’t know the principle well, I’m not sure if this is the problem, and I don’t know if it should be modified.

      Comment


        Originally posted by 猫狗乱舞 View Post
        pathfinding type based on Big
        Just connect it like this?
        Click image for larger version

Name:	08.png
Views:	84
Size:	78.0 KB
ID:	1833002

        The size modification did not work. On the picture, the monster chose 5002 as the moving target, obviously because 5002 and 5004 are the same distance for him.
        And with unitA as the target, move to 5002 is not right

        Click image for larger version

Name:	03.jpg
Views:	77
Size:	137.5 KB
ID:	1833003


        I understand that the possible problem is that the pathfinding type is changed in the loop
        Click image for larger version

Name:	07.png
Views:	74
Size:	114.9 KB
ID:	1833004

        Since I don’t know the principle well, I’m not sure if this is the problem, and I don’t know if it should be modified.
        Hmm, I'll have to do some testing myself to figure out what might be going on here. Lots of different systems interacting here that I don't normally use together. Might be a few days before I have the time, but here is something you can try before then: Store GridUnits in a temporary variable, then clear GridUnits. Add back the target unit and the big unit to GridUnits. Then run all the AI code. Since all units but the target are not in GridUnits they will be ignored and treated as empty spaces (this presupposes that the units all have a size of 0 so that the big indexes are not affected by them). After the AI unit has found a path to the target reset GridUnits by setting it to the values in your temporary variable. Then proceed with the ability as normal.
        Advanced Turn Based Tile Toolkit (Marketplace - Support)

        Dungeon Crawler Toolkit (Marketplace - Support)

        Discord

        Comment


          I have a few questions in regards to targeting. recently you helped me with the movement system. I guess ill start my understanding of how it works and how it applies to my goal so far.
          • the ai dosent select a target based on name
          • the ai targets via faction priority meaning in a list of 5 factions all ai will target faction 1 first unless its part of faction 1 or friendly with faction 1
          • the ai targets the tile or possibly the closest thing to that tile if nothing is on that tile
          for me that is alot of information cause it lets me know what i need to work with. soo my understanding goes something like this
          1. find all faction enemies
          2. find tiles of all enemies
          3. prioritize faction 1 -> 2 -> 3 -> 4 and so on
          4. prioritize survival and damage out put.
          5. figure out best pathing to target
          sooo now on my goal
          • force ai to target by names
          i figured i could do one of two methods to make this work.
          1. have bp_ability find the index of the target by searching the name given by the player
          2. have bp_ability save the location index of the of all the units after each turn and have the outside program read the files and pair them to the target names
          obviously i would prefert to do method 1 however if thats not possible i can proceed with method 2. the only issue i would have with method 2 is that i would always have to make the enemy ai go first in order to get locations for players to target. i would also have to preset each unit per map into the outside program in order to insure every enemy was properly target-able.

          with all that said, any opinions? did i misunderstand something?

          Comment


            soo in an attempt to add a blueprint function library, i ran in to this error.
            Click image for larger version

Name:	the error.jpg
Views:	54
Size:	26.4 KB
ID:	1833580 Click image for larger version

Name:	error in line.jpg
Views:	49
Size:	56.6 KB
ID:	1833581
            i dont know whats going on. or how to fix this.

            Comment


              LuxJahi: Hi, the AI faction priority seems like something that could be handled within EvaluateTargets or FindTargetValue in your ability. If you override FindTargetValue you can modify the value of a unit based on its faction. Check out FindTargetValue in BP_Ability_Laser for an example of how to modify the value assigned to a target based on some property (in this case its health and distance from our unit). I'm a bit confused about part of your question, though. Do you want to target a unit based on its name, faction or both? If you get everything working the way you want it how would it look in game?

              I'm afraid I don't know the reason for your error regarding the function library. That is a more general UE4 question than an ATBTT one, though, so you will hopefully be able to get help in the regular UE4 support channels.
              Advanced Turn Based Tile Toolkit (Marketplace - Support)

              Dungeon Crawler Toolkit (Marketplace - Support)

              Discord

              Comment


                Hello, I tracked the value and found that except "passThroughFriendly", this loop will not be triggered, resulting in the output value of StartIndex
                Click image for larger version

Name:	09.png
Views:	30
Size:	171.4 KB
ID:	1834325
                Click image for larger version

Name:	10.png
Views:	30
Size:	152.6 KB
ID:	1834326


                Eventually it will be converted to passThroughFriendly, making PathFindingType inoperative

                Comment


                  Hey Knut

                  Hopefully a simple question, How would you get the post process material to work in 3d as it does in the 2d example level?

                  Comment


                    Originally posted by 猫狗乱舞 View Post
                    ...
                    Hmm, the pathfinding change I suggested seems to work on my end. Here are the steps.

                    1) I create a level with a square grid and set MaxUnitSize to 3 or greater.
                    2) I add an Enemy AI unit with a size of 3 and the MoveAttack ability
                    3) I modify SearchAndAddTilesCustom1 in the same way you did in your screenshot.
                    4) I add two player units, both with size set to 0. I reduce current health of one of them to make the AI prioritize it and place the other unit between the damaged unit and the AI unit.
                    5) I get the following result:



                    As you can see, the big unit moves into the space of the front one in order to attack the one behind. This is the result you want, right?

                    Originally posted by OF-9Task View Post
                    Hey Knut

                    Hopefully a simple question, How would you get the post process material to work in 3d as it does in the 2d example level?
                    Hi 9Task, it is both a really simple or very difficult question depending on what you're after. If you have a 3D map with no or very slight height differences between tiles it is simple to use the post process approach. You need to do the following:

                    1) Add an unbound post-processing volume to your map
                    2) Add the PP_Outline post processing material to this volume
                    3) In the ability you are using, change material of TileMarkersMove to something non-translucent
                    4) in the rendering settings of TileMarkersMove disable RenderInMainPass and RenderInDepthPass and enable RenderInCustomDepthPass
                    5) If you want to have a similar outline to the one in Hydra's Lair, choose a static mesh for TileMarkersMove that is large enough to be flush with its neighbors, such as SimplePlane

                    And there you go:


                    Looks nice, doesn't it! And provided you have a pretty flat map you're happy.

                    However, the problem arises as soon as you have height differences that are such that tile markers from higher levels overlap the ones on lower levels, and you get the following depressing result:



                    If you can figure out how to fix this problem I owe you a beer :P But perhaps you're using flat maps or are fine with designing your levels so that these sorts of overlaps will not occur. There are other ways to create outlines and I have experimented with various approaches, but so far I'm yet to find one that is clean and performant enough that I've wanted to include it in the kit.
                    Advanced Turn Based Tile Toolkit (Marketplace - Support)

                    Dungeon Crawler Toolkit (Marketplace - Support)

                    Discord

                    Comment


                      Originally posted by Monokkel View Post
                      ……

                      Hello,Thank you, That's it.
                      i modified "ability_move" before. It seems that the logic used is different from "MoveAttack".



                      But using this method, there is a problem

                      range is 2(And in the unit config, the range will be forcibly set)
                      I tested it, the range seems to be the red area centered on the grid index
                      Click image for larger version

Name:	04.jpg
Views:	26
Size:	17.1 KB
ID:	1834672
                      the range does not seem to be affected by the big unit, so the wrong position will appear


                      I think the correct melee range (range 1)
                      Click image for larger version

Name:	05.jpg
Views:	25
Size:	17.1 KB
ID:	1834673

                      Comment


                        Originally posted by 猫狗乱舞 View Post


                        Hello,Thank you, That's it.
                        i modified "ability_move" before. It seems that the logic used is different from "MoveAttack".



                        But using this method, there is a problem

                        range is 2(And in the unit config, the range will be forcibly set)
                        I tested it, the range seems to be the red area centered on the grid index
                        Click image for larger version

Name:	04.jpg
Views:	26
Size:	17.1 KB
ID:	1834672
                        the range does not seem to be affected by the big unit, so the wrong position will appear


                        I think the correct melee range (range 1)
                        Click image for larger version

Name:	05.jpg
Views:	25
Size:	17.1 KB
ID:	1834673
                        So the idea with locking the range for big units works well for units of sizes 3 and 5. A unit of size 3 that wants to attack units adjacent to itself needs to have a range of 2, since a range of 1 will extend only to the tile it is occupying itself (from its center). For units of size 2 and 4 it is a bit more tricky, since the units don't have a center tile, but are instead offset to the top-left of their center. This means that we will have to trim away tiles to the top and left of tiles in range or we get the following:


                        This can be remedied by making the following changes to GetIndexesInRange:

                        Which gets us this:


                        Dependent on the AI of your abilities this might be sufficient.
                        Advanced Turn Based Tile Toolkit (Marketplace - Support)

                        Dungeon Crawler Toolkit (Marketplace - Support)

                        Discord

                        Comment


                          Thank you very much, sorry, I have too many questions


                          After many tests, some problems still occur occasionally.

                          Even if size3 is used, occasionally it will occupy the position of Target (range2)


                          Is it because of the diamond type I used。。。。。

                          Is it correct that all the Size Adjustments in AI are set to 0? Isn't there no adjustment? .


                          Click image for larger version  Name:	06.jpg Views:	0 Size:	196.1 KB ID:	1835659



                          The "Find path to tile in range" target index is connected to the start index. What are the parameters of the output "in range tiles"?
                          Last edited by 猫狗乱舞; 11-24-2020, 09:12 AM.

                          Comment

                          Working...
                          X