Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Originally posted by Domsndom View Post
    Hi guys , i already discussed the topic with Monokkel on his discord channel but he asked me to repost it in the thread .so here it is =)...

    My goal is to make the movement controlled over a chat command system . so i need to generate a grid in range of 1 or 2 around the actor that diplays a subgrid showing a standard "abc-123" grid .
    and if a chat command says for example A5 the actor moves to this location .
    it doesnt need to be a a set of fresh tiles to be generated . just something like the existing highlighting grid in range but with a coodinate system that never changes visually for the player .and doesnt change position but rotation on camera rotation .

    something like that :
    {"alt":"Click image for larger version Name:\tgrid example.PNG Views:\t4 Size:\t616.9 KB ID:\t1848028","data-align":"none","data-attachmentid":"1848028","data-size":"medium"}

    . then i want Twitch-chat or something like it to vote on the tile to move to from within the blue ones
    and then i want to create a new move range around the moved to location and repeat the process..

    in this case 1A would be 1003 . so if a chat vote says 1A the actor moves to 1003.

    thanks in advance and hopefully this was clear enough .

    sry for my bad english
    Thanks for reposting the question here. Explaining it will take a bit of time and require several screenshots, so the forum is better suited than Discord. I have managed to achieve something like the effect you are after. Some parts are more hardcoded than I would like and you would need to add better checks for valid input etc., but it should be a good starting point.

    So there are a few parts to this. First we need to display the chess board style tile names. First, here is the function for displaying the tile names in a set range:



    You can see that I have hardcoded the integer to letter conversion here. Might be a cleaner way to do this in blueprints, but it is functional. The ClearChatText function at the start simply loops over and deletes the text objects in the ChatTextObjects array, then clears the array.



    Next I added some code in the Player Controller for receiving input from the chat and converting it to an appropriate tile index. The tile index here will not be absolute, but relative to the source index. This function needs to receive input in the [letter,number] format. I have not added checks to ensure this, so this needs to be done.



    The SelectTileFromChatInput function is defined in the Grid Manager and looks as follows:



    The GetLetterAlphabetIndex being another hardcoded function, looking like so:



    The Player Controller passes along the index into the current active ability using a new custom interface. The interface contains a single function (The ReceiveDamageInput function you see above).

    I've created a new ability, a duplicate of BP_Ability_Move. I add my new interface to this class. When activated I spawn the input indicators on the tiles:



    Note that you should probably rather do this as an action so that it is appropriately queued, but this explanation is long enough as it is, so I'm keeping it simple here.

    I implement the ReceiveChatInput interface function like so:



    If you don't understand why I'm multiplying by 1000 here, see my tutorial video on grid indexing.

    Other than that the ability is the same of BP_Ability_Move, except a small hack I added. I set the action points of the active unit to 0 as part of ServerInteract. This is just so that the turn automatically ends after the unit has used the ability. This might not how you want it to be, but it works for demonstration purpose so that you don't have to click EndTurn after each input.

    Lastly we need some way to enter the input. I'm not adding any Twitch integration for this example, so I'm using a simple editable textbox widget, which should serve well enough as a stand in. Here I've just thrown it haphazardly onto WBP_ATBTT:



    It implements the following event:



    Ok, I think that should be all of it. Hope I didn't miss anything. Some of it is a bit hacky, there might be unforseen bugs and whatnot, but this should be a good enough starting point, I think. Let me know if you get it working. Here is a gif of it in action:



    Hope this is close to what you were after

    Last edited by Monokkel; 01-02-2021, 09:57 AM.
    Advanced Turn Based Tile Toolkit (Marketplace - Support)

    Dungeon Crawler Toolkit (Marketplace - Support)

    Discord

    Comment


      Hey there! I purchased this toolkit awhile back and have had tons of fun playing with it and manipulating it in various ways. Thanks so much for your work!

      As of right now, I have your toolkit imported into my 3rd person game. The way your toolkit works by default, I have to load a new level for combat to begin. I would like to be able to walk around the map in 3rd person and trigger combat without loading a new level. Basically, player walks into a trigger box, the grid spawns and the player snaps to their nearest grid tile, and combat begins. I would like it to be as seamless as possible, if possible.

      Do you have any tips on how to implement this? Thanks again for any help you can provide!

      Comment


        Originally posted by Hayden Meek View Post
        Hey there! I purchased this toolkit awhile back and have had tons of fun playing with it and manipulating it in various ways. Thanks so much for your work!

        As of right now, I have your toolkit imported into my 3rd person game. The way your toolkit works by default, I have to load a new level for combat to begin. I would like to be able to walk around the map in 3rd person and trigger combat without loading a new level. Basically, player walks into a trigger box, the grid spawns and the player snaps to their nearest grid tile, and combat begins. I would like it to be as seamless as possible, if possible.

        Do you have any tips on how to implement this? Thanks again for any help you can provide!

        Check out the Hybrid map located in the experimental folder. Does exactly what your looking for.

        Comment


          Hey Knut. I just got the toolkit and I'm also totally new to Unreal. I was wondering how I can make static characters with the new puppet system. The youtube videos are outdated and I'm really not sure how to go about it. Thanks.

          Comment


            Originally posted by juhone View Post
            Hey Knut. I just got the toolkit and I'm also totally new to Unreal. I was wondering how I can make static characters with the new puppet system. The youtube videos are outdated and I'm really not sure how to go about it. Thanks.
            Hi, tutorials for adding units are next on my list, but until then here is the event graph for a puppet with a static mesh. This is a basic starting point without any animations. You could set up animations within the AnimatePuppet event here similar to what is done in the old tutorial:


            Hope that helps
            Advanced Turn Based Tile Toolkit (Marketplace - Support)

            Dungeon Crawler Toolkit (Marketplace - Support)

            Discord

            Comment


              Originally posted by Monokkel View Post

              Hi, tutorials for adding units are next on my list, but until then here is the event graph for a puppet with a static mesh. This is a basic starting point without any animations. You could set up animations within the AnimatePuppet event here similar to what is done in the old tutorial:
              Hope that helps
              Thanks, got it working now!
              BTW I'm one of the guys who made Legend of Grimrock 1 & 2, so it was pretty cool to see you mentioning LoG on your Dungeon Crawler Toolkit description

              Comment


                Originally posted by juhone View Post

                Thanks, got it working now!
                BTW I'm one of the guys who made Legend of Grimrock 1 & 2, so it was pretty cool to see you mentioning LoG on your Dungeon Crawler Toolkit description
                Great that it worked out, and awesome to hear that you are one of the Finns from Almost Human and Ctr Alt Ninja! It goes without saying that your team's work has been a massive inspiration Both Grimrocks were fantastic games and I found it hard to improve upon your stellar UI work, which is modern and flexible while still feeling like its old-school inspirations. I also played quite a bit of Druidstone, which I believe you were the art director on. Excited to see what you'll be doing with my toolkit
                Advanced Turn Based Tile Toolkit (Marketplace - Support)

                Dungeon Crawler Toolkit (Marketplace - Support)

                Discord

                Comment


                  Originally posted by Monokkel View Post

                  Great that it worked out, and awesome to hear that you are one of the Finns from Almost Human and Ctr Alt Ninja! It goes without saying that your team's work has been a massive inspiration Both Grimrocks were fantastic games and I found it hard to improve upon your stellar UI work, which is modern and flexible while still feeling like its old-school inspirations. I also played quite a bit of Druidstone, which I believe you were the art director on. Excited to see what you'll be doing with my toolkit
                  Awesome to hear you liked the games. I did all the 2d & 3d graphics for LoG1 and Druidstone and had one guy helping with LoG2, so that means I'm a graphics artist and basically don't know how to code I'm playing around with UE just to learn new stuff, so I may be here often with my stupid questions. But thanks for this toolkit, it's great to have a solid base to play with.

                  Comment


                    Originally posted by juhone View Post

                    Awesome to hear you liked the games. I did all the 2d & 3d graphics for LoG1 and Druidstone and had one guy helping with LoG2, so that means I'm a graphics artist and basically don't know how to code I'm playing around with UE just to learn new stuff, so I may be here often with my stupid questions. But thanks for this toolkit, it's great to have a solid base to play with.
                    Well, I'm honored These days I think it is a lot easier for an artist to branch off into programming than the other way around, and blueprints make this doubly so. Hope you have fun with the toolkit. If you have quick questions or just want to chat, the toolkit has a pretty active Discord channel (link in my signature). For more involved questions this support thread is a better fit.
                    Advanced Turn Based Tile Toolkit (Marketplace - Support)

                    Dungeon Crawler Toolkit (Marketplace - Support)

                    Discord

                    Comment


                      Hello again! This time I have a question about unique ability ranges. I currently have an ability that targets a straight line in front of the user in any of the four directions, hitting every unit in that line. I got it to work perfectly for the player, but I'm having trouble with the AI not using it correctly. I implemented this by setting the range on any AOE ability to 1 with diamond visibility, allowing the user to essentially select a direction for the ability to be performed. I then added a function within BP_Ability called "Find Connected Targets", which outputs a set of indexes based off what direction the attack is used in. On a single target ability, this would simply return a set with nothing in it. With the line ability, it would return all indexes in a separate "line range" variable for that direction. It is loosely based off of the "FindSurroundingPossibleTargets" function in the grenade ability, but without the collision capsules.

                      When the AI tries to use this ability, it sometimes fails to find any targets or it uses the ability in a completely different direction. I believe the issue is with the "Find Potential Targets" function in BP_Ability. I've tried overriding it based on how the grenade ability has it, among other setups, but nothing worked. This is probably due to the strange line range and how I have the range variable set to 1 to choose a direction. However, when I originally tried to use the included range variable, I had trouble getting the line to work.

                      My question is, is there a way to alter "Find Potential Targets" so that it could work with the "Find Connected Targets" function that I created, or is there a better way entirely to implement these kinds of unique ranges? (more than likely the case as I am not a very experienced coder)

                      Comment


                        Originally posted by Munchydo1 View Post
                        Hello again! This time I have a question about unique ability ranges. I currently have an ability that targets a straight line in front of the user in any of the four directions, hitting every unit in that line. I got it to work perfectly for the player, but I'm having trouble with the AI not using it correctly. I implemented this by setting the range on any AOE ability to 1 with diamond visibility, allowing the user to essentially select a direction for the ability to be performed. I then added a function within BP_Ability called "Find Connected Targets", which outputs a set of indexes based off what direction the attack is used in. On a single target ability, this would simply return a set with nothing in it. With the line ability, it would return all indexes in a separate "line range" variable for that direction. It is loosely based off of the "FindSurroundingPossibleTargets" function in the grenade ability, but without the collision capsules.

                        When the AI tries to use this ability, it sometimes fails to find any targets or it uses the ability in a completely different direction. I believe the issue is with the "Find Potential Targets" function in BP_Ability. I've tried overriding it based on how the grenade ability has it, among other setups, but nothing worked. This is probably due to the strange line range and how I have the range variable set to 1 to choose a direction. However, when I originally tried to use the included range variable, I had trouble getting the line to work.

                        My question is, is there a way to alter "Find Potential Targets" so that it could work with the "Find Connected Targets" function that I created, or is there a better way entirely to implement these kinds of unique ranges? (more than likely the case as I am not a very experienced coder)
                        Hi, so this is a pretty challenging problem. I think your reasoning is good here and there are likely many different decent solutions to the problem. If you want to keep this all in blueprints you have to be pretty mindful of performance for these sorts of things. Here are the steps I would try first if I wanted to achieve this:
                        1. I'd start by filtering out units I know I will not be able to hit. This is what I use Find Potential Targets. I'd keep this as an initial filter as it is really cheap. You can always loop over the output of this function to further filter the targets.
                        2. Next I'll want to figure out if any of the targets have a straight line between them. I'd loop through the targets and compare their GridIndexes. If The X or Y part of the index number is identical this means there is a straight line between them (check out my video on Grid Indexing if this seems unclear).
                        3. Next I would check if the player could actually get to any of the indexes that would enable them to target multiple targets on a line in this way. I'd check grid indexes on a line in the opposite direction of the other targets and look for them in StoredPaths.
                        4. For targets where I found a valid index to attack from I'd check if there are even more targets between the two targets. I'd either loop over the grid indexes between them and check for units or use the collision capsule + line trace method, depending on which turns out to be more efficient.
                        5. I'd rate the possible targets and tiles based on the number of targets hit and/or remaining health of these targets.
                        That was my first idea of how to do this. Many of these steps are not trivial and will require much deliberations and testing, I suspect. But those are my initial thoughts.
                        Advanced Turn Based Tile Toolkit (Marketplace - Support)

                        Dungeon Crawler Toolkit (Marketplace - Support)

                        Discord

                        Comment


                          Good day hou to find: Can split up move. ? for moving not all mov point. from video https://www.youtube.com/watch?v=xqVTbk-FEBU&t=48s
                          Last edited by ser.man94; 01-09-2021, 12:44 PM.

                          Comment


                            Originally posted by Monokkel View Post

                            Hi, so this is a pretty challenging problem. I think your reasoning is good here and there are likely many different decent solutions to the problem. If you want to keep this all in blueprints you have to be pretty mindful of performance for these sorts of things. Here are the steps I would try first if I wanted to achieve this:
                            1. I'd start by filtering out units I know I will not be able to hit. This is what I use Find Potential Targets. I'd keep this as an initial filter as it is really cheap. You can always loop over the output of this function to further filter the targets.
                            2. Next I'll want to figure out if any of the targets have a straight line between them. I'd loop through the targets and compare their GridIndexes. If The X or Y part of the index number is identical this means there is a straight line between them (check out my video on Grid Indexing if this seems unclear).
                            3. Next I would check if the player could actually get to any of the indexes that would enable them to target multiple targets on a line in this way. I'd check grid indexes on a line in the opposite direction of the other targets and look for them in StoredPaths.
                            4. For targets where I found a valid index to attack from I'd check if there are even more targets between the two targets. I'd either loop over the grid indexes between them and check for units or use the collision capsule + line trace method, depending on which turns out to be more efficient.
                            5. I'd rate the possible targets and tiles based on the number of targets hit and/or remaining health of these targets.
                            That was my first idea of how to do this. Many of these steps are not trivial and will require much deliberations and testing, I suspect. But those are my initial thoughts.
                            Thank you very much for your suggestions. I tried implementing what you wrote with no luck, as I couldn't quite wrap my head around the logic and where to fit everything into the existing code.

                            I noticed that the grenade ability has "UsePregeneratedSafetyValues", "UsePregeneratedPaths", "UseTileValues", and "UseSlowLoops" ticked by default. I was wondering if those would be of any use to me on an AOE ability, but I couldn't figure out what the difference in using them is. Would you be able to shed some light on their use?

                            Comment


                              Originally posted by ser.man94 View Post
                              Good day hou to find: Can split up move. ? for moving not all mov point. from video https://www.youtube.com/watch?v=xqVTbk-FEBU&t=48s
                              Hi, you can achieve the same result by changing the MoveCostType variable (name might be slighly different. cannot check right now) in the move ability you are using to "FromPathfindingCost". This makes it so the AP cost of moving is based on the move cost calculated during pathfinding. Next set the Move variable of your units to 1 and increase their AP to compensate.

                              Originally posted by Munchydo1 View Post

                              Thank you very much for your suggestions. I tried implementing what you wrote with no luck, as I couldn't quite wrap my head around the logic and where to fit everything into the existing code.

                              I noticed that the grenade ability has "UsePregeneratedSafetyValues", "UsePregeneratedPaths", "UseTileValues", and "UseSlowLoops" ticked by default. I was wondering if those would be of any use to me on an AOE ability, but I couldn't figure out what the difference in using them is. Would you be able to shed some light on their use?
                              My suggestions were just my immediate thoughts on how I would first try to approach the problem. I might try my hand at it some day, but this is a difficult problem and it is hard to find much time these days.

                              So UsePregeneratedSafetyValues means that the ability will utilize tile safety values that have been added by previous abilities of that unit this turn. This is to avoid repeating the same expensive check for each ability that uses them if the abilities are generating them the same way anyway and the unit has multiple abilities. It is just there for performance. UseTileValues means that it does generate these tile safety values (which makes tiles in cover and tiles not close to multiple enemies have a higher priority). UseSlowLoops means that the value calculations are done over multiple ticks to avoid dropping frames if the ability is one that requires complex calculations (which is the case for the Grenade ability). I imagine your beam ability might also fall into this category.
                              Advanced Turn Based Tile Toolkit (Marketplace - Support)

                              Dungeon Crawler Toolkit (Marketplace - Support)

                              Discord

                              Comment


                                Hello,

                                i have a problem with spawning units in a running game. I let spawn units by the task " spawn actor from class" in the level blueprint by pressing the key x, as test. everything works fine but, i can click on the fresh spawning unit, which is AI controlled and in the enemy team, and the unit make his move. But its not the enemys turn. Also by clicking the spawned unit i dont get the hatched fields to indicate the range of motion. So my question, is there a right way to spawn the units in the middle of a running level, without these problems? In 2019 it worked out for me.
                                Hope you can help me and best wishes

                                Comment

                                Working...
                                X