Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Originally posted by Monokkel View Post
    Could you give me the repro steps for the issue you are still having? I'm not absolutely sure how to set things up like your example as the target player unit is not visible and I do not know which of your custom tiles are impassable/have higher costs.
    Here's a less terrible example.



    The two engineers in the middle are set to not move for this example, while the two on the left are set to behave normally.

    The first unit on the right moves to the open space to the left of the left engineer, the second one moves to the space behind the right engineer, when the space above the left engineer is open and closer to its target.

    I'm guessing this issue occurs because the pathfinding determines the most direct path to the target to be along the bottom, but doesn't take into account closer open spaces due to it being designed around the standard pathfinding which would never need to take that into consideration.
    Last edited by Selentic; 02-10-2017, 06:33 PM.

    Comment


      Thanks for the detailed example, [MENTION=16997]Selentic[/MENTION]. You are correct in the cause of the problem The unit first calculates the quickest path to the tank, ignoring friendly units. This path includes mostly just tiles in the bottom row of tiles in your screenshot and not the ones above them. On this path, the closest possible tile is the one the unit ends up walking to. To fix this you can have the AI evaluate every possible tile it can move to and compare it to a criteria. In this case, after the AI unit has chosen its target you can loop through the Index Can Move To Array and for each index check the distance in tiles between that tile and the tile index of the target using the Get Distance Between Tiles function. The one that returns the lowest value is the index you set to be the target index of the AI unit's move. You still won't get perfect results 100% of the time with this solution (it does not take into account obstacles which might make some tiles worse choices), but in most cases it should work fine.

      Edit: Actually, scrap that. I gave it some more thought and there will be many cases where this new solution will give you a worse outcome. I have another idea that should work better. After pathfinding store the CanMoveToArray in a new, separate array. Then run a new pathfinding from the tile index of the target unit (the tank). Set the move range to equal the cost of getting all the way to the tank minus the cost of getting to the tile found using the Find Closest Reachable Tile (Pass Through Friendlies) function. In this case that would be 11 (cost of getting to tank) - 3 (cost of getting to the tile the unit moves to in the bottom screenshot). Then, loop through the IndexCanMoveToArray and compare each index to the old CanMoveTo array you stored previously. Find the tile with the lowest cost and you have your target.

      This is a pretty heavy duty way of doing this, but it should at least get the best tile every time. If I think of something more elegant I'll let you know.
      Last edited by Monokkel; 02-10-2017, 08:31 PM.
      The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

      Comment


        Originally posted by Monokkel View Post
        Edit: Actually, scrap that. I gave it some more thought and there will be many cases where this new solution will give you a worse outcome. I have another idea that should work better. After pathfinding store the CanMoveToArray in a new, separate array. Then run a new pathfinding from the tile index of the target unit (the tank). Set the move range to equal the cost of getting all the way to the tank minus the cost of getting to the tile found using the Find Closest Reachable Tile (Pass Through Friendlies) function. In this case that would be 11 (cost of getting to tank) - 3 (cost of getting to the tile the unit moves to in the bottom screenshot). Then, loop through the IndexCanMoveToArray and compare each index to the old CanMoveTo array you stored previously. Find the tile with the lowest cost and you have your target.

        This is a pretty heavy duty way of doing this, but it should at least get the best tile every time. If I think of something more elegant I'll let you know.
        I guess it's not really avoidable since the first solution would definitely cause lots of issues. I already did something very similar for turn changes where it orders ai pawn initiative by running pathfinding on each until it hits either an upper limit or an enemy pawn, so it should be easy enough to apply this here since it's pretty similar.

        thx

        E:Also if this helps you work, my solution up above of unchecking continue previous pathfinding can cause an infinite loop where it gets stuck permanently searching in certain circumstances, which is easily rectified by adding a simple boolean to it so that once it starts it doesn't clear it and start over and functions like you intended, but I spent far too long trying to track that down today.
        Last edited by Selentic; 02-10-2017, 11:52 PM.

        Comment


          Hey Monokkel. Whenever I load/package my levels, the output log gets spammed with messages to this effect.



          It doesn't cause any issues, but it does make it a hassle to find information I need under a humongous pile of warnings. Any idea how to fix this?

          Comment


            I'm actually working on a fix for this already. This message log spamming when the game starts is caused by the functions generating the edge arrays trying to access tiles to the north of the norternmost row of tiles and south of the southernmost row. To prevent this I'll just have to add a branch that checks that we are not accessing tile indexes that are beyond the bounds of the grid. As you say it does not cause any actual issues, but this sort of message spam is of course annoying. My plan is to fix this before sending the new update to Epic.
            The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

            Comment


              So 4.15 is here and though I said my new update would be done at around the same time I need a few more days for bug fixing and polish. It is right around the corner, though. In the meantime the 4.14 version of ATBTT runs in 4.15 without any issues.
              The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

              Comment


                Legendary

                Comment


                  Okay, after months of work I've just sent update 1.7 to Epic. It is the biggest update I've done so far. There is a lot of stuff included in this update. I’ll list the most important ones, but there have also been a multitude of other small fixes and changes over the past months and listing all of it would take ages and not be very interesting. In most cases the parts where I’ve made changes in blueprints will be marked by a boolean called Version 1.7. Search for this variable in any blueprint to navigate to the changes if you want details. But to give an overview of the update in broader strokes, here is a list of changes and additions:

                  v1.7 (being processed by Epic)
                  • New example map of an XCOM-style turn based tactics game, including the following:
                    • Skill system (with premade skills laser beam, explosive shot, overwatch, heal and mind control. Particle effects borrowed from Infinity Blade assets.
                    • Advanced AI to work along with the skill system to assess and select the best skill and location depending on the situation.
                    • UI for selecting skills.
                    • AI units in example map begin the game inactive and enter the combat if hearing or spotting a unit or being damaged (handy for stealth games).
                    • Cover system
                    • Dodge, accuracy, random damage ++
                    • An awesome selection of creative commons sci-fi assets. Skeletal meshes have been rigged by u/Bankworthy (thanks!)
                  • Edge scrolling and scroll limits.
                  • New WallTrace trace channel to improve automatic map generation.
                  • Basic VR example map for room-scale VR board games with motion controls.
                  • VR example unit that gets materials and attributes set automatically based on faction and range.
                  • Win condition added back. Now works with blueprint nativization due to new function library set to not be nativized.
                  • Disable rotation in BP_GridManager now works as intended.
                  • Fixerd bug that causes units to consider all units to be friendly (felt like Ford in Westworld fixing this one :,( )
                  • Added new functions for searching for and selecting units in range. Greatly improves efficiency of calculations in AI Controller.
                  • Various bug fixes and performance improvements for functions.


                  I think that should be most of it. Fingers crossed for Epic uploading this to the marketplace soon. Hope you guys will have fun with all the new features!
                  The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                  Comment


                    Originally posted by Selentic View Post
                    Hey Monokkel. Whenever I load/package my levels, the output log gets spammed with messages to this effect.



                    It doesn't cause any issues, but it does make it a hassle to find information I need under a humongous pile of warnings. Any idea how to fix this?
                    Ok, now this is fixed in the new update, but since you've mentioned that you probably won't convert it, here is what you need to fix. The problem is that the functions that set up the edge arrays sometimes try to search outside the grid. This can be fixed with some reorganization and a couple of branches. Remove the Create Walls On Grid Edges function from the Event Graph and Construction Script of BP_GridManager. Instead place it inside the Add Viewport Terrain to Arrays function at this exact spot:

                    Click image for larger version

Name:	ykFVfXD.png
Views:	1
Size:	207.6 KB
ID:	1123214

                    Now, in both the Remove Edges On East And West Side Of Grid and Remove Edges On North And South Side Of Grid functions add a branch to check that the index outputted from the reverse foreach loop is greater than -1

                    Click image for larger version

Name:	5PipPC8.png
Views:	1
Size:	170.1 KB
ID:	1123215

                    Lastly in the Vector to Index 3D function (also in BP_GridManager) change this number from 1 to 2:

                    Click image for larger version

Name:	pi7UUJh.png
Views:	1
Size:	120.5 KB
ID:	1123216

                    Unless I missed something that should do the trick.
                    The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                    Comment


                      Excellent, Thank you.

                      Comment


                        Originally posted by Monokkel View Post
                        Okay, after months of work I've just sent update 1.7 to Epic. It is the biggest update I've done so far. There is a lot of stuff included in this update. I’ll list the most important ones, but there have also been a multitude of other small fixes and changes over the past months and listing all of it would take ages and not be very interesting. In most cases the parts where I’ve made changes in blueprints will be marked by a boolean called Version 1.7. Search for this variable in any blueprint to navigate to the changes if you want details. But to give an overview of the update in broader strokes, here is a list of changes and additions:

                        v1.7 (being processed by Epic)
                        • New example map of an XCOM-style turn based tactics game, including the following:
                          • Skill system (with premade skills laser beam, explosive shot, overwatch, heal and mind control. Particle effects borrowed from Infinity Blade assets.
                          • Advanced AI to work along with the skill system to assess and select the best skill and location depending on the situation.
                          • UI for selecting skills.
                          • AI units in example map begin the game inactive and enter the combat if hearing or spotting a unit or being damaged (handy for stealth games).
                          • Cover system
                          • Dodge, accuracy, random damage ++
                          • An awesome selection of creative commons sci-fi assets. Skeletal meshes have been rigged by u/Bankworthy (thanks!)
                        • Edge scrolling and scroll limits.
                        • New WallTrace trace channel to improve automatic map generation.
                        • Basic VR example map for room-scale VR board games with motion controls.
                        • VR example unit that gets materials and attributes set automatically based on faction and range.
                        • Win condition added back. Now works with blueprint nativization due to new function library set to not be nativized.
                        • Disable rotation in BP_GridManager now works as intended.
                        • Fixerd bug that causes units to consider all units to be friendly (felt like Ford in Westworld fixing this one :,( )
                        • Added new functions for searching for and selecting units in range. Greatly improves efficiency of calculations in AI Controller.
                        • Various bug fixes and performance improvements for functions.


                        I think that should be most of it. Fingers crossed for Epic uploading this to the marketplace soon. Hope you guys will have fun with all the new features!
                        Ok this makes me excited

                        Comment


                          Hi Monokkel,
                          I've tested the Spawn Unit function and it's working well (I added a Spawn Unit node to the end of the Activate Grid Manager graph). But my Unit_Player can't target spawned enemies and the player can walk into tiles occupied by spawned units. Is there a way to fix these problems?
                          Last edited by cbdeakin; 02-18-2017, 10:03 PM.

                          Comment


                            Hey Mon!
                            The new update sounds great, when do you think it would be up for grabs?
                            Also is the nativize completely working now?

                            Comment


                              Originally posted by cbdeakin View Post
                              Hi Monokkel,
                              I've tested the Spawn Unit function and it's working well (I added a Spawn Unit node to the end of the Activate Grid Manager graph). But my Unit_Player can't target spawned enemies and the player can walk into tiles occupied by spawned units. Is there a way to fix these problems?
                              Seems like there is a bug in the Spawn Unit function. Don't know how it appeared, since it was working before, but it is very simple to fix. You need to connect the output from the SpawnActor node inside the Spawn Unit function to the input of the Set Array Element node. Like so:

                              Click image for larger version

Name:	Kze6kgY.png
Views:	1
Size:	177.3 KB
ID:	1123578

                              Originally posted by LDodds View Post
                              Hey Mon!
                              The new update sounds great, when do you think it would be up for grabs?
                              Also is the nativize completely working now?
                              Not sure when it will be uploaded. That is up to Epic. It usually takes about a week. Nativize should work both in the new update and the one currently on the marketplace.
                              The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                              Comment


                                Cant wait, thanks for keeping this going!

                                Comment

                                Working...
                                X