Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Originally posted by 猫狗乱舞 View Post
    hi,Sorry, I put two types of effects on one picture, which caused you trouble


    The current one is parabolic
    Click image for larger version Name:	4.jpg Views:	0 Size:	29.4 KB ID:	1829412


    Another method is to check whether it encounters obstacles and collisions during the rejection process.


    unitA should be knocked back to 8 normally, but collided with unitB(barrier) at 4 and stopped at 3.
    Click image for larger version Name:	5.jpg Views:	0 Size:	32.3 KB ID:	1829413
    ok, I think I understand now, but to be able to code this I need to know about what should happen in special cases. What if A stands on [1] and B stands on [2]. Then a third unit (C) moves on top of tile [1], repelling unit A. However, this is blocked by unit B. Because of this unit A wants to remain on tile [1], but now unit C is standing on that tile, so what should happen?

    Originally posted by Halrawk View Post
    No worries at all! I just treat it as a way to learn the toolkit better
    Silver lining, I guess
    Advanced Turn Based Tile Toolkit (Marketplace - Support)

    Dungeon Crawler Toolkit (Marketplace - Support)

    Discord

    Comment



      Sorry, there was an unexpected problem

      Under the general rules, in order to avoid this situation, the unitC that caused the knockback effect is standing in place and will not occupy the position of A.(like <into the breach>)

      However, this is the trampling effect when the monster moves, so it will enter the position of other units. Maybe unitA can't stop because of the collision. I will add a knockdown effect(status effect,Already done) to unitA and B when the collision occurs.So there is enough safety distance

      Click image for larger version

