Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    First I apologize for taking so long to reply. I've been travelling for the last couple of days, but now I've got access to hotel WiFi and should be able to respond more quickly.

    Originally posted by cooleyo View Post
    Hi Knut,

    I was wondering if it was possible to do a tutorial on having weapon pickups. Basically, changing the unit_player_melee character's boolean "HasGun" would change the animation states (so that the idle is now an idle with gun; the attack is a hip shot instead of a punch) the range and the targeting of the attack (instead of just highlighting the tiles around the character) so that while the boolean is true the character can act just like a unit_player_ranged. Ideally I would want this to be dynamic instead of swapping between two pawn types!

    The weapon pickup class would contain the information about the weapon (such as damage and range).

    This would eventually lead to being able to swap between multiple weapons during the player's turn by changing the value of a current_weapon_index variable (such as unarmed melee, ranged hip shooter and grenade launcher).
    Hi cooleyo, that might be something several people might be interested in, so I’ll consider making a tutorial about it. I won’t be able to until I’m back home again, though. Here is my first idea on how to achieve this, though.

    I’d first create a new actor type called weapon, which has a weapon mesh and variables for whatever attributes are tied to the weapon (a bool for damage, an integer for range etc.). Then I’d add this actor as a component to Unit_Parent and create various child actors for separate weapons. When the unit pick up a weapon I would change the unit’s weapon component to whatever weapon it is picking up. I’d then change the inputs in the various blueprints that get their input from stats such as range and damage to instead get the input from the variables stored within the unit’s current weapon.

    That should cover everything except for animation. Animation is not my strong suit, so there might be many ways to do this. If there is some way to simply swap out the various animations in the animation graphs based on the value of the weapon variable , then this would probably be the best idea. If not, one could make a more complex animation graphs that checks this value at the first branch entered in the graph, and branch off into different sub-graphs dependent on the weapon. I can’t look into this without my home computer, so let me know if you test this out and find a better solution.

    Originally posted by Imonin View Post
    Hello Monokkell,
    I am trying to put in an end turn button that will end the player turn for all pawns and begin the AI turn. I currently have it cycle through all of the pawns and use a switch on enum until it gets to the AI pawn. Where would be a good place to put and event or something that would jump right to the AI turn. I know I will still have to set the current pawn to what ever AI pawn is used. Any help with this would be appreciated, Thank you in advance.
    By default the current pawn is set in ATBTT_GameMode to whatever unit is currently on index 0 in the Initiative Order Array. When a unit ends its turn a custom event (the name escapes me) is called in ATBTT_GameMode that among other things runs the function “make the first pawn in initiative become the last” (I was a bit biblical in naming this one :P ). This sets the previous pawn at the last index of Initiative Order Array and shuffles the array so that every unit is one index higher (the one that was 1 becomes 0, since 0 is now empty etc.).

    For jumping to the AI’s turn, provided you still want the AI and player to have separate distinct turns, I would run this function on a while loop multiple times until the unit at index 0 has a faction variable of AI. I would put this at roughly the same place as the regular function is in the game mode now. I’d create a new variable called “Skip until AI unit found” or something that can be set from whatever place the player has the option to select this input. I’d create a branch on this variable in the game mode, and if true it should go to the while loop and if not use the regular, single “make the first pawn…” function.

    Originally posted by Wizard1200 View Post
    I think a cover system is better without an accuracy mechanic, because the randomization makes a game less tactical. Cover could reduce the damage by 50 %. A flanking mechanic makes a game much more tactical and it should be as important as the cover system. Flanking could increase the damage by 50 %.

    A range mechanic would be great, too. Every weapon could have an optimal range and if the target is not in that range the attack inflicts less damage. For example a shotgun could have an optimal range of 5 tiles and if the target is 12 tiles away the damage could be reduced by 70 %.
    Thanks for the input! I agree that turn based games without random probabilities can be really good. The Banner Saga is an excellent example of this. I think games with random probabilities can be just as good, however, but it is something that has to be carefully though about and must mesh with the rest of the gameplay. For instance, I think the randomness in XCOM makes the game better, as many of the game’s most engaging moments happen when you suddenly make that lucky shot that gets you out of a seemingly impossible situation, or a sneaky alien suddenly manages to taker out your only sniper, forcing you to rethink your tactics. I think randomness can too easily be used as a crutch for gameplay that is not properly balanced, though, and think more TBS games should consider not using random number generators for things like accuracy.

    However, for my game example I intend to include randomness as the current toolkit does not use randomness at all, and as such I can show users how to set this up. It should be easier for users to remove the random systems from the example than it would be to add their own.

    Incidentally setting up flanking and range to impact damage is pretty easy. For range, when inputting damage you could check the value of the range array for the index the target is standing on and reduce the damage depending on this. For flanking you could find units in a certain range of the target and if they are at certain positions (for instance if there are at least two enemy units within this range, where one has a Y or X coordinate higher than the target, while the other has one lower) you could increase damage.

    Originally posted by Wisdom-HELLy View Post
    Hi Wizard,

    I was able to implement a flanking logic (and rear attack also) almost easily by modifying Monokkel's toolkit logic a bit.
    Anyway I also think he can include this funcionality in the XCOM tutorial because for example real XCOM game has flanking option too
    I’ll probably add it in. It should, like I said, be fairly easy to add. The reason I haven’t added anything like this to the default toolkit is that I don’t want it cluttered with lots of if-statements for things that won’t be in many games. For game examples I have no such scruples, though
    Advanced Turn Based Tile Toolkit (Marketplace - Support)

    Dungeon Crawler Toolkit (Marketplace - Support)

    Discord

    Comment


      Originally posted by Monokkel View Post
      I think games with random probabilities can be just as good, however, but it is something that has to be carefully though about and must mesh with the rest of the gameplay. For instance, I think the randomness in XCOM makes the game better, as many of the game’s most engaging moments happen when you suddenly make that lucky shot that gets you out of a seemingly impossible situation, or a sneaky alien suddenly manages to taker out your only sniper, forcing you to rethink your tactics. I think randomness can too easily be used as a crutch for gameplay that is not properly balanced, though, and think more TBS games should consider not using random number generators for things like accuracy.

      However, for my game example I intend to include randomness as the current toolkit does not use randomness at all, and as such I can show users how to set this up. It should be easier for users to remove the random systems from the example than it would be to add their own.
      Yeah, it is very important to think carefully about the amount of randomess in a turn based game. I think in Sword of the Stars: The Pit the randomness is too high and the game can be frustrating. The Banner Saga or Invisible, Inc. are great turn based games without randomness and the player can learn from his mistakes.

      I think your approach is very good and i am looking forward to see more of your Advanced Turn Based Tile Toolkit.

      Comment


        Hey there!
        You asked me next time I had a problem/issue to bring it up here so thats what im doing
        I have duplicated out a hex cost tile and want to change it abit so when the player steps on it, there can be an interaction (A HUD widget appears asking if he wants to interact with the tile)
        How would I go about that?
        I have been looking around the toolkit blueprint but havent found a e.g "Player on tile" relevant event/function
        Thank you!

        Comment


          @Wizard1200: Good to hear we seem to have similar views on this

          @LDodds: Generally you can check if there is a unit on a specific tile by checking the appropriate tile index in the pawn array. However there is no built in way for the toolkit to know exactly when a unit steps on a specific tile. You would need to check this manually, but there is a variety of ways to automate it. The simplest way is probably to enable collision on the pawns' static meshes and above the custom tile (not on the PathTrace or RangeTrace channels) and fire your custom functionality from within the tile on overlap.
          Advanced Turn Based Tile Toolkit (Marketplace - Support)

          Dungeon Crawler Toolkit (Marketplace - Support)

          Discord

          Comment


            Okay thanks I just wasnt sure if there was a built in way or not!
            I am also interested in Imonin's question regarding an end turn button switching teams.
            This is what i have set up so far, what else do i need? as iv tested and it doesnt work
            Click image for larger version

