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



    Hey angelbane, I'm sorry that my old tutorials can be a bit confusing when using the new toolkit. I'm making new ones and I have several fairly new tutorials that are up to date, but there is still loads more to make when I get the time. For now feel free to ask here about anything that confuses you. No need to apologize as this is what the support thread is for, and I'm happy to help

    When you ask about how the rules of the game are dictated, for the most part that is done in the various abilities and in BP_TurnManager. These blueprints are made to be highly modular (this includes the turn manager in the latest update) to make changing the rules of your game relatively painless.

    The turn manager starts the game and has events and functions for starting and ending the turns of units etc. Abilities are what the player uses to interact with the game (the player controller sends input to the abilities which interpret the input and decide what to do).

    To give an example related to what you're asking, when a unit ends its turn it signals the turn manager, which (by default) deselects this unit and selects a new unit. SelectActor is run for this unit, which causes it to activate an ability, telling the player controller of the player that owns this unit to do this. The player controller sets this ability as the active ability and runs ActivateAbility (which often runs code for finding and displaying relevant targets for that ability). From now on, mouse hover events and clicks are taken by the player controller and funneled into the active ability, running first through the BP_AbilityBase and BP_Ability code (unless this is overriden in the ability itself) and finally in the main ability.

    In BP_Ability_MoveAttack, for instance, the cascade of events following a click ends up triggering EventServerInteract, which then checks if the clicked tile contains a unit, which it uses to decide if the active unit should move, attack an enemy, swap to another unit or do nothing. For damage, in this ability if an enemy in range is clicked, it runs the ExecuteAbility function, which for BP_Ability_MoveAttack results in calling the TakeDamage event on the enemy unit (causing its CurrentHealth variable to decrease) and queue the Attack action, causing the active unit to animate an attack and animate the enemy's health bar depleting (Which is done in EventAnimateAction in BP_Ability_MoveAttack, as called from the action manager blueprint).

    To answer your specific questions, if you want your units to be able to either attack or move, but not both, you can change BP_Ability_MoveAttack so that moving sets the units Action Points to 0 (instead of subtracting 1, as is currently done). For having a miss chance, I recommend looking at how I did this in BP_Ability_Laser.

    I recommend checking out my tutorials on the action system and ability system, as they are pretty much up to date and covers important topics needed to understand the toolkit. The turn manager videos might also be useful, but these are unfortunately outdated as of the last update, where I made some serious changes to the turn manager code. They might still be informative, though.

    I hope you learned something from my description, and let me know if you have any further questions.
    Thanks for the response. I will check this out and see what I can do.

    One problem I am having is I try to put in a breakpoint to see how these things run, but by doing so I think I interrupt the mouse hover location and it doesn't run properly. Any advice on where to put a breakpoint to trace moving and shooting actions?

    Comment


      Let me try to rephrase my issue here.

      When playing the game, I am moving the mouse around on the grid to have a character either move or attack (or end the turn). When I click on the grid, I expect some "action" to fire; like "move" or "attack". From what I have been able to see, that action is "moveAttack".

      My question is, where in whichever blueprint is the logic that handles "they player just clicked here, so perform action moveAttack". What I am expecting is something along the lines of click > determine action > fire action.

      I hope this is clear.

      I am really trying to figure out how actions are handles so that I can customize them, but I am struggling because it seems that whenever a player's turn is up it is "activated" without the player deciding to do anything. I don't really know how else to describe it.

      Edit: After thinking about it, I think what I am looking for is which blueprints handle the main game loop.

      I assume it goes something like
      While( game not over):
      1) Go through each character - the turn manager does this
      2) Take input from the character's controller - I don't know where this is done
      3) Determine an action for that input - I don't know where this is done
      4) Execute this action - BP_Ability_MoveAttack seems to be doing this, as it's the only ability I can do
      5) Check if the game is over - I don't know where this is done


      Steps 2) and 3) are where I'd really appreciate some information.

      Thanks!
      Last edited by angelbane019; 07-31-2019, 11:24 PM.

      Comment


        Oh this is the function that I want.
        Thank you, but there is still a problem.
        If you look at the attached screen shot, the index that fails to move because Unit Size is 2, is still displayed as a movable area. Tell me how to fix it.

        Attached Files

        Comment


          Hi, Monokkel! I have bought the Kit around a year ago but only got to play with it recently. Yours is perhaps the best offer in the entire marketplace!

          Anyway, do you have any general tips on how to implement the knock off effect? Like a grenade shockwave that pushes the enemy 1 tile away from the explosion. Or something like a pull effect which pulls enemy to a specific tile? Maybe something like a Roadhog's hook from overwatch

          Comment



            Whoa, lots of questions since yesterday. I'll get to them.

            Originally posted by leo bar View Post
            hi knut


            Thanks so much for the detailed explanation .....

            all my testing is done in the standalone mode or in a packaged developer build


            It is important for me to emphasize that I am really happy with optimization of the toolkit as it is, its perfectly fine. On a reasonable computer everything ran wonderfully. The reasons I wanted to make the changes and use loop per tick are:

            1. I deliberately tested my project (at least what I have done so far) on a much weaker computer than mine ( intel core 2 duo e4700 2.6 GHz ), just wanted to test the limit of the hardware people can use.It's important to note that on this processor too, everything ran quite smoothly except for a little bit of delay when the run pathfinding was running (I also have a range of 14 tiles).

            2. The second reason is because my tiles are smaller and have quite large maps and I get into the problem of max loop iteration count. on the weaker computer the problem is of course more serious.

            The solution to the problem is easy (changing the number of the loop iretation in the project settings ) But I do not feel so confident that the values there are so high (they put this limitation to avoid potential problems).. Apparently I'm just too strict but I still wanted to see if I could solve both of those things. I will try what you have suggested.

            again if there is one thing I learned during this testing is that blueprint and your toolkit can handle this type of game very well (Contrary to what many people think or claim )

            cheers

            leo
            Ok, thanks for giving me the details. If you're running pathfinding at such extreme distances that you're hitting the max loop iteration count, I would seriously consider converting RunPathfinding to C++, but if you want to test out splitting up loops I've given you the way to do so. Let me know if you run into any issues on the way.

            Originally posted by LuckyDuck12 View Post
            Sorry if this more work than I'm expecting, but I have a question about the controls in the 2D version of the game. How would I modify them to keep the grid/turn based movement, but have the character move around with the keyboard keys instead.

            To further explain, there's a Madoka Magica game for the PSP that plays exactly like what I'm describing. here's a link: https://youtu.be/8STFz7lbVS4?t=702

            And I will describe what I'm trying to achieve with my controls here:

            With WASD, you can move forward, backwards and sideways one tile at a time . You use IJKL to turn the character making them face one of the directions above and you use the mouse to have a "free look" cam where you can look around without turning the character. Lastly, you press Z or Mouse-Click to actually attack the enemy.

            So far, this is all I have: Click image for larger version Name:	Capture.PNG Views:	1 Size:	215.4 KB ID:	1648537

            You can check the vid to see how it compares to the Madoka Magica game I'm trying to replicate.
            The game looks similar to the old Eye of the Beholder games or Grimrock. I did play around with adding movement like this a couple of years back. This is the sort of game where you would want to throw away a lot of the toolkit's code. You could still use the general grid system, of course.

            For movement you would disable the camera controls in BP_PlayerController_ATBTT and instead send the WASD input to the unit the player is controlling. When pressing W, for instance, you could then get the location one tile-length in front of the player unit (using the forward vector of the unit or camera, perhaps) and converting this location to a grid index (by using ConvertLocationToIndex in BP_GridManager).

            With this index you could check if GridUnits is occupied. If so you can trigger your attack event or function. If the tile is empty you can check if the current tile you are standing on (you could get this through GridIndex of the unit) has an edge in GridEdges connected to the tile in front of you. If so you could move the unit by lerping to that location.

            For free camera look there are several tutorials on this for Unreal Engine other places, and this would not need to be altered for the toolkit.

            Beware that this conversion will be a lot of work and I would not recommend attempting it unless you have a really good grasp of blueprints. If you want to try this, though, let me know if you run into any difficulties.

            Originally posted by angelbane019 View Post

            Thanks for the response. I will check this out and see what I can do.

            One problem I am having is I try to put in a breakpoint to see how these things run, but by doing so I think I interrupt the mouse hover location and it doesn't run properly. Any advice on where to put a breakpoint to trace moving and shooting actions?
            That is a bit tricky if you need to test out hover events, but for click events it should not be an issue. Try adding a break point to the Set node right after InputActionClick(Released) in BP_PlayerController_ATBTT and step through the event graph from here.
            Originally posted by angelbane019 View Post
            Let me try to rephrase my issue here.

            When playing the game, I am moving the mouse around on the grid to have a character either move or attack (or end the turn). When I click on the grid, I expect some "action" to fire; like "move" or "attack". From what I have been able to see, that action is "moveAttack".

            My question is, where in whichever blueprint is the logic that handles "they player just clicked here, so perform action moveAttack". What I am expecting is something along the lines of click > determine action > fire action.

            I hope this is clear.

            I am really trying to figure out how actions are handles so that I can customize them, but I am struggling because it seems that whenever a player's turn is up it is "activated" without the player deciding to do anything. I don't really know how else to describe it.

            Edit: After thinking about it, I think what I am looking for is which blueprints handle the main game loop.

            I assume it goes something like
            While( game not over):
            1) Go through each character - the turn manager does this
            2) Take input from the character's controller - I don't know where this is done
            3) Determine an action for that input - I don't know where this is done
            4) Execute this action - BP_Ability_MoveAttack seems to be doing this, as it's the only ability I can do
            5) Check if the game is over - I don't know where this is done


            Steps 2) and 3) are where I'd really appreciate some information.

            Thanks!
            Follow my suggestion above with the break point and you'll be able to see the whole execution chain, which should hopefully clear up the ambiguity. MoveAttack is the ability units have by default in the toolkit (defined in the units' DefaultAbility variable). When a unit is activated its default ability is activated by the player controller (called from the unit), which spawns an instance of that ability if needed, calls the Activate event for the ability and sets the active ability of the player controller to that ability, causing further input to be sent to the ability. Explaining every step of the process would be very cumbersome, and it is probably more helpful to step through it yourself with breakpoints as suggested. Also make sure to watch my ability tutorials if you have not done so already.

            Originally posted by LINEGAMES View Post
            Oh this is the function that I want.
            Thank you, but there is still a problem.
            If you look at the attached screen shot, the index that fails to move because Unit Size is 2, is still displayed as a movable area. Tell me how to fix it.
            Hmm, I see. This seems to be a problem with the default big unit stuff, as well (without the modifications we have discussed). I cannot immediately see what is causing this, but I've put in the bug list and will try to fix it in the next update.

            Originally posted by ClearlyUnified View Post
            Hi, Monokkel! I have bought the Kit around a year ago but only got to play with it recently. Yours is perhaps the best offer in the entire marketplace!

            Anyway, do you have any general tips on how to implement the knock off effect? Like a grenade shockwave that pushes the enemy 1 tile away from the explosion. Or something like a pull effect which pulls enemy to a specific tile? Maybe something like a Roadhog's hook from overwatch
            Once you know what tile you want to push/pull to, the effect is relatively simple to implement. For the game logic all you need to do is to remove the unit from the grid and re-adding it on another tile (you can use the RemoveUnitFromGrid and AddUnitToGrid functions in BP_GridManager). To animate the push happening you can add a new AnimateAction name option to BP_Unit, which takes the end location of the push as input and lerps the unit from its current location to this location.

            Finding the appropriate tile can be a bit more tricky, though, and your approach here will depend on the specific effect. For a pull effect you could for instance take

            ( Location(PulledUnit) - Location(PullingUnit) ) to get the distance between the units. You can then normalize this vector and multiply it by the width of a tile (200 by default) to get the location of the tile adjacent to the pulling unit which is between the pulling and pulled unit. Then you could convert this location to a grid index with ConvertLocationToIndex in BP_GridManager and use this as the grid index you add the unit to when you pull it. This could for instance be done in ExecuteAbility for a pull ability. Hope this gives you some ideas to build upon.
            The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

            Comment


              In other news, a game that used ATBTT in its creation was released on Steam today. It is called Forged of Blood and is a deep tactical turn based strategy game, which includes a lot of interesting systems such as spell crafting, a strategic map and extensive skill trees. A lot of work has clearly been put into this game and I recommend checking it out! I'm not being paid anything to market this or anything like that, but I just love keeping up to date on the various games that have put my toolkit to use and I'm super stoked to see this one released

              Here is a link to steam for those interested and their trailer:

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

              Comment


                Originally posted by Monokkel View Post
                What was the result of my last suggestion for the turn order stuff? What is the last action printed?

                For the right mouse button stuff, what you're seeing is probably the suggested path. In MoveAttack and some other abilities I added the option to display a suggested path (using the AI functionality of that ability). So I guess that part is working as intended, but you've somehow broken something in the regular hover functionality? I'd recommend printing strings along the hover execution chain (starting in the player controller, through Ability_Base, Ability and the specific ability you are using to see where it breaks.
                We changed game design to not involve more than one combat per level for now as we're working under heavy time pressure - will look into that later on. Yeah we broke something with the hover code, trying to find out via breakpoints.

                One more questions about abilities: we implemented a weapon switch functionality which changes the abilites in the unit's ability array - it works game play wise but the icon in the ability bar is not updated accordingly, some hints on how to achieve that?

                Comment


                  Originally posted by Dan.Ott View Post

                  We changed game design to not involve more than one combat per level for now as we're working under heavy time pressure - will look into that later on. Yeah we broke something with the hover code, trying to find out via breakpoints.

                  One more questions about abilities: we implemented a weapon switch functionality which changes the abilites in the unit's ability array - it works game play wise but the icon in the ability bar is not updated accordingly, some hints on how to achieve that?
                  Okay, though let me know when there is something else I can give input on. I thought about the issue you were reporting with the units seemingly attacking before moving. This is generally caused by passing an action to the unit that is not defined in the name switch after AnimateAction. For BP_Unit_Anim any name not in the switch is immediately passed along to the animation blueprint. The default behavior of the animation blueprint is the attack animation. It seems that your two issues might be related, as passing undefined actions to the unit can also cause the action queue to halt, which prevents you from animating new units once the new turn starts (which is what you saw with the game being stuck in WaitForOngoingActions).

                  To update the ability box after switching weapons, queue the UpdateAbilityBox action in BP_Unit (and InitializeQueuedActions in the action manager if this is not called otherwise)
                  The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                  Comment


                    Originally posted by Monokkel View Post

                    Okay, though let me know when there is something else I can give input on. I thought about the issue you were reporting with the units seemingly attacking before moving. This is generally caused by passing an action to the unit that is not defined in the name switch after AnimateAction. For BP_Unit_Anim any name not in the switch is immediately passed along to the animation blueprint. The default behavior of the animation blueprint is the attack animation. It seems that your two issues might be related, as passing undefined actions to the unit can also cause the action queue to halt, which prevents you from animating new units once the new turn starts (which is what you saw with the game being stuck in WaitForOngoingActions).

                    To update the ability box after switching weapons, queue the UpdateAbilityBox action in BP_Unit (and InitializeQueuedActions in the action manager if this is not called otherwise)
                    That's a good hint - we'll check the switch thanks! Ah - as we're using child classes of BP Unit Anim I simply missed there's such a function in the parent class although it's still not working the desired way - will get in touch later

                    Comment


                      Hi, I just purchased the Advanced Turn Based Tile Toolkit and am working to integrate it with my project. For my project I would like players to be able to explore/craft/etc.. without being in turns and use the turn-based system for combat. I was reading through this thread about how to implement this and am undecided on how to proceed. Is there a tutorial somewhere on how to implement these changes? Thanks

                      Comment


                        The new version , especially the turn manager (strategy mode) is fantastic!
                        Again I'm wishing climbing could come to us very quickly, hope it comes true

                        Comment


                          Hi Krut. I just asked you on the Youtube Channel about the chess movement in your grid. I saw you have the diamond shape and square shape. How can I create the cross, linear, diagonal, L shape movement pattern with your toolkit? I really need you to explain step by step because I am a new student with basic blueprint knowledge.

                          Firstly, I checked your tutorial steps on the youtube, I didn't find the GridEdges TMap you mentioned.


                          I found some script link to my chess game like the direction of the edges. I just make the array from enum direction and choose the direction to make the cross shape. How can I add it in your toolkit? Do you need to create the new construct script base on your direction edges with four cardinal directions like cross shape?


                          Do you need to add function like you create the diamond shape in GetIndexInRange Script?

                          Moving on this step, How I find reachable tiles by starting at a particular tile and add the neighboring tiles for a specified number of movement points? you can explain clearly this part. I do not get this step clearly.

                          The final step, What can we work with ChooseAndRunPathfindingSearchStep function?

                          Thanks.

                          Comment


                            Hey, sorry for the late reply, everyone. Seems I'm enjoying my vacation a bit too much.
                            Originally posted by Dan.Ott View Post

                            That's a good hint - we'll check the switch thanks! Ah - as we're using child classes of BP Unit Anim I simply missed there's such a function in the parent class although it's still not working the desired way - will get in touch later
                            Ok, best of luck. Let me know if any issues come up, but I won't be able to do any testing in engine until I'm back.

                            Originally posted by McNuggets87 View Post
                            Hi, I just purchased the Advanced Turn Based Tile Toolkit and am working to integrate it with my project. For my project I would like players to be able to explore/craft/etc.. without being in turns and use the turn-based system for combat. I was reading through this thread about how to implement this and am undecided on how to proceed. Is there a tutorial somewhere on how to implement these changes? Thanks
                            If you see the recent conversations between me and Dan.Ott in the last few pages of the thread you can see some of my suggestions on this. However, this implementation does not seem to be working perfectly for Dan, so there might be some issues I'm not aware of here.

                            To sum up my suggestion, the most straightforward way to "step out" of turn based combat is simply to not start the turn of a new unit when you end the turn of the last one. After that, turn based combat will be effectively paused and you can move around units etc. in any other way you'd like. When you'd want to resume turn based combat you would then simply start the turn of the next unit (through the turn manager). If units have moved since then you would first remove all units from their old positions on the grid by looping through all units and using RemoveUnitFromGrid from BP_GridManager. Then you would get their world locations, convert these to grid indexes using ConvertLocationToIndex (in BP_GridManager) and using AddUnitToGrid before starting the turn of the next unit.

                            Originally posted by FuTou View Post
                            The new version , especially the turn manager (strategy mode) is fantastic!
                            Again I'm wishing climbing could come to us very quickly, hope it comes true
                            Great to hear! There is climbing in the experimental map (Maps/Experimental/SplitMovement, I believe), though it is a bit hacky at the moment.
                            The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                            Comment





                              Great to hear! There is climbing in the experimental map (Maps/Experimental/SplitMovement, I believe), though it is a bit hacky at the moment.
                              Yeah, it's working. Climbing could be super useful to me, so it would be great if it's not that hacky.

                              Comment


                                Hey Knut, I have what is probably a stupid question. I am trying to give units an attribute for the number of attacks they make with a single attack action, so like Fighters can attack twice with one attack action but Mages would only attack once. I figure this can be done by having animations for the multi-attacks that give the ActionHit Notify more than once before the ActionEnd notify, then which animation you play for the attack would just depend on the value of the NumberOfAttacks attribute, which I created as an integer in BP_Unit as one of the public variables you made like Max Health, Speed, etc.
                                However, I have no clue how to reference that NumberOfAttacks variable in the animation or in the execution of the Animate Ability event on the BP_Unit_Melee. I'm sure it has something to do with BPIs, which I don't understand, and I have no clue what to do. Could you help? How would you approach this?
                                Thanks for your time.

                                Comment

                                Working...
                                X