Name:	6.jpg
Views:	110
Size:	31.2 KB
ID:	1829742


      The main difficulty is the movement caused by the knockback, and the collision check
      Maybe I have a better plan in the future, and I can also modify it

      Comment


        Hey Knut, I hope you are doing well. Got a good progress in the last weeks

        Just a short question. On a normal squaregrid when a tile is impassable and I make it passable at runtime (cost1) units will avoid that tile while pathfinding. So it looks a bit strange on the map. Can you please point me where to fix that? As the costs are always 1 currently. I have added a screenshot to clearify. 3007 was impassable then passable again.

        Big thanks in advance.
        Attached Files

        Comment


          Originally posted by 猫狗乱舞 View Post
          Sorry, there was an unexpected problem

          Under the general rules, in order to avoid this situation, the unitC that caused the knockback effect is standing in place and will not occupy the position of A.(like <into the breach>)

          However, this is the trampling effect when the monster moves, so it will enter the position of other units. Maybe unitA can't stop because of the collision. I will add a knockdown effect(status effect,Already done) to unitA and B when the collision occurs.So there is enough safety distance

          Click image for larger version  Name:	6.jpg Views:	0 Size:	31.2 KB ID:	1829742


          The main difficulty is the movement caused by the knockback, and the collision check
          Maybe I have a better plan in the future, and I can also modify it
          Ok, thanks for the explanation. This is a mix of game design and programming, so we'll have to think about all special cases regarding the rules to make this work as you want it. I'll continue to suggest things one step at a time, so I do not waste both of our time by trying to solve all the problems in one go and potentially giving you something that is different from what you have in mind.

          So this time let us start with knockback that stops if it is blocked by a unit or terrain. I have made a new knockback function that checks tiles in a line in the direction of the knockback and returns an array of grid indexes representing the path of the knockback:



          Then a couple of modifications to the code we added last:




          Now knockback is stopped if blocked by units or there is no edge between any of the tiles on the path (meaning that the tiles are not connected, likely due to blocking terrain):



          If you get this working and it works as you expect we can move on to the next step.

          Originally posted by Infest1908 View Post
          Hey Knut, I hope you are doing well. Got a good progress in the last weeks

          Just a short question. On a normal squaregrid when a tile is impassable and I make it passable at runtime (cost1) units will avoid that tile while pathfinding. So it looks a bit strange on the map. Can you please point me where to fix that? As the costs are always 1 currently. I have added a screenshot to clearify. 3007 was impassable then passable again.

          Big thanks in advance.
          Hi Infest, glad to see your game is progressing! Looks great from the screenshot I'm assuming you're using the MakeTilePassable and MakeTileImpassable functions. These functions are a bit "stupid", in the sense that they don't have much information about the map and are a bit limited in their usefulness.

          MakeTileImpassable removes all edges heading to this tile from neightboring tiles and removes all edges from the tile itself. This function is generally unproblematic. However, MakeTilePassable works a bit unintuitively. It gets neighboring tiles and tries to add edges both ways to those tiles, provided these tiles already have at least one edge. This rule means that if you make several adjacent tiles impassable and then try to connect them using MakeTilePassable you might get some incorrect results where tiles are not connected because none of them have any edges. The function will also ignore things like walls etc. and connect the tile to its neighbor no matter what.

          I have added a more flexible and intelligent variant later called UpdateTilesInRange, which essentially runs the grid setup code during runtime in a specified area, taking into account wall collision, height differences etc. (though not tile actors). You can use this instead. If you do, make sure you set the range of the function so that it includes the neighbors of all tiles you have modified.

          However, if you have a game where you are planning to make tiles passable and impassable frequently (and globally, not just one edge, but for the entire tile), I recommend looking into a "hidden" feature of the toolkit called Simple Edges. If you set bUseSimpleCosts to true. This populates a grid sized map variable in the grid manager called GridSimpleCosts, which hols global move costs of entering a tile. All tiles get a cost of 1 at startup. If you set a tile's simple cost to 0 it becomes impassable.

          This makes it much easier to work with blocking and opening up tiles (and adding/removing difficult terrain) for games that don't need to fiddle too much with individual edge costs. After enabling it you also need to set the pathfinding type of your units to simple. The regular edge costs will still function as normal, but if there is a difference between the regular and simple costs of entering a tile, this pathfinding type will use the highest cost of the two (blocked being the highest possible costs).

          If you enable simple costs you can even use regular BP_GA_Tile actors to modify it. They have a SimpleCost variable that will be used if this is enabled in the grid manager.


          Last edited by Monokkel; 11-06-2020, 03:35 PM.
          Advanced Turn Based Tile Toolkit (Marketplace - Support)

          Dungeon Crawler Toolkit (Marketplace - Support)

          Discord

          Comment


            Originally posted by Monokkel View Post

            Hi Infest, glad to see your game is progressing! Looks great from the screenshot I'm assuming you're using the MakeTilePassable and MakeTileImpassable functions. These functions are a bit "stupid", in the sense that they don't have much information about the map and are a bit limited in their usefulness.

            MakeTileImpassable removes all edges heading to this tile from neightboring tiles and removes all edges from the tile itself. This function is generally unproblematic. However, MakeTilePassable works a bit unintuitively. It gets neighboring tiles and tries to add edges both ways to those tiles, provided these tiles already have at least one edge. This rule means that if you make several adjacent tiles impassable and then try to connect them using MakeTilePassable you might get some incorrect results where tiles are not connected because none of them have any edges. The function will also ignore things like walls etc. and connect the tile to its neighbor no matter what.

            I have added a more flexible and intelligent variant later called UpdateTilesInRange, which essentially runs the grid setup code during runtime in a specified area, taking into account wall collision, height differences etc. (though not tile actors). You can use this instead. If you do, make sure you set the range of the function so that it includes the neighbors of all tiles you have modified.

            However, if you have a game where you are planning to make tiles passable and impassable frequently (and globally, not just one edge, but for the entire tile), I recommend looking into a "hidden" feature of the toolkit called Simple Edges. If you set bUseSimpleCosts to true. This populates a grid sized map variable in the grid manager called GridSimpleCosts, which hols global move costs of entering a tile. All tiles get a cost of 1 at startup. If you set a tile's simple cost to 0 it becomes impassable.

            This makes it much easier to work with blocking and opening up tiles (and adding/removing difficult terrain) for games that don't need to fiddle too much with individual edge costs. After enabling it you also need to set the pathfinding type of your units to simple. The regular edge costs will still function as normal, but if there is a difference between the regular and simple costs of entering a tile, this pathfinding type will use the highest cost of the two (blocked being the highest possible costs).

            If you enable simple costs you can even use regular BP_GA_Tile actors to modify it. They have a SimpleCost variable that will be used if this is enabled in the grid manager.

            Unbelivable, instant working and saves me a lot of extra work. Big, big Thanks Knut ))
            Last edited by Infest1908; 11-06-2020, 08:20 PM.

            Comment



              Hello, thank you very much, this is the effect, I am ready to learn more

              Comment


                Originally posted by Infest1908 View Post

                Unbelivable, instant working and saves me a lot of extra work. Big, big Thanks Knut ))
                Glad it worked

                Originally posted by 猫狗乱舞 View Post
                Hello, thank you very much, this is the effect, I am ready to learn more
                Ok, so I guess the next step is to have a unit move through the spaces of multiple units and knock them all away during movement. I relaized when I started working on this that I will need some more info from you.

                Say I am in this situation. I want to move through all of these units and knock them back along the way. what tiles would each of these units end up on?

                Advanced Turn Based Tile Toolkit (Marketplace - Support)

                Dungeon Crawler Toolkit (Marketplace - Support)

                Discord

                Comment



                  Very thoughtful hypothesis, even added obstacles

                  So I think it can be simpler

                  Use knockdown (a status) replaces knockback on the path, only when the final position occupies another unit's tile, knock it back

                  When at the border of the map, knock back randomly to the left or right(Suppose the knockback distance is 5)

                  Click image for larger version

