Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Hello, I am relatively new to Unreal Engine, but stumbled on your toolkit, and it really answered basically every need for our combat system. One thing I have been trying to figure out is how to have the turnbased system deactivate and allow free movement, then when combat is initiated to activate the turn based toolkit. I see the Hybrid map and can get an idea of how the trigger zone starts the combat manager, but the nature of 3rd person then top down for the camera wasn't really what we were looking for, so I didn't want to just iterate on that map alone (plus it is listed as experimental, so I wasn't sure if that meant that the camera perspective change was experimental, or if the changing between having the manager run and having it not was the experimental piece).

    Comment


      Originally posted by drakunis View Post
      Hello, I am relatively new to Unreal Engine, but stumbled on your toolkit, and it really answered basically every need for our combat system. One thing I have been trying to figure out is how to have the turnbased system deactivate and allow free movement, then when combat is initiated to activate the turn based toolkit. I see the Hybrid map and can get an idea of how the trigger zone starts the combat manager, but the nature of 3rd person then top down for the camera wasn't really what we were looking for, so I didn't want to just iterate on that map alone (plus it is listed as experimental, so I wasn't sure if that meant that the camera perspective change was experimental, or if the changing between having the manager run and having it not was the experimental piece).
      Hi, glad to hear that my toolkit is useful for your project. The experimental folder is where I put systems that I am experimenting with and that can serve as a starting point for devs wanting to implement those types of features. In the experimental folder I do not try to integrate each feature with every other feature in the toolkit and rather try a more local and less generic solution. The folder still contains blueprints that should be well optimized and decently organized, though not commented and cleaned to the same degree as the rest of the toolkit.

      For the hybrid map I am working on an updated and improved version for the next toolkit update. What about the current implementation is not a good fit for your game? Let me know precisely what you are after and I might be able to help you.
      Advanced Turn Based Tile Toolkit (Marketplace - Support)

      Dungeon Crawler Toolkit (Marketplace - Support)

      Discord

      Comment


        I appreciate the response! We wanted more like Wasteland, where you have a top down movement style (just like the tile based movement the toolkit creates) but to have completely free movement outside of combat. I didn't see anything (and I might not have looked hard enough) that disabled that turn based order when you put the grid manager on the map except in the hybrid map, which is the exact playstyle we are looking to create, minus the third person WASD movement. If that makes sense.

        Comment


          Originally posted by drakunis View Post
          I appreciate the response! We wanted more like Wasteland, where you have a top down movement style (just like the tile based movement the toolkit creates) but to have completely free movement outside of combat. I didn't see anything (and I might not have looked hard enough) that disabled that turn based order when you put the grid manager on the map except in the hybrid map, which is the exact playstyle we are looking to create, minus the third person WASD movement. If that makes sense.
          Yep, makes perfect sense. It should be simpler to set up than the current hybrid map. You can scrap all the code for switching between cameras, use the Grid Camera's follow functionaility for following your character during real time movement, and transition to and from combat in the same way otherwise.
          Advanced Turn Based Tile Toolkit (Marketplace - Support)

          Dungeon Crawler Toolkit (Marketplace - Support)

          Discord

          Comment


            Originally posted by Monokkel View Post

            Hi, glad to hear that you're enjoying the toolkit The things you mention are indeed built with some assumptions, but they are easy to swap out. I designed the turn manager and abilities to be easy to replace and overwrite for precisely these sorts of reasons.

            For your first question on initiative I would use the strategy turn manager (BP_TurnManager_Strategy) and make the following change:

            Note that this will not make too much sense for the AI, which will always use the first unit in initative. If you are using AI and want it to intelligently choose the optimal unit to use it will require some more work. Let me know if this is what you're going for, but first see if the above suggestion fits what you are after. To choose to use the strategy turn manager set the game mode to BP_ATBTT_Strategy (or simply change the turn manager class variable in whatever BP_ATBTT based game mode you are using)

            For your second question, this makes sense to set up in an ability. Patterns can be generated in many ways, but you need to figure out the appropriate algorithm. The GetTilesInRange function in BP_GridManager is a pattern function that finds a square or diamond shaped pattern. You can follow its example to create patterns of your own.

            A quicker but somewhat less performant option is to use the output of GetIndexesInRange and filter it to the shape of your pattern. You could for instance create a cross by taking the array output by GetIndexesInRange and only keeping indexes that are an equal distance away from the center grid index in the X and Y axes.

            Note that if you use GetIndexesInRange, it does not do any checks on the output grid indexes to ensure they are real tiles on the grid, so before using them for gameplay loop through them and check a grid sized array like GridLocations to only keep the valid ones. FindTilesInRange is set up to do this already.

            Thanks! Is there somewhere I can learn about the different Game Modes and Turn Manager classes?

            Comment


              Originally posted by admlsnackbar View Post
              Thanks! Is there somewhere I can learn about the different Game Modes and Turn Manager classes?
              The tutorials on YouTube concerning the turn manager is a bit outdated, so it does not describe multiple types of turn managers.

              The game modes are essentially identical, with the only difference being what turn manager they are using. The default BP_TurnManager has turn order based on each faction, with a predefined faction order and the turn order within each faction determined by the individual units' initiative variable values.

              BP_TurnManager_Strategy is the same, only that new units are not automatically selected when a unit ends its turn, but have to be manually selected by the player.

              BP_TurnManager_Initiative ignores factions and orders unit activation solely based on their initiative values.
              Advanced Turn Based Tile Toolkit (Marketplace - Support)

              Dungeon Crawler Toolkit (Marketplace - Support)

              Discord

              Comment


                Originally posted by Monokkel View Post
                Sorry for the late reply, people. The last couple of days were very busy. I'll get to your questions now:



                Hi SpamBotWinner, there are several benefits to the action system, both in regards to multiplayer and otherwise. Firstly it is a tried and true way to design turn based games. Games like Hearthstone, XCOM and Gears Tactics work like this under the hood (hints to this is how the EndTurn button in Hearthstone is immediately disabled if you initialize some RNG based spell which eventually results in a player death, or how you get an achievement in XCOM for killing a new type of enemy right at the start of the AI's turn instead of after you hit it with an overwatch shot seconds later).

                One benefit can be seen in considering how you would have to structure your code without an action system. Say you have an AI unit who wants to move to a tile and attack a unit. Without an action system you would need a function or event dispatcher to make a call to the attack system after movement has ended. Then the attack system would have to make a call to a damage dealing system etc. You can quickly end up with spaghetti code where all sorts of objects point and execute events in other objects, which becomes confusing and requires manual setup for every single thing you want to be able to call in sequence. The action system provides a standardized way to call events in sequence, which can call an arbitrary sequence of actions.

                The action system is also effectively a sectioning off of gameplay logic and what is visually transmitted to the player. A benefit of this is that all the gameplay logic would work the same if you changed everything on the visual layer, which makes it easier to do extensive modifications of the toolkit.

                The fact that all the game logic for a turn (or indeed several turns) can be carried out over a single tick (instead of waiting for animations to finish) opens for many advanced possibilities. You could in theory have an AI test out several different options before deciding on the best one, and only then queueing the resulting actions. You could even do this for multiple AI units to enable coordination (Gears Tactics does this). Knowing before the turn starts animating all the things that will happen during the turn opens up for many possibilities, such as guiding the camera in a way that will best capture the action etc.

                So for these reasons, even if it did not improve multiplayer, I would still want to have an action system. However, another benefit is that the action system essentially takes care of replication for you. You generally want all game logic to happen on the server, while still showing to the players what they need to see. This distinction is built into the action system, and any variable passed through an action is automatically replicated, meaning you don't have to mess around with manually replicating variables and calling RPCs. Each client is also responsible for their own action queue, which results in lagless animation within each action. In a real time game you will have to continously update the location of a moving actor to all clients (and often build in prediction algorithms for when transmission is slow). For actions the client gets a single command once and then it takes care of the entire animation itself, meaning that you will never see a unit lagging during movement.

                I hope that made things clear. Note that I am making some major changes to the action system in the coming update. Although the current system is functional, it feels a bit hacky, and it is easy to make coding mistakes in forgetting to end an action or ending an action twice, which causes many strange issues. The current setup also creates quite a bit of circular dependencies and runs into many of the problems related to OOP (you have to inherit from an actor in order to access its action). I'm moving to a system of encapsulating actions within actors, which makes everything a lot cleaner.



                No worries, I'll see if I can solve it. I'm not exactly sure what the problem is, though. Could you give me the exact steps to reproduce the issue you are seeing?



                Ok, so I see a few mistakes here. I will point out the obvious mistakes I am seeing, but cannot give you more specific suggestions, since I'm not sure exactly what you are trying to achieve? Do you want a timer displayed on the screen that counts down from 5, once per second, before the goblin turn starts?

                The PlayerInputCountdown function looks a bit weird to me. You are aware that delays don't work within functions? The DelayAllActions isn't really a delay, but rather a command to have the action system delay continuing the action queue. From how I read it I think this function would print 12345 immediately during the same tick and then you would have a five second delay in the action queue based on five one-second delay actions back to back. I think this is probably not what you're after?

                From the last two screenshots it seems you have misunderstood how casts work. The game mode is not of type turn manager, and casting it won't make it so. Similarly the Owning player is not a turn manager. Casting is a way to check if a reference is of a specific class, and if so you are able to access its variables. So, for instance, you can have a reference to a unit in a blueprint. The reference is of the type BP_Unit. However, the unit stored in this reference right now is actually of the class BP_Unit_Anim. You want to have access to the variables and functions that are specific to BP_Unit_Anim, but UnrealEngine does not know that your variable is of this class (since the reference variable is of type BP_Unit). This is when you cast it to access the child class. I recommend checking out the documentation on casting here: https://docs.unrealengine.com/en-US/...des/index.html
                Ty for your response. Hope to see your new ability system) I'm new to this and for me its hard to track what action is running right now (especially with ue debug coz for some reasons it hates interfaces and most of the time refuses to proceed to the interface's function execution and just skips it (it was a nightmare to fix my bug in Select actor event).

                Comment


                  Originally posted by SpamBotWinner View Post

                  Ty for your response. Hope to see your new ability system) I'm new to this and for me its hard to track what action is running right now (especially with ue debug coz for some reasons it hates interfaces and most of the time refuses to proceed to the interface's function execution and just skips it (it was a nightmare to fix my bug in Select actor event).
                  I hear you. The current implementation of the action system is indeed tricky to debug, and easy to lose track of. I am making many changes in the coming update, but making the action system simpler to work with has been my number one priority.
                  Advanced Turn Based Tile Toolkit (Marketplace - Support)

                  Dungeon Crawler Toolkit (Marketplace - Support)

                  Discord

                  Comment


                    -From Google Translator-

                    Hello, I want to debug in “Bp_ActionManage", and I want to get the name of the "current action" to understand the currently executing action, but I found that just adding "totext" will cause a crash, even if you delete it and run it, it will crash.


                    And, using "getActionName" is the same

                    What could be the reason for this?
                    Or is there any way to track the sequence of actions?


                    Sorry I didn’t notice that many people have mentioned the issue of tracking actions. I don’t know what keywords to search for to get the answer

                    Thank you very much

                    Engine version: 4.25 ATTBT version: 2.61

                    Click image for larger version  Name:	20200924164941.png Views:	2 Size:	37.5 KB ID:	1814844
                    Last edited by 猫狗乱舞; 09-24-2020, 10:48 AM.

                    Comment


                      Originally posted by 猫狗乱舞 View Post
                      -From Google Translator-

                      Hello, I want to debug in “Bp_ActionManage", and I want to get the name of the "current action" to understand the currently executing action, but I found that just adding "totext" will cause a crash, even if you delete it and run it, it will crash.


                      And, using "getActionName" is the same

                      What could be the reason for this?
                      Or is there any way to track the sequence of actions?


                      Sorry I didn’t notice that many people have mentioned the issue of tracking actions. I don’t know what keywords to search for to get the answer

                      Thank you very much

                      Engine version: 4.25 ATTBT version: 2.61

                      {"alt":"Click image for larger version Name:\t20200924164941.png Views:\t2 Size:\t37.5 KB ID:\t1814844","data-align":"none","data-attachmentid":"1814844","data-size":"full","title":"20200924164941.png"}
                      Hi, thanks for the bug report. I have previously done what you describe without having any issues. However, when I test it now I get the same crash that you are seeing, In fact, any change made to BP_ActionManager seems to cause the engine to crash when you run the project. The same thing happens when I open older versions of ATBTT in 4.25, but not in 4.24. This thus seems to be a bug in Unreal Engine and not ATBTT. I have sent a bug report to Epic and I will experiment to see if I can find a workaround. I'm sorry for the inconvenience, but there is not much else I can do at the moment.

                      Edit: Ok, I've found a hack that seems to work, but it is pretty weird. Every time you make a change to BP_ActionManager, rename the Actions array to something new, then compile. I do not know why, but this seems to work. You can try doing this until I find a proper fix or Epic fixes this bug in the engine.
                      Last edited by Monokkel; 09-24-2020, 03:28 PM.
                      Advanced Turn Based Tile Toolkit (Marketplace - Support)

                      Dungeon Crawler Toolkit (Marketplace - Support)

                      Discord

                      Comment


                        Originally posted by Monokkel View Post

                        Hi, thanks for the bug report. I have previously done what you describe without having any issues. However, when I test it now I get the same crash that you are seeing, In fact, any change made to BP_ActionManager seems to cause the engine to crash when you run the project. The same thing happens when I open older versions of ATBTT in 4.25, but not in 4.24. This thus seems to be a bug in Unreal Engine and not ATBTT. I have sent a bug report to Epic and I will experiment to see if I can find a workaround. I'm sorry for the inconvenience, but there is not much else I can do at the moment.

                        Edit: Ok, I've found a hack that seems to work, but it is pretty weird. Every time you make a change to BP_ActionManager, rename the Actions array to something new, then compile. I do not know why, but this seems to work. You can try doing this until I find a proper fix or Epic fixes this bug in the engine.
                        Thank you for your enthusiastic reply. I just learned to use blueprints. I have benefited a lot from reading your work. It looks very elegant

                        Is there a problem with the old version of ATTBT? I bought it recently, I thought it was a new version

                        Will the new version of ATTBT also have this problem in 4.25? How can I get the new version of ATTBT


                        if the updated version is released, can the content of the new version be added? I saw the update of the action system mentioned above, I think it is very useful

                        Comment


                          Originally posted by 猫狗乱舞 View Post

                          Thank you for your enthusiastic reply. I just learned to use blueprints. I have benefited a lot from reading your work. It looks very elegant

                          Is there a problem with the old version of ATTBT? I bought it recently, I thought it was a new version

                          Will the new version of ATTBT also have this problem in 4.25? How can I get the new version of ATTBT


                          if the updated version is released, can the content of the new version be added? I saw the update of the action system mentioned above, I think it is very useful
                          No, this is a problem with the newest version of ATBTT. More specifically it seems to be a problem with Unreal Engine 4.25, since the same problem happens if I open older versions of ATBTT (which I know did not have this problem) in UE4.25. As you have read I am working on an update that improves the action system. It is not available yet, but I will release it along with the first full version of UE4.26 UE4.26 preview 1 got released yesterday and it usually takes 1-2 months between the first preview release and the first full version release. Converting an ATBTT project to the new version will require quite a lot of manual work, as I have made many substantial changes to the toolkit.
                          Advanced Turn Based Tile Toolkit (Marketplace - Support)

                          Dungeon Crawler Toolkit (Marketplace - Support)

                          Discord

                          Comment


                            Hello again!

                            I've been making some great progress, but ran into another issue tonight. I made an ability in which the owning unit kills itself. This seems to mess up the turn manager - once the ability finishes, the game hangs on the current player's turn. Even clicking the manual End Turn does nothing.

                            Per your suggestion, I am using BP_TurnManager_Strategy. Here are the relevant BPs:

                            Turn Manager Strategy
                            Click image for larger version

Name:	TurnManager.png
Views:	95
Size:	89.4 KB
ID:	1815631

                            Kamikaze Ability
                            Click image for larger version

Name:	SuicideAbility.png
Views:	87
Size:	88.1 KB
ID:	1815632

                            I stepped through the Turn Manager in debug and it seems to process everything through EndActiveFactionTurn and EventBeginActiveFactionTurn correctly.

                            Thanks in advance!

                            Comment


                              Originally posted by admlsnackbar View Post
                              Hello again!

                              I've been making some great progress, but ran into another issue tonight. I made an ability in which the owning unit kills itself. This seems to mess up the turn manager - once the ability finishes, the game hangs on the current player's turn. Even clicking the manual End Turn does nothing.

                              Per your suggestion, I am using BP_TurnManager_Strategy. Here are the relevant BPs:

                              Turn Manager Strategy
                              Click image for larger version

Name:	TurnManager.png
Views:	95
Size:	89.4 KB
ID:	1815631

                              Kamikaze Ability
                              Click image for larger version

Name:	SuicideAbility.png
Views:	87
Size:	88.1 KB
ID:	1815632

                              I stepped through the Turn Manager in debug and it seems to process everything through EndActiveFactionTurn and EventBeginActiveFactionTurn correctly.

                              Thanks in advance!
                              Hi, I tested it out with some slightly simpler code and it seems to work fine? This ability is a duplicate of BP_Ability_MoveAttack with an overridden ExecuteAbility function:

                              Here is the result:


                              Perhaps you're going for something different?
                              Advanced Turn Based Tile Toolkit (Marketplace - Support)

                              Dungeon Crawler Toolkit (Marketplace - Support)

                              Discord

                              Comment


                                Nope, that is exactly what I'm going for! I reverted my changes and tried again, and this time it worked...there must have been a missing node connection somewhere

                                Thanks for looking into it! I'm also starting to make some Status Effects, can you give me a quick explanation of how that system works (or point me to a tutorial somewhere?).

                                Cheers!

                                Comment

                                Working...
                                X