Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Originally posted by borrowedLadder View Post
    Hey there, is it possible with this asset to generate at runtime? So if I have something that randomly generates the tiles in different orders at runtime (or players create their own map using tiles at runtime), the toolkit can update the tiles and movement for it?
    Yes, this can be done without much difficulty. The grid is set up when the SetupGridManager event in BP_GridManager is called from BP_ATBTT_State, which normally happens in the first frame after launching.

    You can remove this event call and call it at a later time after you have generated your custom map. Note that you will also want to similarly postpone calling BeginTurnBasedCombat from BP_TurnManager to prevent the game proper from starting (as activated units etc. will assume a grid is present and will throw warnings)
    The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

    Comment


      Hi, Knutt,
      Firslty, seems like a super cool pack you've created and a good proper support thread
      Okay, super newbie question here.
      I just started out with this and are following your tutorial "UE4 - ATBTT - The Action System - 3/3"
      Everything works as expected up till 15 min, the animation part or the teleporting just isn't happening, not even the one where the unit is clipping with the tile.

      From my own debugging I'd guess it's somewhat related to Queue Action, since if the Queue Type is set to "Immediate", the pawn actually does teleport, but before starting to move.
      I've now spent +3 hours on a 15 min tutorial and are feeling really stupid, is there any chance you could help me out and tell me what's up?

      Click image for larger version  Name:	Tile.png Views:	0 Size:	153.6 KB ID:	1707513

      Comment


        Hey Monokkel,

        So i change the damage variable and made a another copy just to make sure it wasn't the blueprint itself and even though damage is calculating the enemy is still there. Does this have to do with the grid reference?

        Comment


          Hi I'm having trouble spawning units at runtime.
          I've searched through the support thread and tried implementing the different fixes but I've had no luck so far.

          I have an ability that uses Spawn Actor to create a Adv_Heavy unit at the correct grid tile, the constructor seems to work and it gets placed in the turn order / initiative. When it comes around to their turn the Unit doesn't have any abilities and cannot move or act. I've checked the starting abilities and it has Sprint, Laser, Grenade etc in the array. I am also unable to end the turn once it becomes their turn.

          --

          Also I noticed that Status Effects can have run at turn end / start, is there anyway of having them activate on the start / end of a units turn, not at faction turn?

          Thanks in advance.

          Comment


            Terribly sorry for the late reply, everyone. Had some sudden things in my life that took precedent, but it is back to normal now.

            Originally posted by AntonPil View Post
            Hi, Knutt,
            Firslty, seems like a super cool pack you've created and a good proper support thread
            Okay, super newbie question here.
            I just started out with this and are following your tutorial "UE4 - ATBTT - The Action System - 3/3"
            Everything works as expected up till 15 min, the animation part or the teleporting just isn't happening, not even the one where the unit is clipping with the tile.

            From my own debugging I'd guess it's somewhat related to Queue Action, since if the Queue Type is set to "Immediate", the pawn actually does teleport, but before starting to move.
            I've now spent +3 hours on a 15 min tutorial and are feeling really stupid, is there any chance you could help me out and tell me what's up?

            Click image for larger version Name:	Tile.png Views:	0 Size:	153.6 KB ID:	1707513
            Hi Anton, I cannot immediately see what is wrong here. I will have to test it out myself and see. Will try to do so tonight. I have made some changes to parts of the action system since that video, so it might not be you who are doing something wrong, but rather a difference between versions.

            Originally posted by EagleEyeGamma View Post
            Hey Monokkel,

            So i change the damage variable and made a another copy just to make sure it wasn't the blueprint itself and even though damage is calculating the enemy is still there. Does this have to do with the grid reference?
            Could be the reference to the unit which is returning false. You can test this by dragging an isValid node out from the unit and printing it at each point where it is accesed and see if it ever returns false during play. That should help to narrow it down. Were my previous explanations for how and when units are removed from the grid clear to you?

            Originally posted by SSL_Dev View Post
            Hi I'm having trouble spawning units at runtime.
            I've searched through the support thread and tried implementing the different fixes but I've had no luck so far.

            I have an ability that uses Spawn Actor to create a Adv_Heavy unit at the correct grid tile, the constructor seems to work and it gets placed in the turn order / initiative. When it comes around to their turn the Unit doesn't have any abilities and cannot move or act. I've checked the starting abilities and it has Sprint, Laser, Grenade etc in the array. I am also unable to end the turn once it becomes their turn.

            --

            Also I noticed that Status Effects can have run at turn end / start, is there anyway of having them activate on the start / end of a units turn, not at faction turn?

            Thanks in advance.
            Hey SSL_Dev, seems like spawning advanced units at runtime has become a bit more involved following a refactoring. Seems I forgot to test this. I will try to find a solution tonight. The first step should be calling SetupUnitAfterAssignedOwner in the HandleUnitSpawning function in BP_Unit. This works as long as the unit only has abilities that already exist on units that were placed in the viewport beforehand.
            The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

            Comment


              Originally posted by AntonPil View Post
              Hi, Knutt,
              Firslty, seems like a super cool pack you've created and a good proper support thread
              Okay, super newbie question here.
              I just started out with this and are following your tutorial "UE4 - ATBTT - The Action System - 3/3"
              Everything works as expected up till 15 min, the animation part or the teleporting just isn't happening, not even the one where the unit is clipping with the tile.

              From my own debugging I'd guess it's somewhat related to Queue Action, since if the Queue Type is set to "Immediate", the pawn actually does teleport, but before starting to move.
              I've now spent +3 hours on a 15 min tutorial and are feeling really stupid, is there any chance you could help me out and tell me what's up?

              Click image for larger version Name:	Tile.png Views:	0 Size:	153.6 KB ID:	1707513
              Ok, I've looked into this in depth now. This is caused as a consequent of my refactoring, so you did everything correctly. It is the tutorial that is outdated. The reason for what you're seeing is that the Move action is now queued after SimulateMove, while before it was queued before. As a result, if you queue the teleport action during simulate move it will be animated first, followed by the animated movement. If you have not completed the entire tutorial and added explosions, delays etc. it will seemingly not happen at all, since the unit is moved during a single tick and then immediately moved back to where it is at the start of the move animation (which is the next queued action).

              So in newer versions you will have to do things a bit differently. I have since added more options to the QueueAction macro. Instead of a boolean checkbox for immediate or not, you can now select Queued, Immediate or Interrupt. The first two are the same as with immediate checked and unchecked before. The third one enables you to add a new action to an ongoing queue that is currently being animated. This can be utilized in the teleportation example.

              You can use the following code in BP_Teleporter to achieve the same effect as the tutorial using an action set to interrupt. In this teleporter we bind a new event. This time to the animate version of the dispatcher run at the end of a unit's movement. Then, when the unit has actually moved to the teleporter during animation we queue a teleport action set to interrupt, which should animate immediately after the move animation is done.

              You can see a similar setup in the spike traps in Maps/Experimental/InterruptAction. If you have a game where you expect a lot of interrupted actions I recommend looking at the SplitAnimations map in the same folder, which includes a unit that splits its movement into multiple actions, making it much easier to insert actions when units enter particular tiles. The example map includes a teleporter and a ladder.
              The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

              Comment


                Originally posted by SSL_Dev View Post
                Hi I'm having trouble spawning units at runtime.
                I've searched through the support thread and tried implementing the different fixes but I've had no luck so far.

                I have an ability that uses Spawn Actor to create a Adv_Heavy unit at the correct grid tile, the constructor seems to work and it gets placed in the turn order / initiative. When it comes around to their turn the Unit doesn't have any abilities and cannot move or act. I've checked the starting abilities and it has Sprint, Laser, Grenade etc in the array. I am also unable to end the turn once it becomes their turn.

                --

                Also I noticed that Status Effects can have run at turn end / start, is there anyway of having them activate on the start / end of a units turn, not at faction turn?

                Thanks in advance.
                Hey, I've looked into this now. Seems like a combination of two issues. The first is that SetupUnitAfterAssignedOwner needs to be called during HandleUnitSpawning, like so:



                The second issue is a bit more tricky, though. The issue is that UnrealEngine requires a delay of one tick (possibly more in multiplayer) to access a freshly spawned actor. This causes issues where the toolkit spawns new abilities during runtime, but fails to add them to the appropriate arrays, since the references do not yet exist. This makes spawning units during runtime for units with fresh, unused ability classes not work properly. I will try to find a proper fix for this in the next update. Until then, here is a hack that works well:

                In BP_PlayerController_ATBTT create an array of BP_AbilityBase classes. In its default values include all abilities that can possibly be used in your game. At BeginPlay for the player controller loop through this array and call GetAbilityOrAddIfMissing for each of them. This will make all these abilities available when newly spawned units are looking for them:

                The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                Comment


                  Thanks that worked perfectly!

                  Is there a place that a unit / tile can store how many turns its been alive? I've had a look and I can't seem to find anything. I'd like to be able to destroy units / runtime added tiles after a set number of turns. I've made a status condition that works for Units but not for tiles. Also a I mentioned previously this Activate on turn start seems to be the faction turn start, is there a way that it can run on the individual units turn start?

                  thanks in advance

                  Comment


                    Hi Monokkel,

                    Thank you for that explanation it was very clear and through some more testing I'm now trying to figure out where to properly place these IsValid nodes as I've place them at the points in the ability itself when its calling for a grid unit reference.

                    Comment


                      Originally posted by SSL_Dev View Post
                      Thanks that worked perfectly!

                      Is there a place that a unit / tile can store how many turns its been alive? I've had a look and I can't seem to find anything. I'd like to be able to destroy units / runtime added tiles after a set number of turns. I've made a status condition that works for Units but not for tiles. Also a I mentioned previously this Activate on turn start seems to be the faction turn start, is there a way that it can run on the individual units turn start?

                      thanks in advance
                      Sure, there are a number of ways you can keep track of how many turns a unit or tile has been alive. The most straightforward way is to add a new integer to each to keep track. Then you could add a new event dispatcher in BP_TurnManager that you call after the BeginNewTurn event. You could bind events that increment the turn counter in the BeginPlay events of each relevant actor.

                      When it comes to activating the unit on the start of the unit's turn versus the entire faction's turn look into the different turn managers BP_TurnManager and BP_TurnManager_Initiative. The first one is the default and splits initiative into factions, activating status effects etc. for all units of a faction at the start of that faction's turn. BP_TurnManager_Initiative instead has a D&D style initiative order, where turn start effects are run at the start of each unit's turn. Compare these two blueprints and see if it makes sense to you. You can change the turn manager used by changing TurnManagerClass in BP_ATBTT.

                      Originally posted by EagleEyeGamma View Post
                      Hi Monokkel,

                      Thank you for that explanation it was very clear and through some more testing I'm now trying to figure out where to properly place these IsValid nodes as I've place them at the points in the ability itself when its calling for a grid unit reference.
                      Ok, great. Hope that helps you figure out the problem. If not, the info you get from this should help me figure out what might be wrong.
                      The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                      Comment


                        How would I set up tile-based movement even when out of combat?

                        I'm envisioning free roaming movement like Solasta: Crown of The Magister where the player can control x number of characters and move them in formation on a grid - I'm sure I can figure out the formation logic once I've got 1 character moving correctly https://youtu.be/f1uUDj1JIsg

                        Also is there a certain workflow you should have when setting up maps for use with the grid? I imagine it's difficult to take for example a marketplace asset level and use it with a procedurally generated grid - should you instead set up the grid and manually place actors and such to build out the level?
                        Last edited by Commander; 01-22-2020, 07:50 AM.

                        Comment


                          Originally posted by Commander View Post
                          How would I set up tile-based movement even when out of combat?

                          I'm envisioning free roaming movement like Solasta: Crown of The Magister where the player can control x number of characters and move them in formation on a grid - I'm sure I can figure out the formation logic once I've got 1 character moving correctly https://youtu.be/f1uUDj1JIsg
                          You could use the top down example project by Epic as a base. What you would change is that when you click a location to move to, you would convert the world location to a grid index using the ConvertLocationToIndex3D function in BP_GridManager. Then use this index to get the tile location through the GridLocations TMap in BP_GridManager and make this the destination of the top down movement. For later converting from real time to turn based movement after combat starts take a look at the Hybrid example map in Maps/Example/Hybrid.

                          Originally posted by Commander View Post
                          Also is there a certain workflow you should have when setting up maps for use with the grid? I imagine it's difficult to take for example a marketplace asset level and use it with a procedurally generated grid - should you instead set up the grid and manually place actors and such to build out the level?
                          The toolkit procedurally generates grid locations and walkability. However, if you use a premade map you will likely need to do some moderate adjustments. Firstly, you should make sure the map conforms to a grid of the size you are using (200*200UU is default for the toolkit, but can be changed). If not you can get strange results like a tile where the center is on the very edge of a cliff, with half the tile hanging over thin air. Also, you will want to play around with collisions a bit. Anything that blocks the PathTrace channel will be walkable. Anything blocking RangeTrace will block line of sight. If bTraceForWalls is enabled in BP_GridManager, anything blocking WallTrace will block movement between tiles.

                          You will want to set up collisions appropriately for your meshes following these rules. You might also have to modify collision geometry for some meshes if they overlap tiles in weird ways, but that is on a case by case level
                          The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                          Comment


                            Hi Monokkel,

                            Back with an update after multiple testing narrowing down to damage not being calculated although strangely enough its only in the ability i made and the Take Damage take place after the queue action you've shown to me. Here are some screenshots as well.

                            Comment


                              Originally posted by EagleEyeGamma View Post
                              Hi Monokkel,

                              Back with an update after multiple testing narrowing down to damage not being calculated although strangely enough its only in the ability i made and the Take Damage take place after the queue action you've shown to me. Here are some screenshots as well.
                              Maybe my diagnosis was incorrect all along and it comes down to how you calculate and store your damage variable? Perhaps you should just send me the relevant parts of your code as a pastebin and I can inspect it myself.
                              The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                              Comment


                                Hey guys, is it possible to change the Grid Size X and Y of the BP_GridManager during runtime? I'm looking through the blueprints but struggling with figuring it out

                                Comment

                                Working...
                                X