Name:	7.jpg
Views:	108
Size:	210.7 KB
ID:	1830317

                  Comment


                    Hi Monokkel,

                    I'm redirecting here the question from Questions section on the EGS page:

                    My pawn starting 'Attack' animation prior to finishing 'Walk/Idle' animation. Where can I specify that the next animation should be played after finishing the previous one? Below is an example:



                    I'm little bit lost in the structure of blueprints and cannot find where I can diagnose queueing delay for performing animations or tick on a check box for playing next animation after finishing previous.

                    I was following your tutorials of custom skeleton animations by simply replacing animations and didn't modified action manager(at least tried). I'm pretty sure that I'm asking very noob question

                    Thanks.
                    Last edited by alukach; 11-08-2020, 06:33 PM.

                    Comment


                      Originally posted by 猫狗乱舞 View Post
                      Very thoughtful hypothesis, even added obstacles

                      So I think it can be simpler

                      Use knockdown (a status) replaces knockback on the path, only when the final position occupies another unit's tile, knock it back

                      When at the border of the map, knock back randomly to the left or right(Suppose the knockback distance is 5)

                      Click image for larger version

Name:	7.jpg
Views:	108
Size:	210.7 KB
ID:	1830317
                      ok, so work obligations the next few days means I don't have the time to test this out for you until later, but I'll give you what I was planning to do and you can see if you're able to get it working:

                      the final knockdown part is pretty close to done now (not counting big units and AI). You just need to get the appropriate random tile. You could use GetIndexes in range, loop over the indexes and filter out those at the appropriate ranges. Then you could check if those tiles are blocked for knockback (based on the function I provided). If not you would proceed with the knockback. If they are blocked you would continue looping over the indexes in range until you found one that was not blocked.

                      As for knockdown you probably want to use status effects for knockdown. Check out the mind control status effect for an example that isn't too different. It has an effect on activation and when the unit ends its turn. You might want to have an effect at the start of the unit's turn for getting up instead of at the end of its turn.

                      The status effects would be added to units while the big unit is moving. Before unit movement you can bind an event to OnUnitEnterTileSimulate (called on the GridManager from BP_Unit). In this event you would check for any units on this tile and add/activate the knockdown status effect to these units. This would handle the game logic part of the equation.

                      Next for animation. This is trickier as the toolkit doesn't play too well with interruped actions (this is one of the things I've worked on improving in the coming update), but we can get there. The most "proper" way might be to make use of event dispatchers and OnUnitEnterTileAnimate, but we should be able to achieve the same thing more quickly and easily, if a bit more hacky, using collision. For this you want to add collision capsules to your units. They should overlap each other, but other than that not block or overlap anything. When your big unit is moving you would check for overlap events. If it overlaps a unit you would look for the AbilitySystem component and see if it contains a knockdown status effect. If it does you would play your knockdown animation. You would not need to use an action if you do it this way since it is not queued and happens immediately (though you could use an action set to immediate if you wanted to be able to also call the knockdown animation as a queued action for something else).

                      Ok, that is the outline of what I want to try. See if you are able to make it work, and if not get back to me and I'll give it a try once I have the time.

                      Originally posted by alukach View Post
                      Hi Monokkel,

                      I'm redirecting here the question from Questions section on the EGS page:

                      My pawn starting 'Attack' animation prior to finishing 'Walk/Idle' animation. Where can I specify that the next animation should be played after finishing the previous one? Below is an example:



                      I'm little bit lost in the structure of blueprints and cannot find where I can diagnose queueing delay for performing animations or tick on a check box for playing next animation after finishing previous.

                      I was following your tutorials of custom skeleton animations by simply replacing animations and didn't modified action manager(at least tried). I'm pretty sure that I'm asking very noob question

                      Thanks.
                      Hey, there could potentially be a few different things causing this. Perhaps you are ending an action too early or not queueing them appropriately. Could you show me your code for how you are calling these animations? Make sure you have seen my action system tutorial if you have not done so already. There I get into how you can get things to play in sequence.
                      Advanced Turn Based Tile Toolkit (Marketplace - Support)

                      Dungeon Crawler Toolkit (Marketplace - Support)

                      Discord

                      Comment


                        Thanks, thank you for your guidance, I also prefer to do it myself, better than copying homework

                        But I have some understanding to confirm

                        “BindOnUnitEnterTileSimulate”

                        Will this happen?” The enemy on the path has been knocked down before the character moves.“

                        Should I use "Bind OnUnit EnterTileAnimate" to be more reasonable?


                        Click image for larger version  Name:	01.jpg Views:	0 Size:	16.4 KB ID:	1831427

                        Due to a small problem, it was not verified,
                        The result of "find" is Executor himself,
                        Click image for larger version  Name:	02.png Views:	0 Size:	87.1 KB ID:	1831428


                        Of course, using "collision capsules" seems easier, but it feels a bit different from the whole system.
                        If you suggest me to do this, I will try to use




                        When I was reviewing, I had a doubt, what is the difference between "remove unit from grid", "add unit to grid" and "setActorLocation" in Telepoter's tutorial
                        Last edited by 猫狗乱舞; 11-11-2020, 10:32 AM.

                        Comment


                          report

                          the “collision ”meets expectations
                          Click image for larger version  Name:	04.png Views:	0 Size:	64.4 KB ID:	1831794

                          I have chosen to ignore
                          it will repeatedly collide with bp_gridcamara

                          Click image for larger version