Name:	Screenshot 2015-08-09 13.48.54.png
Views:	1
Size:	169.7 KB
ID:	1083455
            Note, the completed loop section hooks into the switch on enum faction but that was just trial and error

            Comment


              @LDodds: It looks mostly correct, but if you're after the same thing Imonin wanted you want the while loop to fire when the current pawn has faction player, not enemy.
              Advanced Turn Based Tile Toolkit (Marketplace - Support)

              Dungeon Crawler Toolkit (Marketplace - Support)

              Discord

              Comment


                I have just bought your tool kit. I'm not sure how to create a new project with it as the "add to project" button does not allow me to. When I add it to a project, two projects apear. When I create a new project and then add the tool kit to it, I am not able to drop the grid manager into it (The red circle with the line through it apears). When I right click the grid manager it says "failed to load assets.". I can not drag the hex one in either. When I try to go to "edit" on the hex manager it says "Blueprint could not be loaded because it derives from an invalid class. Check to make sure the parent class for this blueprint hasn't been removed!". If I for some reason try to duplicate the hex manager, unreal engine crashes. I can not drag in any pawns either.

                I am new to the unreal engine forums and only did a quick search around for anyone who is experiencing problems like these so i'm sorry if it's a commonly solved issue but, I have no idea what's going on or what to do about it. I'm using ureal engine 4.8.0. I have a feeling this isn't a specific problem with the tool kit. I've seen your guide to updating to 4.8 (not even sure if that's still relevent) but as i'm unable to even edit the grid manager, i'm unable to do any of that.

                /Edit:

                Nevermind. After searching around some more I found out that it was because I didn't update 4.8 to 4.8.3. After doing that the problems were solved.

                I do have a question now however. I'm currently trying to add pawns that can heal. To do this I want to add friedly fire. This is to have the healing pawns do negative damage as well as to have players need to watch out for any allies while using AoE attacks. I have a feeling you mentioned it somewhere in one of your videos (all of which i've watched) but, I don't remember which and when. I've rewatched them but haven't seen it.

                Next would be creating a menu for actions much like final fantasy tactics. Just setting the menu up with a single attack should be enough for me to figure out how to add other attacks and things like deffending but, I'm not sure how to go about starting that. Upon watching your "adding new features" video, i'm sure I can set up each attack; Getting a menu that allows for different attacks to be used is where i'm confused. My thought is to create a variable called "Actions", Give each button a number (ex. clicking "Deffend" on the menu makes "Actions" equal 3) and depending on the number, have an If branching statement link something like what you created in the video. It should then be: Menu pops up on player's turn -> Player clicks "normal attack" -> normal attack makes "attacks" variable equal 1 -> When "attacks" variable equals 1, and it's the default attack from there. Would this actually make any sense? I'd try it out before asking but i'm unsure of how to even do the menu to try it. Do you know any links to tutorials showing how to set up menus that can do this? And lastly (Sorry for all the questions), How would I get said menu to recognize which pawn is active even when i'm switching through ones that have yet to act?

                I do want to say that this tool kit is awsome and i'm planing to do major projects, proffesionally, with it eventually.
                I'm still fairly new to unreal but, I learn quickly so i'll probably figure most of the menu out by trial and error after awhile; So if the menu stuff turns out to be really basic feel free to ignore that. Friendly fire seems to be the harder part...
                Last edited by 死の警告; 08-12-2015, 01:44 AM. Reason: Figured out how to create project while the post was being reviewed.

                Comment


                  Originally posted by 死の警告 View Post
                  This is to have the healing pawns do negative damage as well as to have players need to watch out for any allies while using AoE attacks. I have a feeling you mentioned it somewhere in one of your videos (all of which i've watched) but, I don't remember which and when. I've rewatched them but haven't seen it.
                  In the video about area of effect explosion gun, you can learn more about affecting anything with AoEs.
                  https://www.youtube.com/watch?v=CeQMIp44904

                  Comment


                    Originally posted by Monokkel View Post
                    Thanks for the input! I agree that turn based games without random probabilities can be really good. The Banner Saga is an excellent example of this. I think games with random probabilities can be just as good, however, but it is something that has to be carefully though about and must mesh with the rest of the gameplay. For instance, I think the randomness in XCOM makes the game better, as many of the game’s most engaging moments happen when you suddenly make that lucky shot that gets you out of a seemingly impossible situation, or a sneaky alien suddenly manages to taker out your only sniper, forcing you to rethink your tactics. I think randomness can too easily be used as a crutch for gameplay that is not properly balanced, though, and think more TBS games should consider not using random number generators for things like accuracy.

                    However, for my game example I intend to include randomness as the current toolkit does not use randomness at all, and as such I can show users how to set this up. It should be easier for users to remove the random systems from the example than it would be to add their own.
                    I also agree that randomness in games (not just in TBS-games) can be good if they are designed properly, but they can just as easily be bad if they are designed badly.

                    I recently worked on expanding the toolkit to include randomness and it wasn't that hard to do. Granted it may not have been the pretties stuff you've seen, but it wasn't that hard to set up something that handles randomness


                    Originally posted by AxelRantila View Post
                    I know that in XCOM, on some landed/crashed UFOs, the tiles on the UFO itself is rotated 45 degrees compared to the rest of the map. But in that case I think that it would be easier to let a single grid manager handle rotated tiles as well somehow. But you know it better than me.
                    I want to make an errata to what I said about this (after playing a bit more of Long War). On medium ship maps, some of the outer walls was rotated 45 degrees compared to that of the grid. The grid itself however is not rotated.

                    Comment


                      I apologize again for taking a while to reply. As mentioned I’m checking the thread and my e-mails somewhat less often while on vacation as I’ve filled up most days with activities. I’ll be living on a boat for some days next week and I’m uncertain if I will be able to check the thread at all during that time, but feel free to post questions and I’ll try to answer them as soon as I’m able.
                      Originally posted by 死の警告 View Post
                      Nevermind. After searching around some more I found out that it was because I didn't update 4.8 to 4.8.3. After doing that the problems were solved.
                      Great that you managed to solve the problem yourself I hope it didn’t take too long to figure out.

                      Originally posted by 死の警告 View Post
                      I do have a question now however. I'm currently trying to add pawns that can heal. To do this I want to add friedly fire. This is to have the healing pawns do negative damage as well as to have players need to watch out for any allies while using AoE attacks. I have a feeling you mentioned it somewhere in one of your videos (all of which i've watched) but, I don't remember which and when. I've rewatched them but haven't seen it.
                      Cooleyo has linked to the correct video in his comment above (thanks!). In it I cover how to make area attacks with friendly fire. I’m uncertain if you’ll be able to simply input negative damage in the receive damage event in Unit_Parent to heal, but it should be trivial to modify the code to accept this if it’s not the case. Even if it works you will probably want to add an if-statement that prevents unit from being healed beyond max health.

                      Originally posted by 死の警告 View Post
                      Next would be creating a menu for actions much like final fantasy tactics. Just setting the menu up with a single attack should be enough for me to figure out how to add other attacks and things like deffending but, I'm not sure how to go about starting that. Upon watching your "adding new features" video, i'm sure I can set up each attack; Getting a menu that allows for different attacks to be used is where i'm confused. My thought is to create a variable called "Actions", Give each button a number (ex. clicking "Deffend" on the menu makes "Actions" equal 3) and depending on the number, have an If branching statement link something like what you created in the video. It should then be: Menu pops up on player's turn -> Player clicks "normal attack" -> normal attack makes "attacks" variable equal 1 -> When "attacks" variable equals 1, and it's the default attack from there. Would this actually make any sense? I'd try it out before asking but i'm unsure of how to even do the menu to try it. Do you know any links to tutorials showing how to set up menus that can do this?
                      I think your solution sounds pretty reasonable, but it might be able to make it even simpler depending on what you’re after. Creating a switch that runs a different piece of code each time Attack Victim is called in Unit_Parent is useful if you want to input your custom attack and run all the code that usually leads up to a custom attack (like the unit moving to the victim before attacking). If so I’d use a switch like you suggest, but I’d use an Enum instead of an integer, so you can more easily distinguish between the different attacks by looking at your code. If however you want to add effects that can trigger instantaneously when you click whatever action button you have added you can simply have clicking the button trigger a piece of code directly, without going through a switch. This depends on what you’re after. I must admit that menus and buttons is one of those things I know very little of, as I haven’t used them in UE4 yet (I’m pretty specialized when it comes to my skills at the moment). I’m positive it’s very simple to set up, though, but I cannot check from where I am at the moment. I imagine you can look at any tutorial for UMG and you will learn how you can run a specific blueprint event or function by clicking on a button you have added. Then you’d simply need to change your enum variable and/or run your attack code.
                      Originally posted by 死の警告 View Post
                      And lastly (Sorry for all the questions), How would I get said menu to recognize which pawn is active even when i'm switching through ones that have yet to act?
                      No need to apologize. There’s a lot of stuff to figure out once you’re starting out and I’m happy to help. Currently the current pawn is whichever pawn is currently selected, which means that if you’re switching between active pawns there is no way to figure out what is the “real” current pawn (since there is no such concept in the toolkit). If you have a situation where a different pawn is selected, but another pawn is actually the real current pawn you’ll have to add that yourself. I would add a new variable of type Unit_Parent in ATBTT_GameMode (called real current pawn or something else) and set this up when the current pawn is set up/switched in the game mode, but not switch it in ATBTT_PlayerController when you switch between units by clicking on them (the part in the bottom right of the blueprint graph if I remember correctly) if this is what you’re trying to achieve.
                      Originally posted by 死の警告 View Post
                      I do want to say that this tool kit is awsome and i'm planing to do major projects, proffesionally, with it eventually.
                      Thanks! I’m looking forward to seeing what you’ll make. Feel free to ask me anything you’re unsure about in this thread, and I’ll try to answer as soon as I’m able (which will be quicker once I’m back from vacation at the end of this month).
                      Originally posted by AxelRantila View Post
                      I also agree that randomness in games (not just in TBS-games) can be good if they are designed properly, but they can just as easily be bad if they are designed badly.

                      I recently worked on expanding the toolkit to include randomness and it wasn't that hard to do. Granted it may not have been the pretties stuff you've seen, but it wasn't that hard to set up something that handles randomness
                      Yeah, randomness shouldn’t be hard to do. It’s mostly just if-statements tied up to a random number in range which is again based on the value of some stat. Glad to hear you found it simple.

                      Originally posted by AxelRantila View Post
                      I want to make an errata to what I said about this (after playing a bit more of Long War). On medium ship maps, some of the outer walls was rotated 45 degrees compared to that of the grid. The grid itself however is not rotated.
                      Ok, thanks for letting me know. That makes a lot more sense for me, as I thought it was odd for Firaxis to add such a fundamental change to the underlying grid system just to achieve a minor change on some maps. Rotated walls should be simple enough to do with the toolkit.
                      Advanced Turn Based Tile Toolkit (Marketplace - Support)

                      Dungeon Crawler Toolkit (Marketplace - Support)

                      Discord

                      Comment


                        Hello Monokkel, I have successfully added another character and replaced his animations. However I ran into a roadblock trying to create entirely new animations. I already added the new animation to the state machine and a transition, but I don't know how you call your transitions. I see that events are called to change it, but I haven't found where they are called from nor where to add a new one. If you point me in the right direction I think I can figure out the rest.

                        Comment


                          Hi Torint,

                          the transitions are run when a specific boolean is set to true. For all animations except for movement these booleans are set by custom events within the various unit's event graphs (Unit_Player_Melee etc.). Transitions back are done when that boolean is false. This is done by animation notifies at the end of the animations that fire a custom event in the event graph of the animation blueprint that sets the boolean to false. For movement the animation is set in the top part of the animation blueprint's event graph, where it modifies a blend space based on the speed value of the owner unit's current speed float.

                          I hope that's enough info to help you out!
                          Advanced Turn Based Tile Toolkit (Marketplace - Support)

                          Dungeon Crawler Toolkit (Marketplace - Support)

                          Discord

                          Comment


                            Hey Knut!

                            I looked through all the threads and couldn't find anything that related to my issue, so I hope this is not a repost, but I think I found a few bugs. Either that or I am definitely not selecting an option correctly?

                            Issue #1: When creating a custom grid (dropping tiles on a grid then hiding the default tiles), If I hover over the bottom portion under the tiles in the game play window it is setting the hover marker to the default tile grid 0 index, as shown here;

                            Click image for larger version

