Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    I'm sorry if I'm replying in the wrong place!

    Thanks for your reply. That movement cost type is much closer to what I wanted, thank you.

    The cost of movement isn't so much the problem like you said. A unit in my game should be able to move freely at the cost of AP without ending their turn. For example, I could move, cast an ability, and move again if I have AP left over, even if its 1 tile of AP left. I would like to convert the move_attack ability but maybe there's an easier way to set this up?

    I want it to be the default action (or unit ability) whenever you select a unit without having it in the ability bar.

    ​​​​​​​Edit: Looks like that movement type was enough! For some reason though when I get down to 2AP I lose the ability to move, even though I should have 2 tiles left. Must be some conditional somewhere I haven't found yet!

    Comment


      Originally posted by Monokkel View Post
      Thanks, I think I mostly get it now. This mostly comes down to array manipulation of the InitiativeOrder array. The devil is in the details, of course. Before I jump into this (will take some work) let me try to describe what you are saying back to you, so I'm sure I've got it.

      Players will have different units. Some of these will be individual units not part of a troop (like the green units above), while others belong to a troop (the aliens). At the start of a player turn you choose what unit to move. After the unit has done its action, if the unit is an individual unit the turn will pass to the next player. If it is part of a group the turn will pass to the next unit in the group, controlled by the same player, until the last unit in the troop has completed its action, at which point the turn is passed to the next player. Is this the right interpretation?

      A follow-up to that: should a player be able to choose the same unit or troop again and again, or do they have to exhaust all units and troops before they are allowed to choose freely on their next turn?

      Also, love the paint job on the debug wall tiles
      Easiest paint job ever, just had to turn the camera and it's like magic! Haha


      You nailed it, man. What you described with the solo units and the groups is what I meant and pretty much exactly what I'm going for!

      As for the follow up question, if possible I'd like to be able to limit which units take turns instead of letting them be picked freely when the turn is passed to the player. The idea is that the turns would already be predetermined in a given round and then play out in order. I'll lay out the game sequence just to give an idea of how I'd ideally like things to run.
      1. Game Start
      2. Players place their team's units where they want them to start within their home base hexes
      3. Some sort of dice roll RNG to decide who goes first in the round
      4. Round 1 turn order phase: players will have 3 turns in a round and will pick either a solo unit or a group unit to take those turns in a set order of 1, 2, and 3. The solo unit or group picked for these turns can be the same for all 3 turns. This is where I was thinking to set the initiative since we'd know who is going first and then it's just a matter of bouncing back and forth between units 1, 2, and 3 of either player. Once both players have selected the units for turns 1, 2, and 3, the turns begin.
      5. Player 1 turn 1
      6. Player 2 turn 1
      7. Player 1 turn 2
      8. Player 2 turn 2
      9. Player 1 turn 3
      10. Player 2 turn 3
      11. Round ends
      12. Repeat steps 3 to 11 until game has ended
      So in theory it doesn't seem that complicated, but I'm not sure how intricate things would need to be in a setup like this with the toolkit. If it's too tricky I can always try to make something else work, but let me know what you think. Thanks!

      Comment



        Originally posted by ser.man94 View Post
        no
        1 you show but not ful description i not found the files from descriptin. i atach te image.
        and the second is to enemy make a return atack i one turn.
        i ad the video with fight on hmm3. https://www.youtube.com/watch?v=KB9Q7RV9oAs
        ​​​​​​

        What files are you struggling to find? For counter-attacks this has been discussed a while ago in this thread. Try to replicate what Justo made and see if it works for you. If you have any issues, get back to me. The start of our discussion starts here. Then it goes back and forth for a few pages.

        Originally posted by Luna2442 View Post
        I'm sorry if I'm replying in the wrong place!

        Thanks for your reply. That movement cost type is much closer to what I wanted, thank you.

        The cost of movement isn't so much the problem like you said. A unit in my game should be able to move freely at the cost of AP without ending their turn. For example, I could move, cast an ability, and move again if I have AP left over, even if its 1 tile of AP left. I would like to convert the move_attack ability but maybe there's an easier way to set this up?

        I want it to be the default action (or unit ability) whenever you select a unit without having it in the ability bar.

        Edit: Looks like that movement type was enough! For some reason though when I get down to 2AP I lose the ability to move, even though I should have 2 tiles left. Must be some conditional somewhere I haven't found yet!
        Glad to hear that was enough! The 2AP issue is probably because of specifically how BP_MoveAttack is set up. If you check the PlayerActivate event you'll see how it switches based on the owning unit's AP. This is the bit you will need to modify, I believe.

        Originally posted by Reinhart_x View Post
        Easiest paint job ever, just had to turn the camera and it's like magic! Haha
        Really, just the angle? Well, my color vision was never great.

        Originally posted by Reinhart_x View Post
        You nailed it, man. What you described with the solo units and the groups is what I meant and pretty much exactly what I'm going for!

        As for the follow up question, if possible I'd like to be able to limit which units take turns instead of letting them be picked freely when the turn is passed to the player. The idea is that the turns would already be predetermined in a given round and then play out in order. I'll lay out the game sequence just to give an idea of how I'd ideally like things to run.
        1. Game Start
        2. Players place their team's units where they want them to start within their home base hexes
        3. Some sort of dice roll RNG to decide who goes first in the round
        4. Round 1 turn order phase: players will have 3 turns in a round and will pick either a solo unit or a group unit to take those turns in a set order of 1, 2, and 3. The solo unit or group picked for these turns can be the same for all 3 turns. This is where I was thinking to set the initiative since we'd know who is going first and then it's just a matter of bouncing back and forth between units 1, 2, and 3 of either player. Once both players have selected the units for turns 1, 2, and 3, the turns begin.
        5. Player 1 turn 1
        6. Player 2 turn 1
        7. Player 1 turn 2
        8. Player 2 turn 2
        9. Player 1 turn 3
        10. Player 2 turn 3
        11. Round ends
        12. Repeat steps 3 to 11 until game has ended
        So in theory it doesn't seem that complicated, but I'm not sure how intricate things would need to be in a setup like this with the toolkit. If it's too tricky I can always try to make something else work, but let me know what you think. Thanks!
        Working on this question now, but got interrupted. I'll update this post once I have a solution.

        Edit: This turned out to be more challenging than I expected. Going to need to put this on hold and get back to it in a couple of days.
        Last edited by Monokkel; 05-23-2020, 02:53 PM.
        The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

        Comment


          So, been struggling with multi-level and understanding the meaning of the different settings (yes, watched this https://www.youtube.com/watch?v=e-YG...15jXKF&index=8 many times).

          For my case, I'm looking at creating 150 height hex meshes, that can then be stacked on top of each other. Using general map as a starting point, I set the max grid to 1000, and height between levels to 1000. Basically, you can't go underneath.

          The height impassable is 200, and height slow is 200.

          This seems to work, and I can create a stairs of 6 each incrementing by 150. And that works. However, using height impassable of 150 only allows climbing the first stair. Looking at the code, its not quite obvious why although I'll note that the code description for the GetEdgeCostFromZDifference comment doesn't seem to match the flow. Oh and heightmap is set to 1 level

          Also, it sounds like that the height between levels is only really useful if you are allowing the setup to automatically figure out levels... I did try the above with heightmap both at 1 level, as well as multi-level.

          Thoughts?

          Comment


            Hello! I am fairly new to UE4, and I can't seem to find where certain variables are utilized in the Unit blueprints. I am trying to generate randomized stats for each character in combat, so things like movement speed, max health, melee damage, etc. are varied. I'm not having trouble with generating the values I want, I'm having trouble finding where to put them. For example, I can only find references to the "Current Health" variable, when I want my random values to be manipulating the "Max Health" variable instead.

            I want to be able to run randomized units in the code, rather than just manually modifying units via the details tab in the editor. Where can I plug my numbers in?

            (Thanks for the incredible toolkit by the way, it will truly shave years off of the work I need to put into this project. Absolutely stellar!)

            Comment


              Originally posted by thzero View Post
              So, been struggling with multi-level and understanding the meaning of the different settings (yes, watched this https://www.youtube.com/watch?v=e-YG...15jXKF&index=8 many times).

              For my case, I'm looking at creating 150 height hex meshes, that can then be stacked on top of each other. Using general map as a starting point, I set the max grid to 1000, and height between levels to 1000. Basically, you can't go underneath.

              The height impassable is 200, and height slow is 200.

              This seems to work, and I can create a stairs of 6 each incrementing by 150. And that works. However, using height impassable of 150 only allows climbing the first stair. Looking at the code, its not quite obvious why although I'll note that the code description for the GetEdgeCostFromZDifference comment doesn't seem to match the flow. Oh and heightmap is set to 1 level

              Also, it sounds like that the height between levels is only really useful if you are allowing the setup to automatically figure out levels... I did try the above with heightmap both at 1 level, as well as multi-level.

              Thoughts?
              Sorry, but I'm not really able to visualize the desired end result here, which makes it difficult to come up with suggestions. How does the game look and play? Are you stacking the tiles during gameplay? How are units intended to move between tiles?

              Originally posted by spartacusthegod View Post
              Hello! I am fairly new to UE4, and I can't seem to find where certain variables are utilized in the Unit blueprints. I am trying to generate randomized stats for each character in combat, so things like movement speed, max health, melee damage, etc. are varied. I'm not having trouble with generating the values I want, I'm having trouble finding where to put them. For example, I can only find references to the "Current Health" variable, when I want my random values to be manipulating the "Max Health" variable instead.

              I want to be able to run randomized units in the code, rather than just manually modifying units via the details tab in the editor. Where can I plug my numbers in?
              MaxHealth is a variable in BP_Unit. Perhaps you are modifying one of its child blueprints and have forgot to check Show Inherited Variables? Where it makes sense to put the code for modifying attributes depends a lot on the needs of your game. Want to modify unit abilities by clicking on them during gameplay? Use an ability. Want to assign random stats when a unit is spawned, do it at EventBeginPlay for BP_Unit.

              Originally posted by spartacusthegod View Post
              (Thanks for the incredible toolkit by the way, it will truly shave years off of the work I need to put into this project. Absolutely stellar!)
              Glad you like it!
              The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

              Comment


                Hi Knut,

                I am having a hard time with AI - I often get hung up with an infinite loop in my move_attack ability right after the AI activate AP > 1 conditional false evaluation. I believe its due to evaluation of abilities tying for 0 maybe? I honestly can't figure it out. I have all of my AI logic in BP_Ability except for the AI Activate in move_attack. I changed my move_attack ability to cost 0 to move and using the units move cost, but cost 2 AP when the unit attacks - and I subtract that AP in the execute ability function after a conditional.

                For some reason when using other abilities though, in move_attack I had to change the AP > 1 evaluation to .005 which seems to do the trick, but my enemies get away with moving and not spending any AP sometimes. I am logging the abilities they activate, and they can move without activating the move_attack ability. I can't do the same thing with my player controlled characters. These issues don't seem related but I can't figure out whats going on. And why the value of 0 in the evaluation loops forever I'm not sure.

                Comment



                  Originally posted by GENESIS EMMANUEL View Post
                  GENESIS EMMANUEL

                  Hi Monokkel,

                  Great day! I intend to make a plan phase and execute phase in every turn encapsulating both individual unit of each team. For example, in a game where there are 2 opposing teams with 1 unit per team, the turn 1’s plan phase is when team A plans the unit’s movement and action then store it in a variable then team B does the same. Then the plan phase is done and the execute phase starts by implementing the stored variables for both team A and B at the same time. Then that ends the execute phase then turn 2 starts by going back to another plan phase. I would like to ask for your help on how to go about it please.
                  Hi Emmanuel, that question is a bit more difficult than the one I thought you were asking on the store page. The first part of storing target locations for abilities and then executing them automatically at a later point is a bit of a challenge, but very much doable. The second part of having all of those actions play out simultaneously is a much larger challenge. It goes against an assumption built into the toolkit, which is that actions resolve serially. That is not to say it is impossible to work around it, but you will need to be creative and put in a lot of work.

                  Let me give you something to get started if you still want to give it a try, though.

                  First I've created a duplicate of BP_Unit_Anim that I've called BP_Unit_Simultaneous. It is identical, except that it also has a variable called MoveTargetIndex, that it uses to store a grid index it has previously chosen to move to. I set the default to '-1', which I will later use as an indicator of the value being "empty".

                  Then I create a duplicate of BP_Ability_Move, which I've called BP_Ability_SimuMove. I make a few changes to it.

                  In EventServerInteract, after checking that a clicked tile is valid, I check if the owning unit has a value other than '-1' stored in its MoveTargetIndex variable. If not I set this value to the clicked tile and end the unit's turn (setting CurrentAP to 0 and calling SignalAbilityExecuted). If it does have a stored value, I set ClickedIndex to this value, and continue the execution chain as if this tile had just been clicked.



                  Make sure to remove the SignalAbilityExecuted at the far right of the Click comment box so it is not called twice.

                  Now at PlayActivate, after RunPathfinding is called I check if there is a MoveTargetIndex stored from last turn. If not, then I activate the ability as normal. If there is one, however, I call ServerInteract with the stored variable as input, essentially simulating a click on the stored tile immediately after the ability is activated at the start of the unit's turn:



                  So far so good. We now have a setup where each unit chooses their move target first, and then we play both of them automatically, in sequence:




                  To get them moving simultaneously we need to get a bit hacky. Ideally you would want to make some major modifications to the ActionManager to keep it clean. Here is a starting point, at least.

                  In the Move comment box in Event Graph of BP_Unit i set the InstantDeactivate input in both QueueAction macros to true. This means that the action manager will immediately skip to the next action as soon as this movement has started. I also Remove the EndAction call that is called at the end of the MoveTimeline, since EndAction is called automatically if InstantDeactivate is true.

                  What we have now looks like this:



                  Almost there, but there is an issue. Since we just skip over all actions, the toolkit has no way of knowing that is should wait to start the next turn, so the next turn is starting immediately, with a new pathfinding being generated from where one of the units ends up after it has moved. Normally the TurnManager would wait for all queued actions to end before doing, so but since we're calling EndAction immediately this does not happen.

                  To get around this I add a new variable to BP_Unit that is set to true while it is animating and then false when it is done. When the turn manager wants to start a new turn it continously checks if all units have animating set to false before starting the next turn. I set bAnimating to true at the start of MoveToIndex in BP_Unit and set it to false where I would normally call EndAction after a move (Bottom right in the Move Timeline comment box).

                  Then I add the following function to BP_TurnManager that checks if there are currently any animating units:



                  and I do a delayed loop on BeginNewTurn that does not start a new turn until no more units are animating:



                  And finally we have simultaneous movement that looks decent:



                  Ok, so that is something, at least. You would of course need to modify all other abilities in a similar fashion, designing around issues such as two players selecting the same tile etc. This is to show that while simultaneous turns are not inherently impossible, I would not recommend going that way unless you feel extremely confident in both your blueprinting abilities and your knowledge of the inner workings of this toolkit.

                  I'm sorry that I didn't completely understand your question when you asked it in the store page. I hope you did not buy the toolkit under the assumption that implementing simultaneous turns would be easy, based on my reply. If so, feel free to ask Epic for a refund request on the toolkit. It is, in its present state at least, tricky to work with if you plan to make a game that is not fully turn based.



                  Thank you for posting this!! I'm working on integrating this into my project/experiment and before I completely destroy everything lol, I'm wondering how you would approach adding time-based ticks for execution... I'll try to explain what I mean here.

                  3 players on the grid - A, B, and C.

                  Player A chooses to move 6 tiles away, costing him 6 AP (1 move per AP)
                  Player B chooses to move 3 tiles away, costing him 3AP
                  Player C chooses to move only 2 tiles , costing him 2AP

                  No additional players are idle so the turn begins ticking and players begin moving, 1 move increment at a time, simultaneously.

                  2 "ticks" in - Player C is done moving and becomes idle. Gameplay pauses and Player 2 can choose a new action - he moves 4 tiles away.

                  No additional players are idle so the turn ticks and players move one more space.

                  Player B has now completed his 3 movements and is idle - Gameplay pauses and he may select a new movement.

                  EDIT: Just wanted to add that I'm not expecting a full-blown ordeal like you've done above - just generally what I would want to start modifying. I'm guessing it would be the turn manager and the new simulmove ability that I make mainly?

                  EDIT2: Yikes, pausing all moving units while the available unit takes his turn is proving to be a real challenge. - @Monokkel This is what I'm trying to do - When the first unit stops moving, all other units should stop on their tile, preferably freezing in place, while the available unit makes his next move. When he chooses his next tile, everyone unfreezes and continues moving.

                  Last edited by Koniferus; 05-26-2020, 07:41 AM.

                  Comment


                    Originally posted by Monokkel View Post

                    MaxHealth is a variable in BP_Unit. Perhaps you are modifying one of its child blueprints and have forgot to check Show Inherited Variables? Where it makes sense to put the code for modifying attributes depends a lot on the needs of your game. Want to modify unit abilities by clicking on them during gameplay? Use an ability. Want to assign random stats when a unit is spawned, do it at EventBeginPlay for BP_Unit.

                    It really IS that simple, okay then! I've been overthinking the programming all weekend, it seems. Thank you for the help, much appreciated!

                    Comment


                      Hi Monokkel
                      I am trying to implement using each move as a AP point (which I did), for the player works fine, but for the AI, the movement animation is not playing correctly.
                      What I did was:
                      Created a blank project (unreal 4.24)
                      Added two BP_Unit_Anim, one player and one enemy (AI)
                      Added ability system with Move and Attack abilities
                      CHanged the Move Range on Move ability (as below image)
                      Click image for larger version

Name:	Capture.PNG
Views:	35
Size:	67.3 KB
ID:	1766630
                      Changed the cost to be Custom (1) and set the UseEndsTurn to false on the move ability.

                      When it is the AI turn, the first time it uses move, works fine, the second and third times (the unit have 3AP) the animation does not start from the previous location, it starts from someplace else.
                      Couldn´t upload the gif here, so here is a link to it
                      https://media.giphy.com/media/fVbcCt...I6qN/giphy.gif
                      Also, if the player unit is 6 or less indexes away, the AI will seem to use a single Move_Attack with 6 move points (even though it does not have the Move_Attack ability)

                      any idea on how to fix this?
                      also, is there a way to force a delay every time an AI unit spends an AP point to sort of simulate the AI "thinking" before making every move?

                      ps: sorry if it was asked and answered before

                      Comment


                        Originally posted by Koniferus View Post




                        Thank you for posting this!! I'm working on integrating this into my project/experiment and before I completely destroy everything lol, I'm wondering how you would approach adding time-based ticks for execution... I'll try to explain what I mean here.

                        3 players on the grid - A, B, and C.

                        Player A chooses to move 6 tiles away, costing him 6 AP (1 move per AP)
                        Player B chooses to move 3 tiles away, costing him 3AP
                        Player C chooses to move only 2 tiles , costing him 2AP

                        No additional players are idle so the turn begins ticking and players begin moving, 1 move increment at a time, simultaneously.

                        2 "ticks" in - Player C is done moving and becomes idle. Gameplay pauses and Player 2 can choose a new action - he moves 4 tiles away.

                        No additional players are idle so the turn ticks and players move one more space.

                        Player B has now completed his 3 movements and is idle - Gameplay pauses and he may select a new movement.

                        EDIT: Just wanted to add that I'm not expecting a full-blown ordeal like you've done above - just generally what I would want to start modifying. I'm guessing it would be the turn manager and the new simulmove ability that I make mainly?

                        EDIT2: Yikes, pausing all moving units while the available unit takes his turn is proving to be a real challenge. - @Monokkel This is what I'm trying to do - When the first unit stops moving, all other units should stop on their tile, preferably freezing in place, while the available unit makes his next move. When he chooses his next tile, everyone unfreezes and continues moving.

                        Hmm yeah this is a challenge alright. I can give you some places to start, but not sure if it is the best approach. This will require a lot of experimentation, I think. I guess what you could do is to store the length of the path of each unit in each unit. Then when all units have chosen their move and a new turn starts (the one that starts playing all animations automatically) you would first loop over all units and find the shortest path.

                        You could store this in some place all units have access, like the game state. Then when the units activate their abilities you would find this value. After finding the path to an index using the stored target index you would loop over the output PathIndex array and only keep the amounts of indexes equal to the length of the shortest path, take the last index of this cut down array and use it as the new TargetIndex for the ability. Then you would keep the old target index as the target index stored in the unit, so it will keep going the next time it is activated.

                        Those are my initial thoughts, at least. You are taking the toolkit in a pretty different direction than what it is meant for, so my suggestions will have to be a lot more tentative than usual.

                        Originally posted by spartacusthegod View Post
                        It really IS that simple, okay then! I've been overthinking the programming all weekend, it seems. Thank you for the help, much appreciated!
                        Happy to help!

                        Originally posted by Jascicleiton View Post
                        Hi Monokkel
                        I am trying to implement using each move as a AP point (which I did), for the player works fine, but for the AI, the movement animation is not playing correctly.
                        What I did was:
                        Created a blank project (unreal 4.24)
                        Added two BP_Unit_Anim, one player and one enemy (AI)
                        Added ability system with Move and Attack abilities
                        CHanged the Move Range on Move ability (as below image)
                        Click image for larger version

Name:	Capture.PNG
Views:	35
Size:	67.3 KB
ID:	1766630
                        Changed the cost to be Custom (1) and set the UseEndsTurn to false on the move ability.

                        When it is the AI turn, the first time it uses move, works fine, the second and third times (the unit have 3AP) the animation does not start from the previous location, it starts from someplace else.
                        Couldn´t upload the gif here, so here is a link to it
                        https://media.giphy.com/media/fVbcCt...I6qN/giphy.gif
                        Also, if the player unit is 6 or less indexes away, the AI will seem to use a single Move_Attack with 6 move points (even though it does not have the Move_Attack ability)

                        any idea on how to fix this?
                        also, is there a way to force a delay every time an AI unit spends an AP point to sort of simulate the AI "thinking" before making every move?

                        ps: sorry if it was asked and answered before
                        Hey, sorry, but I'm a bit unsure of what to do here. It is simpler if you could give me the desired outcome in more detail, which would make it simpler to find the best solution. How do you want this to play out in your game? How do action points/movement work in your game and how would you expect the turn to play out if everything worked like you wanted it to?
                        The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                        Comment


                          Originally posted by Monokkel View Post
                          ​​​​​

                          Working on this question now, but got interrupted. I'll update this post once I have a solution.

                          Edit: This turned out to be more challenging than I expected. Going to need to put this on hold and get back to it in a couple of days.
                          No problem, thanks for taking the time to look into it!

                          Comment


                            Originally posted by Monokkel View Post

                            Hmm yeah this is a challenge alright. I can give you some places to start, but not sure if it is the best approach. This will require a lot of experimentation, I think. I guess what you could do is to store the length of the path of each unit in each unit. Then when all units have chosen their move and a new turn starts (the one that starts playing all animations automatically) you would first loop over all units and find the shortest path.

                            You could store this in some place all units have access, like the game state. Then when the units activate their abilities you would find this value. After finding the path to an index using the stored target index you would loop over the output PathIndex array and only keep the amounts of indexes equal to the length of the shortest path, take the last index of this cut down array and use it as the new TargetIndex for the ability. Then you would keep the old target index as the target index stored in the unit, so it will keep going the next time it is activated.

                            Those are my initial thoughts, at least. You are taking the toolkit in a pretty different direction than what it is meant for, so my suggestions will have to be a lot more tentative than usual.
                            Thanks! - any ideas that come to mind are greatly appreciated. For now, I'm focusing on learning everything you've created so far with your youtube videos and whatnot, then I will probably have to gut everything that doesn't apply to my vision/idea.

                            Generally, I had only worked on FPSs with UE4, so I needed something to get my brain going in the turn-based direction and your template is gold for that! Really impressive what you have done and the amount of time you've put into the project as well as helping everyone!

                            Comment

                            Working...
                            X