Name:	05.png
Views:	95
Size:	28.6 KB
ID:	1831835
                          Click image for larger version

Name:	03.png
Views:	93
Size:	55.1 KB
ID:	1831836

                          Even bp_gridcamara Set Generate overlap events to false


                          But this is a small problem, just affects efficiency. Can be optimized
                          Last edited by 猫狗乱舞; 11-12-2020, 07:19 AM.

                          Comment


                            Originally posted by 猫狗乱舞 View Post
                            Thanks, thank you for your guidance, I also prefer to do it myself, better than copying homework

                            But I have some understanding to confirm

                            “BindOnUnitEnterTileSimulate”

                            Will this happen?” The enemy on the path has been knocked down before the character moves.“

                            Should I use "Bind OnUnit EnterTileAnimate" to be more reasonable?
                            If you want to use these you need to do both, actually. Simulate for the game logic (adding the status effect etc) and animate for when you animate the knockdown effect. To see an example of this, check out the overwatch status effect in the Experimental folder which uses both simulate and animate. It is pretty close to what you are after.


                            Originally posted by 猫狗乱舞 View Post
                            Click image for larger version Name:	01.jpg Views:	0 Size:	16.4 KB ID:	1831427

                            Due to a small problem, it was not verified,
                            The result of "find" is Executor himself,
                            Click image for larger version Name:	02.png Views:	0 Size:	87.1 KB ID:	1831428
                            hmm yeah. did not think of that. the simulate event happens after the moving unit has entered the tile, replacing the previous unit reference on that tile with a reference to itself... Hmm, that is a bit tricky to fix. I guess you would have to modify SimulateMove for the unit so that AddUnitToGrid is not called until movement is done, so it does not override the references of the units along the path.


                            Originally posted by 猫狗乱舞 View Post
                            [ATTACH=JSON]Of course, using "collision capsules" seems easier, but it feels a bit different from the whole system.
                            If you suggest me to do this, I will try to use
                            You're right that it goes against how the system is designed. You might consider waiting until the next update, actually (out in a couple of weeks). I have made it a lot easier to add actions that interrupt other actions.

                            Originally posted by 猫狗乱舞 View Post
                            [ATTACH=JSON]When I was reviewing, I had a doubt, what is the difference between "remove unit from grid", "add unit to grid" and "setActorLocation" in Telepoter's tutorial
                            Add and remove from grid affects the game logic, so the GridUnits map variable. SetActorLocation moves the actual "physical" actor, but does not affect game logic at all, which is determined by the arrays.

                            Originally posted by 猫狗乱舞 View Post
                            report

                            the “collision ”meets expectations
                            Click image for larger version Name:	04.png Views:	0 Size:	64.4 KB ID:	1831794

                            I have chosen to ignore
                            it will repeatedly collide with bp_gridcamara

                            Click image for larger version