Name:	atbtt-bug-hover-marker.png
Views:	1
Size:	916.8 KB
ID:	1084164

                            Issue #2: I am attempting to setup drag and drop units instead of click to move, when grabbing the unit and setting its location to the current mouse location it ends up 'snapping' to the default tile index 0. (I have selected 'Ignore Snap to Custom Grid' on the Unit Parent and the child itself just to be sure.)

                            Click image for larger version

Name:	atbtt_bug_drag_drop.png
Views:	1
Size:	779.8 KB
ID:	1084163
                            Attached Files

                            Comment


                              Hi, isthisbad. You have indeed found an unresolved bug there. I usually test on much larger maps, in which case this bug will not be visible. This is happening because I'm using a large, invisible collision plane to detect collision (including hovering and clicking) on the tiles. I'm doing this because individual collisions for every tile is inefficient. This is unproblematic on square maps, but for hexagonal maps there will be small, empty triangular sections along all edges that are overlapped by the collision plane.

                              When the toolkit looks for tiles on these locations it finds nothing and returns false, which in turn causes it to return index 0 for the bottom of the map, or the index on the other side of the map and one row up/down for the left and right side. To fix this the best way would be to modifythe Get Hit Tile LLocation and Index function in BP_Grid_Manager and add a branch that checks if it returns an out of bounds value.

                              I can't tell you exactly what you want to add as the input to this branch, as I cannot test it myself until I'm home in a couple of weeks. I'll make sure to add it to the next update, though. Thanks for letting me know!

                              As for your other problem I cannot know exactly what is going wrong without knowing how you have implemented drag and drop. It seems likely that something similar is happening here to the first issue, and that the Get Hit... function is returning 0. Grid snapping does not affect gameplay, only when working in the editor, so that shouldn't matter. Tell me more of your drag and drop implementation and I'll hopefully be able to provide more help.
                              Advanced Turn Based Tile Toolkit (Marketplace - Support)

                              Dungeon Crawler Toolkit (Marketplace - Support)

                              Discord

                              Comment


                                It was definitely the collision plane issue. Just fixed it by creating a grid larger than the viewing area for the default grid so that the collision plane would exceed the bounds of the window and never default to 0 index. The same held true for the drag and drop functionality. Once I changed the grid to be 20x20 instead of 9x5 and updated the index of where to place the pawns all was well. I should also mention that I set the camera to never move, I doubt this would have been an issue if I had camera follow on lol.

                                For a custom grid with all kinds of possible weird shapes I can understand the difficulty of setting the collision plane to a specific bounds, but it would definitely be nice

                                I appreciate the assistance!

                                Comment

                                Working...
                                X