Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Originally posted by RTE1984 View Post

    Hi Monokkel,

    I didn't know it had tile sharing. I tried testing it but I am not sure how to get it to work. For testing purposes I placed 2 units, one as player 0 and the other as player 1 but it says waiting for other player to arrive. Is there no local option?

    I also tried setting both as player 0's units (which my game will not be doing) and they can only start on a shared space but won't share a space afterwards. Same if I set one of the units as an enemy/other faction. Is there an option somewhere to allow space sharing between players to turn on?
    The shared files might not be the best example anyways. Lets start with the basics and take this one step at a time, then we can figure out what works along the way. So first let me give you a basic setup to allow units to end their turn on the same space as other units.

    Modify SearchAndAddAdjacentTilesCustom1 in BP_GridManager so that tiles are added to the open list even if there is a unit on them:



    Then make a duplicate of BP_Ability_Move. In PlayerActivate you can skip the branch that does not display move tiles if there are units on them:



    Next in CheckIfValidTarget you return valid even if there is a unit on the tile:



    Now place a couple of units. Set their default ability to your new move ability and their PathfindingType to Custom1. And voila:



    There are obviously a lot of limitation here, but this is a good starting point for a discussion for what you need and what you don't need for your game. What here is missing that you need in your game?

    Originally posted by Skulldug View Post
    Thanks for the reply.. I am having a problem uploading pics here.. I will try to explain better. (using hex tiles) Drag a sub grid into level, set size to 9 x 9.
    In the very center, I would like to remove the tile including index, mesh etc.. so there is a hole. Is that possible without messing the whole grid system ?
    Or is there a way to make the sub grid place tiles on a static mesh like the "old" height map example from long long ago ?
    Hope this helps.. if not I could pm you some images.
    Thanks.
    Ok, so like a donut? Is it important that this is done using a subgrid? Can it be done at runtime? If so, FindTilesInRange with a minimum range of 1 can be used. What is the gameplay purpose of these subgrids?

    Originally posted by Joker of Souls View Post

    Thanks for the help and sorry for the late reply took a break from unreal to work in blender. In the end I went with a Simpler approach. I removed collision from the doors so the player can see what tiles they can move to without opening the door. What I'm thinking of doing now is setting up a animation trigger when a unit gets close to a door they will kick it open or something so they don't just clip though it.
    Ok, sounds like a reasonable solution. For splitting up movement into multiple animations, such as stopping to open a door etc, I recommend looking at the SplitMove example map in Maps/Experimental.
    Advanced Turn Based Tile Toolkit (Marketplace - Support)

    Dungeon Crawler Toolkit (Marketplace - Support)

    Discord

    Comment


      [QUOTE=Monokkel;n1783185]
      Ok, so like a donut? Is it important that this is done using a subgrid? Can it be done at runtime? If so, FindTilesInRange with a minimum range of 1 can be used. What is the gameplay purpose of these subgrids?

      Yes like a donut and and being done at runtime would be perfect. Thank for the help and do not spend to much time on this, its not that important. I have to go out of town tomorrow and will
      reconnect with you when I return in a week or two
      Thanks again Knut.



      Comment


        Originally posted by Monokkel View Post

        The best place to change the appearance of the move/range tiles is in the specific abilities you are using. Just set the Static Mesh directly in the Details of the TileMarkers component.

        The appearance of the spline is still defined in the Grid Manager, though. You can change its value in the SplinePathMesh public variable of BP_GridManager.
        1. Yes thanks. I searched hours because it was working in a blank project until I found out, that this will not work when you have "use Decals" on true. Where can I change it when I want to have it active?

        2. So for the spline works too but where can I chance the color/material? As everything still shines bright white after changing the static mesh.

        3. Where for "AbilitityMoveAttack" is for the AI defined, that after movement, with having no AP left, it still has the free attack/Action? I found for the player and changed it, but can´t find it for the AI.

        4. I am trying to access the float for damage within "BP Unit" and parse it to "Animate Death" like its done the same way for "animate Hurt" already. But when I conect the pin, it will givge me the errormassage once it tries to access it during gameplay. I have added a screenshot.

        Thank you Mono
        Attached Files
        Last edited by Infest1908; 07-02-2020, 06:25 PM.

        Comment


          Originally posted by Monokkel View Post

          The shared files might not be the best example anyways. Lets start with the basics and take this one step at a time, then we can figure out what works along the way. So first let me give you a basic setup to allow units to end their turn on the same space as other units.

          Modify SearchAndAddAdjacentTilesCustom1 in BP_GridManager so that tiles are added to the open list even if there is a unit on them:



          Then make a duplicate of BP_Ability_Move. In PlayerActivate you can skip the branch that does not display move tiles if there are units on them:



          Next in CheckIfValidTarget you return valid even if there is a unit on the tile:



          Now place a couple of units. Set their default ability to your new move ability and their PathfindingType to Custom1. And voila:



          There are obviously a lot of limitation here, but this is a good starting point for a discussion for what you need and what you don't need for your game. What here is missing that you need in your game?


          Hi Monokkel,

          This is super detailed and helpful, I implemented it with no issue. I appreciate it!

          Curious though, my blue move markers are gone now. Where did you have me turn those off in this breakdown?

          As far as this issue goes we now just need a way to differentiate visually that multiple players are on the same space, we were thinking of maybe adjusting where they're at on the space, so not every player will be centered on it.

          Comment


            Hello. Thank you so much for making this tool. I just bought it yesterday and it's looking very informative and useful for what I'm doing! I'm still relatively inexperienced at coding and Unreal Engine, but I have a question.

            I added attack and defense stats that determine how much damage an attack should do to a target. The attack is added to a unit's equipped weapon and put into the damage variable that was already a part of BP_Unit. In the Take Damage function I have the target's defense subtracted from the damage to determine how much health should be lost. It seems like its calculating the damage correctly, but the health bar is not displaying properly. It is removing a percentage based on the damage calculation without factoring in defense, yet the unit's current health stat after being attacked is correct. This leads to situations where the unit disappears from the grid as if they died once their health bar reaches 0, but they can still be moved around and have health left (although they cannot attack or be attacked).

            Basically I would like to know how to correctly update the health bar and what I would have to change with my current system to do that. Sorry if this is a silly question, I just can't figure out what is going wrong.

            Comment


              Originally posted by Munchydo1 View Post
              Hello. Thank you so much for making this tool. I just bought it yesterday and it's looking very informative and useful for what I'm doing! I'm still relatively inexperienced at coding and Unreal Engine, but I have a question.

              I added attack and defense stats that determine how much damage an attack should do to a target. The attack is added to a unit's equipped weapon and put into the damage variable that was already a part of BP_Unit. In the Take Damage function I have the target's defense subtracted from the damage to determine how much health should be lost. It seems like its calculating the damage correctly, but the health bar is not displaying properly. It is removing a percentage based on the damage calculation without factoring in defense, yet the unit's current health stat after being attacked is correct. This leads to situations where the unit disappears from the grid as if they died once their health bar reaches 0, but they can still be moved around and have health left (although they cannot attack or be attacked).

              Basically I would like to know how to correctly update the health bar and what I would have to change with my current system to do that. Sorry if this is a silly question, I just can't figure out what is going wrong.
              Hi Munch,

              maybe I can help you out. In my case it has worked to to modify the damage within the ability function "Execute Ability" that is used. I have just createt functions within the ability (lets say "move attack") I have attached a sreenschot for example critical calculation. That works fine on my side. What you will maybe have to take care about, is that in the first "self created" function the damage of the specific unit is set again to normal, by getting the damage value of the current unit. You could do this even in the same ability though, but at least in my case it is not needed.
              Attached Files
              Last edited by Infest1908; 07-03-2020, 03:12 AM.

              Comment


                Originally posted by Infest1908 View Post

                Hi Munch,

                maybe I can help you out. In my case it has worked to to modify the damage within the ability function "Execute Ability" that is used. I have just createt functions within the ability (lets say "move attack") I have attached a sreenschot for example critical calculation. That works fine on my side. What you will maybe have to take care about, is that in the first "self created" function the damage of the specific unit is set again to normal, by getting the damage value of the current unit. You could do this even in the same ability though, but at least in my case it is not needed.
                This definitely pointed me in the right direction. The health is now being correctly displayed when factoring in defense. Your example was also very helpful since it gave me some direction as to where to implement things like hit chance, critical, and multiple attacks.

                Thank you so much for your help!

                Comment


                  Sorry about the late answer, people. Yesterday got really busy. I'll get to your questions now

                  [QUOTE=Skulldug;n1783222]
                  Originally posted by Monokkel View Post
                  Ok, so like a donut? Is it important that this is done using a subgrid? Can it be done at runtime? If so, FindTilesInRange with a minimum range of 1 can be used. What is the gameplay purpose of these subgrids?

                  Yes like a donut and and being done at runtime would be perfect. Thank for the help and do not spend to much time on this, its not that important. I have to go out of town tomorrow and will
                  reconnect with you when I return in a week or two
                  Thanks again Knut.
                  Ok, here is a hardcoded example to give you a starting point. This creates tiles and add them to the grid in a hexagonal donut at a specified grid index:





                  Note that DefaultTile does not have collision, so you would want to add your own mesh instance with collision that blocks PathTrace

                  Originally posted by Infest1908 View Post
                  1. Yes thanks. I searched hours because it was working in a blank project until I found out, that this will not work when you have "use Decals" on true. Where can I change it when I want to have it active?
                  Ah, sorry. I assumed you were using meshes. For decals, change the value of TileMarkersDecal (and for BP_Ability_MoveAttack also TileMarkerMoveDecal). Both are variables in BP_Ability and its children.

                  Originally posted by Infest1908 View Post
                  2. So for the spline works too but where can I chance the color/material? As everything still shines bright white after changing the static mesh.
                  Yeah, this is my mistake. Seems like the material is being unnecessarily overridden due to an old setup that is no longer needed. Go to the DisplaySplineWithSplineMeshes function in BP_GridManager and remove the SetMaterial node.

                  Originally posted by Infest1908 View Post
                  3. Where for "AbilitityMoveAttack" is for the AI defined, that after movement, with having no AP left, it still has the free attack/Action? I found for the player and changed it, but can´t find it for the AI.
                  AI is a bit more complicated. Generally AI abilities try to find all reachable tiles, with a move range defined by the PossibleMove variable in the ability. If the unit has only enough AP left when assessing an ability to use the ability, but nothing more, PossibleMove is set to 0 (in UpdateAttributes) and the unit will only use the skill if it can do so from its current position.

                  Originally posted by Infest1908 View Post
                  4. I am trying to access the float for damage within "BP Unit" and parse it to "Animate Death" like its done the same way for "animate Hurt" already. But when I conect the pin, it will givge me the errormassage once it tries to access it during gameplay. I have added a screenshot.

                  Thank you Mono
                  That error indicates that there is no value stored in the float array of the action. You need to pass the damage into the QueueAction(death) macro where it is called.

                  Originally posted by RTE1984 View Post
                  Hi Monokkel,

                  This is super detailed and helpful, I implemented it with no issue. I appreciate it!

                  Curious though, my blue move markers are gone now. Where did you have me turn those off in this breakdown?
                  Maybe you forgot to connect the ForLoop to the Add node in BP_Ability_Move when you deleted the branch? Check your code and make sure it looks like my screenshots.

                  Originally posted by RTE1984 View Post
                  As far as this issue goes we now just need a way to differentiate visually that multiple players are on the same space, we were thinking of maybe adjusting where they're at on the space, so not every player will be centered on it.
                  Many different ways to do this. Not sure which is best. Perhaps create a grid TMap that holds the number of units on each tile and when a unit wants to enter a tile, check the number, reference it against an array of predefined relative locations and make this the end point of the path? Something like that.

                  Originally posted by Munchydo1 View Post
                  Hello. Thank you so much for making this tool. I just bought it yesterday and it's looking very informative and useful for what I'm doing! I'm still relatively inexperienced at coding and Unreal Engine, but I have a question.

                  I added attack and defense stats that determine how much damage an attack should do to a target. The attack is added to a unit's equipped weapon and put into the damage variable that was already a part of BP_Unit. In the Take Damage function I have the target's defense subtracted from the damage to determine how much health should be lost. It seems like its calculating the damage correctly, but the health bar is not displaying properly. It is removing a percentage based on the damage calculation without factoring in defense, yet the unit's current health stat after being attacked is correct. This leads to situations where the unit disappears from the grid as if they died once their health bar reaches 0, but they can still be moved around and have health left (although they cannot attack or be attacked).

                  Basically I would like to know how to correctly update the health bar and what I would have to change with my current system to do that. Sorry if this is a silly question, I just can't figure out what is going wrong.
                  Hi Munchydo, that is a very common mistake people make with the toolkit, and understandably so, since the game logic/action system distinction takes some getting used to (check out my tutorials on the action system if you have not done so already). I'm making some changes in the next update that will make it more difficult to make these sorts of mistake.

                  The problem is that you are damaging and killing the unit in the game logic, but you are not sending this information to the action system, which asynchronously displays this to the player. So in other words you need to make sure that any time you deal damage you also queue and action to display that damage being dealt. Infest has been kind to show one way of doing this. If you are using the TakeDamage directly you can also set the AutoAnimate boolean to true, which will automatically queue the appropriate hurt animation and health bar change dependent on the input damage.
                  Advanced Turn Based Tile Toolkit (Marketplace - Support)

                  Dungeon Crawler Toolkit (Marketplace - Support)

                  Discord

                  Comment


                    Hello Knut, i have a question about ai. I am using the hybrid mode. During the the third person mode I have an ai controller controlling ai. The problem is when combat starts my ai still follows me. I have added my ai character as a child to another grid unit so other characters movement and attack tiles reflect where my ai character starts at begin play (meaning they block movement and can be attacked) but as my ai character is moving around following me as their "grid anchor" for the ai stays in the same place and does not move or attack. I can click on where the grid unit is to see attack range but that's it. I'm thinking I have to set my ai controller to maybe the default controller at the start and end of combat. Any thoughts or ideas?
                    Last edited by Methosborgoff; 07-05-2020, 10:54 PM.

                    Comment


                      Hello Knut.. thanks for the help, just what I needed.. Just built a ryzen 3950 computer and workin out the bugs now I am ready for Raytracing !!
                      Thanks again you Turn Based GOD !!

                      Comment


                        Originally posted by Methosborgoff View Post
                        Hello Knut, i have a question about ai. I am using the hybrid mode. During the the third person mode I have an ai controller controlling ai. The problem is when combat starts my ai still follows me. I have added my ai character as a child to another grid unit so other characters movement and attack tiles reflect where my ai character starts at begin play (meaning they block movement and can be attacked) but as my ai character is moving around following me as their "grid anchor" for the ai stays in the same place and does not move or attack. I can click on where the grid unit is to see attack range but that's it. I'm thinking I have to set my ai controller to maybe the default controller at the start and end of combat. Any thoughts or ideas?
                        Hi, it depends a bit on how you have set up your code for following, but in principle it should not be more difficult than adding a branch to check a bIsTurnBased boolean or similar (on the unit or elsewhere) and not call your follow code if it is true. Could you show me how you have set up your real time movement code?

                        Originally posted by Skulldug View Post
                        Hello Knut.. thanks for the help, just what I needed.. Just built a ryzen 3950 computer and workin out the bugs now I am ready for Raytracing !!
                        Thanks again you Turn Based GOD !!
                        Great stuff! Always a great feeling when you have just completed a new rig.

                        In other news, the Dungeon Crawler Toolkit is now live on the marketplace! Check it out on the marketplace, and below is the feature trailer:

                        Advanced Turn Based Tile Toolkit (Marketplace - Support)

                        Dungeon Crawler Toolkit (Marketplace - Support)

                        Discord

                        Comment


                          What I am trying to make is this

                          Click image for larger version

