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

    When I designed the End Game functionality I did not have simultaneous attacks in mind, so you will need to make some minor changes. Since I'm not 100% sure of your exact setup you need to test a bit yourself, but the relevant code is in the event graph of BP_Unit at the far bottom right. Here you find the code that checks if the game is over and sets GameOver in the Turn Manager to true if this is the case, causing it to display the game over message when the current turn ends. Check out the CheckIfGameOver function and see how it interacts with your current setup. You probably only need to make some small change here.
    Okay looks like the problem wasn't your end game functionality, but the "Contains grid units"-branch at the start of the ability. I don't understand why it does that yet or how how to work around it, but wanted to keep you updated. I think splitting the movement and attack part of the ability should do the trick.

    EDIT: Nvm it wasnt the case. I'll update once I find the solution.
    EDIT 2: Okay now I think it might be this part where you have the TODO marked. I am not 100% certain, but it really feels like that way, since that part of the blueprint wont light up when debugging, though there are several other parts that wont either.
    EDIT 3: Pobably the last edit, since I am 90% sure that its this part of the blueprint! When a slower (= that gets double attacked) player unit initiates the combat and dies, the deselect actor doesn't light up and the turn passes to enemy when it should call game over istead and when a slow enemy unit initiates the combat and dies, the deselect actor lights up and the game over screen comes online! I think my system needs this to be always called, so how do I change it?
    Attached Files
    Last edited by Veijari; 04-04-2019, 04:25 PM.

    Comment


      Originally posted by Monokkel View Post
      Could you be using an old version of the toolkit? The current unit has not been stored in the game mode for more than a year, I think. I changed that in update 1.8 with multiplayer in mind. It is built into Unreal Engine that only the server has access to the game mode, which is why I switched the reference over to BP_TurnManager. If you have version 1.7 or earlier I'm afraid adding multiplayer is extremely difficult, as I did a major refactoring to enable multiplayer after this. To get the latest version, select the latest version of Unreal Engine when selecting Create Project with ATBTT from the UE4 launcher. Hopefully you have not made so many changes yet that migrating your work to the new version becomes a big challenge.
      OMG, you know me so well...

      Comment


        Hey all, 4.22 is out and I still have a bit of work remaining on the next update. I'll try to get it done soon, but in the meantime know that the 4.21 version of the toolkit seems to convert to 4.22 without any issue, so if you're working on a project using the 4.21 version you can open it in 4.22 and create a working copy.

        Originally posted by Veijari View Post

        Okay looks like the problem wasn't your end game functionality, but the "Contains grid units"-branch at the start of the ability. I don't understand why it does that yet or how how to work around it, but wanted to keep you updated. I think splitting the movement and attack part of the ability should do the trick.

        EDIT: Nvm it wasnt the case. I'll update once I find the solution.
        EDIT 2: Okay now I think it might be this part where you have the TODO marked. I am not 100% certain, but it really feels like that way, since that part of the blueprint wont light up when debugging, though there are several other parts that wont either.
        EDIT 3: Pobably the last edit, since I am 90% sure that its this part of the blueprint! When a slower (= that gets double attacked) player unit initiates the combat and dies, the deselect actor doesn't light up and the turn passes to enemy when it should call game over istead and when a slow enemy unit initiates the combat and dies, the deselect actor lights up and the game over screen comes online! I think my system needs this to be always called, so how do I change it?
        Hey Veijari, sorry for the late answer. The deselect actor event in BP_Unit actually does very little in the base setup. It basically just helps the big unit system remove the unit from all grid tiles. Even EndActorTurn does very little unless you are using the specific behavior tied to it (status effects or the exhausted icon), so I doubt this is what is causing your problems.

        As mentioned, since you've made some changes that go against one of the base assumption of the toolkit, figuring out the resulting issues is a bit of a shot in the dark for me. Would you be willing to share a version of your project (just needs to have the relevant changes) and I'll take a look at it myself.

        Originally posted by FuTou View Post
        OMG, you know me so well...
        If you choose to convert to the newest version and run into any problems I can help with, let me know
        Advanced Turn Based Tile Toolkit (Marketplace - Support)

        Dungeon Crawler Toolkit (Marketplace - Support)

        Discord

        Comment


          Originally posted by Monokkel View Post
          As mentioned, since you've made some changes that go against one of the base assumption of the toolkit, figuring out the resulting issues is a bit of a shot in the dark for me. Would you be willing to share a version of your project (just needs to have the relevant changes) and I'll take a look at it myself.
          I mean of course, sorry for not giving it in the first place. Also sorry for a whiny post. [Here] is a super simplified version of the execute ability system I run. The real version has some stat checks and only single Queue Action is in for each loop that will determine which units will attack and their damage, but those aren't necessary to reproduce the bug. The paste I provided is for BP_Ability_MoveAttack, but the same bug can be reproduced on BP_Ability_Attack. I am running UE version of 4.21.2 and I use square grids if that is a necessary info for you. Here are the steps to reproduce:

          1) Obviously, copy the execute ability stuff.
          2) Put one unit for each team on a grid. Increase the damage of both units to 50, so the initiating unit can die to the second attack.
          3) Attack with player unit. When player unit dies, the game doesn't go to game over screen, instead the enemy gets to do a turn. The game over screen spawns after enemy has ended their turn.
          4) You can also see that it doesn't happen to the enemy faction for some reason. Let the enemy unit engage in battle instead and die to player's second attack and the game over screen will spawn instantly.

          Comment


            Originally posted by Veijari View Post

            I mean of course, sorry for not giving it in the first place. Also sorry for a whiny post. [Here] is a super simplified version of the execute ability system I run. The real version has some stat checks and only single Queue Action is in for each loop that will determine which units will attack and their damage, but those aren't necessary to reproduce the bug. The paste I provided is for BP_Ability_MoveAttack, but the same bug can be reproduced on BP_Ability_Attack. I am running UE version of 4.21.2 and I use square grids if that is a necessary info for you. Here are the steps to reproduce:

            1) Obviously, copy the execute ability stuff.
            2) Put one unit for each team on a grid. Increase the damage of both units to 50, so the initiating unit can die to the second attack.
            3) Attack with player unit. When player unit dies, the game doesn't go to game over screen, instead the enemy gets to do a turn. The game over screen spawns after enemy has ended their turn.
            4) You can also see that it doesn't happen to the enemy faction for some reason. Let the enemy unit engage in battle instead and die to player's second attack and the game over screen will spawn instantly.
            Hmm, you're right to be confused. Something weird is happening here that I'm not quite seeing. The CheckIfGameOver event is run the same on both AI and player turns, but for some reason GameOver seems to be set to true after the AI has already been selected for its next turn... My guess is that one of the tick delay nodes added for AI optimization is the culprit, though I'm not 100% certain. Probably an obvious answer here somewhere, and I'll let you know if I see it. It seems to work fine for the regular toolkit, though I still want to understand what is happening here. For your project here is a quick workaround that will ensure the same behavior for both players and AI. In the EventGraph of BP_TurnManager in the "Begin Actor Turn" comment box, replace the boolean that checks the value of game over to the full game over evaluation function, like so:

            Advanced Turn Based Tile Toolkit (Marketplace - Support)

            Dungeon Crawler Toolkit (Marketplace - Support)

            Discord

            Comment


              Originally posted by Monokkel View Post
              Here is a quick workaround.
              Thank you so much!

              EDIT: Omg it's working, thank you so much! This bug killed my flow so it's super nice to kill it for change.
              Last edited by Veijari; 04-08-2019, 01:59 PM.

              Comment


                hi knut

                super (for the new video)

                leo

                Comment


                  Originally posted by Veijari View Post
                  Thank you so much!

                  EDIT: Omg it's working, thank you so much! This bug killed my flow so it's super nice to kill it for change.
                  Happy to help!

                  Originally posted by leo bar View Post
                  hi knut

                  super (for the new video)

                  leo
                  Thanks More to come very soon.
                  Advanced Turn Based Tile Toolkit (Marketplace - Support)

                  Dungeon Crawler Toolkit (Marketplace - Support)

                  Discord

                  Comment


                    Ok, two new tutorials are up. These are the first two of a series where I delve into the underlying data structures of the grid. I've tried to find a good balance of theory and practical examples and hope many of you will find it useful. Making these videos are a necessary foundation for making videos on more advanced aspects of the toolkit, such as big units. Coming up next after the two I've made now will be videos on pathfinding and modifying the walkability of the grid during runtime. I likely won't have time for this until next month, though. A month from now I will be defending my PhD thesis, so I have to spend most of my time until then in preparation. After that I will get a lot more free time again, and intend to make several new videos.



                    Advanced Turn Based Tile Toolkit (Marketplace - Support)

                    Dungeon Crawler Toolkit (Marketplace - Support)

                    Discord

                    Comment


                      Hi Knut. Really appreciate the new tutorials, I'll be sure check them out tomorrow!
                      I got hopefully a small and simple question this time. I got a bit stuck on figuring out which blueprint handles the unit switching? (Clicking on allied unit to take a control of it instead of the one you are currently controlling.) I have to activate something whenever that gets activated, but finding it has been somewhat tricky.
                      Sorry for the almost daily questions, I'll try to slow my pace down... Good luck with your thesis!

                      Comment


                        Dear Knut,
                        Good day!

                        Our project uses your toolkit and large units (2x2). We would like to clarify, is it possible to somehow simply change the unit's steps?

                        The task is the following:
                        To make the movement of a large 2x2 unit on large 2x2 tiles, the example in the picture.

                        Additionally:
                        Can we use a 2x2 step when pathfinding?
                        (We use pathfinding for a large unit without diagonal movement.)

                        Thank you in advance, and thank you so much for your toolkit!

                        Best wishes, Kon.

                        P.S. I apologize for my English ... Greetings from St. Petersburg!

                        Click image for larger version  Name:	Step.jpg Views:	1 Size:	66.5 KB ID:	1605824

                        Last edited by Konruseyd; 04-11-2019, 01:57 AM.

                        Comment


                          Originally posted by Veijari View Post
                          Hi Knut. Really appreciate the new tutorials, I'll be sure check them out tomorrow!
                          I got hopefully a small and simple question this time. I got a bit stuck on figuring out which blueprint handles the unit switching? (Clicking on allied unit to take a control of it instead of the one you are currently controlling.) I have to activate something whenever that gets activated, but finding it has been somewhat tricky.
                          Sorry for the almost daily questions, I'll try to slow my pace down... Good luck with your thesis!
                          All clicking is handled by the player controller through the curently active abitlity. By default the abilities that have unit switching enabled call the "DefaultClick" event from BP_Ability. Check the bottom right of the Click comment box in BP_Ability_MoveAttack for an example of the implementation. The DefaultClick function is probably a good place for you to add your custom code.
                          Advanced Turn Based Tile Toolkit (Marketplace - Support)

                          Dungeon Crawler Toolkit (Marketplace - Support)

                          Discord

                          Comment


                            Thanks for the new videos and good luck with your thesis. I can't wait to see what games you make after you get your PhD.

                            Comment


                              New Kickstarter is up for Grand Guilds! It is a fantastic looking game combining turn based strategy and card game mechanics The game was made with the help of this toolkit so I'd love to see it succeed! They had an earlier Kickstarter that did not reach its target but they've made a lot of improvements since then and just a few hours into the campaign it is already more than halfway to its target. If you back during the first 24 hours you can get into the cheaper "early bird tiers. Take a look!

                              https://www.kickstarter.com/projects...rpg-with-cards


                              Last edited by Monokkel; 04-10-2019, 02:44 PM.
                              Advanced Turn Based Tile Toolkit (Marketplace - Support)

                              Dungeon Crawler Toolkit (Marketplace - Support)

                              Discord

                              Comment


                                Originally posted by Konruseyd View Post
                                Dear Knut,
                                Good day!

                                Our project uses your toolkit and large units (2x2). We would like to clarify, is it possible to somehow simply change the unit's steps?

                                The task is the following:
                                To make the movement of a large 2x2 unit on large 2x2 tiles, the example in the picture.

                                Additionally:
                                Can we use a 2x2 step when pathfinding?
                                (We use pathfinding for a large unit without diagonal movement.)

                                Thank you in advance, and thank you so much for your toolkit!

                                Best wishes, Kon.

                                P.S. I apologize for my English ... Greetings from St. Petersburg!

                                Click image for larger version Name:	Step.jpg Views:	1 Size:	66.5 KB ID:	1605824
                                Hey Kon, sorry about skipping your question earlier. For someone's first post Epic usually take a while to approve it, to prevent spam, so it did not show up for me until now.

                                Interesting question, though. In your case you basically have two different grids, where one is overlaying the other. One way to do this would be to make a separate GridEdges TMap for large units, which connects 1/4 of tiles to each other. That is probably the most efficient and clean way of doing things, but it would require running an additional, modified version of the GenerateGridEdges function at startup. In this function you would loop through the GridLocations keys, but skip any tile that is not in the "upper left" of your 2*2 tile sets. You could create this rule by checking the GridIndex and only adding edges for tiles where both GetX and GetY for that GridIndex is an even number.

                                Now for each of these filtered out tiles you would connect them to all surrounding 2*2 tiles. This would mean using AddEdgeBothWays to [CurrentTile - 1998], [CurrentTile - 2000] [... -2002, +2, +2002, +2000, +1998, -2]. The trickiest part would be making a modified function for removing edges that are blocked by terrain. This might involve something like using the regular TraceForWalls implementation, but changing from a line trace for walls to a box or sphere trace (maybe the size of a tile), where the start and end locations of each trace is shifted by [+100,+100,0] to trace between the centers of your 2*2 tile clusters.

                                Lastly you would have to make a modified custom pathfinding function. You could modify the SearchAndAddAdjacentTilesBig function so that it uses your new custom GridEdges TMap instead of the regular one.

                                Off the top of my head this is what I think I would do in your situation. There might be a solution that is simpler to implement where you can hack the SearchAndAddAdjacentTiles function to search for all tiles as usual, but only return the relevant ones, but I'm not able to think of a way right now. It would in any case be less performant.
                                Advanced Turn Based Tile Toolkit (Marketplace - Support)

                                Dungeon Crawler Toolkit (Marketplace - Support)

                                Discord

                                Comment

                                Working...
                                X