Name:	05.png
Views:	95
Size:	28.6 KB
ID:	1831835
                            Click image for larger version

Name:	03.png
Views:	93
Size:	55.1 KB
ID:	1831836

                            Even bp_gridcamara Set Generate overlap events to false


                            But this is a small problem, just affects efficiency. Can be optimized
                            Ok, glad that it partly works, but I would change this a bit. If you choose to use collisions it should only be used for animating the effects and not for anything that affects gameplay. Anything affecting gameplay should happen instantly and not be a result of the asynchronous action queue. What I meant was that you could add status effects during SimulateMovement, but animate those status effects happening during movement using the collision capsule setup.
                            Advanced Turn Based Tile Toolkit (Marketplace - Support)

                            Dungeon Crawler Toolkit (Marketplace - Support)

                            Discord

                            Comment


                              Originally posted by alukach View Post
                              Hi Monokkel,

                              I'm redirecting here the question from Questions section on the EGS page:

                              My pawn starting 'Attack' animation prior to finishing 'Walk/Idle' animation. Where can I specify that the next animation should be played after finishing the previous one? Below is an example:



                              I'm little bit lost in the structure of blueprints and cannot find where I can diagnose queueing delay for performing animations or tick on a check box for playing next animation after finishing previous.

                              I was following your tutorials of custom skeleton animations by simply replacing animations and didn't modified action manager(at least tried). I'm pretty sure that I'm asking very noob question

                              Thanks.
                              Hey, there could potentially be a few different things causing this. Perhaps you are ending an action too early or not queueing them appropriately. Could you show me your code for how you are calling these animations? Make sure you have seen my action system tutorial if you have not done so already. There I get into how you can get things to play in sequence.

                              Hi, I've followed your tutorial on Action System again, but still can't figure out what is causing instant animation. Here are screenshots of blueprints:
                               
                              Spoiler

                              Comment



                                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:	240
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:	222
Size:	101.8 KB
ID:	1832225

                                Comment

                                Working...
                                X