Name:	Screenshot_1.png
Views:	87
Size:	38.8 KB
ID:	1786136

                          The grid manager right now of course makes a square grid, I want to figure out how to make it a hex. I am thinking it can be done by changing the edge that the grid grows from on the starting hex.
                          Hell, even if I was to be able to simply set a premade hex grid in as the base static mesh of the BP_GridManager_Hex and it have all the other properties that is given in that BP it would suit my needs. I tried replacing the Static mesh in the BP view port but it still populated the original single hex mesh.

                          Thanks for all the help.
                          Attached Files

                          Comment


                            Originally posted by Arragoth View Post
                            What I am trying to make is this

                            Click image for larger version

Name:	Screenshot_1.png
Views:	87
Size:	38.8 KB
ID:	1786136

                            The grid manager right now of course makes a square grid, I want to figure out how to make it a hex. I am thinking it can be done by changing the edge that the grid grows from on the starting hex.
                            Hell, even if I was to be able to simply set a premade hex grid in as the base static mesh of the BP_GridManager_Hex and it have all the other properties that is given in that BP it would suit my needs. I tried replacing the Static mesh in the BP view port but it still populated the original single hex mesh.

                            Thanks for all the help.
                            Hi Arragoth, so for this you can use GetIndexesInRange and spawn the tiles accordingly. In BP_GridManager_Hex you can override the SpawnTileGrid function like so:



                            This gives you the visual result you are after:



                            However, we are not done, as the gameplay grids need to know that these tiles have to be added to the appropriate arrays at startup.

                            So we can similarly modify CreateGridLocations:



                            In the above screenshot I'm modifying the part of the function if heightmap is set to false. If you have a different heightmap setup modify the other parts of this function as appropriate.

                            We're almost done, but there is one thing missing. To improve performance on very large grids, individual tile mesh instances do not have collision enabled, so they will not block the grid generation traces on startup or the trace under the cursor for interacting with the grid.

                            Normally this is solved by having a collision plane component that resizes to appropriately cover the grid. We could code something similar with an automatically resizing flat hexagonal mesh, and I might do so in a future update, but for now let us just do it manually, since I'm assuming you know the size of your map beforehand (let me know if this is not the case)

                            So here I simply place a SM_Hex static mesh on top of our grid manager, resize it as appropriate, set its collision to block PathTrace, and set bHiddenInGame to true:



                            And we're golden:



                            Note that there might be issues with this setup that I'm not seeing as I have not tested every feature of the toolkit against this setup. Let me know if you run into any problems. For now it is probably at least smart to set GridSizeY to the same size as GridSizeX to avoid some potential conflicts.

                            Advanced Turn Based Tile Toolkit (Marketplace - Support)

                            Dungeon Crawler Toolkit (Marketplace - Support)

                            Discord

                            Comment


                              I have followed everything you've given me in Discord and here for creating the Hex shape but I am not getting the result you are. Here is what I have done in case you can spot a mistake I have overlooked.



                              Attached Files

                              Comment


                                Originally posted by Arragoth View Post
                                I have followed everything you've given me in Discord and here for creating the Hex shape but I am not getting the result you are. Here is what I have done in case you can spot a mistake I have overlooked.
                                So the issue here is the ConvertGridIndexToGridLocationNaive here, which you told me you could not find in your project, so you made your own (above). I sent you the wrong function there, as you need to use the one overridden in BP_GridManager_Hex, which looks like so:



                                but you should have access to this function already, which is very odd. It is one of the newer functions, so are you certain you are using the latest version of ATBTT (created for UE4.25)?
                                Advanced Turn Based Tile Toolkit (Marketplace - Support)

                                Dungeon Crawler Toolkit (Marketplace - Support)

                                Discord

                                Comment

                                Working...
                                X