Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    I'm trying to create a unit that can attack 1 tile diagonally, and 2 tiles away, but not one tile away. Any tips/advice?

    Comment


      Originally posted by homsar View Post
      I'm trying to create a unit that can attack 1 tile diagonally, and 2 tiles away, but not one tile away. Any tips/advice?
      Set square visibility of the unit to false, range to 2 and minimum range to 2 and you should achieve the desired effect.
      Advanced Turn Based Tile Toolkit (Marketplace - Support)

      Dungeon Crawler Toolkit (Marketplace - Support)

      Discord

      Comment


        Hi, Monokkel

        We are back to focusing on the turn based game project since we already have a working demo to bring to publishers. I am looking at your Trello now. It looks like multi-tile units won't be included in update 1.8, correct? And 1.8 is coming out with 4.19?

        It says big units on square grids for 1.8 does that mean big units in the 1.9 section are for hex grids?
        Last edited by Mewbits; 02-15-2018, 12:31 PM.

        Comment


          Originally posted by Mewbits View Post
          Hi, Monokkel

          We are back to focusing on the turn based game project since we already have a working demo to bring to publishers. I am looking at your Trello now. It looks like multi-tile units won't be included in update 1.8, correct? And 1.8 is coming out with 4.19?

          It says big units on square grids for 1.8 does that mean big units in the 1.9 section are for hex grids?
          Hey Mewbits, glad to have you back Big units were originally not planned for 1.8, but while I'm waiting for UE4.19 I've been working on it, so it will be included in some form. I might mark it as experimental dependent on how much I get done. I'm focusing on getting it to work with square grids first, but the solution I've found is quite generic and should be relatively easy to convert to hex grids. Not sure if I'll have big units on hex grids ready for UE4.19, but if so I'd make a tinyupdate later to add hex grid support.
          Advanced Turn Based Tile Toolkit (Marketplace - Support)

          Dungeon Crawler Toolkit (Marketplace - Support)

          Discord

          Comment


            Originally posted by Monokkel View Post

            Hey Mewbits, glad to have you back Big units were originally not planned for 1.8, but while I'm waiting for UE4.19 I've been working on it, so it will be included in some form. I might mark it as experimental dependent on how much I get done. I'm focusing on getting it to work with square grids first, but the solution I've found is quite generic and should be relatively easy to convert to hex grids. Not sure if I'll have big units on hex grids ready for UE4.19, but if so I'd make a tinyupdate later to add hex grid support.
            Looking forward to it.

            Comment


              As to the square grid - is there a quick way to make attack range not diamond-shaped, but cross-shaped (exclude diagonal tiles completely)? I think I found a needed function in grid manager (get indexes in range I think) but unfortunately I'm having a hard time following calculations.
              Last edited by ClaimedInfinity; 02-18-2018, 01:14 PM.

              Comment


                Originally posted by ClaimedInfinity View Post
                As to the square grid - is there a quick way to make attack range not diamond-shaped, but cross-shaped (exclude diagonal tiles completely)? I think I found a needed function in grid manager (get indexes in range I think) but unfortunately I'm having a hard time following calculations.
                You could code a new pattern similarly to how I've done it in the Get Indexes In Range function, but you can also do something quicker and lazier. Take the output of GetIndexesInRange and loop through it. Compare the index of each arrray element with the origin index of the GetIndexes function. If either (IndexX % GridSizeX) == (IndexY % GridSizeX) or (IndexX / GridSizeX) == (IndexY / GridSizeX) keep it. This should give you a cross-shaped pattern.
                Advanced Turn Based Tile Toolkit (Marketplace - Support)

                Dungeon Crawler Toolkit (Marketplace - Support)

                Discord

                Comment


                  Originally posted by Monokkel View Post

                  You could code a new pattern similarly to how I've done it in the Get Indexes In Range function, but you can also do something quicker and lazier. Take the output of GetIndexesInRange and loop through it. Compare the index of each arrray element with the origin index of the GetIndexes function. If either (IndexX % GridSizeX) == (IndexY % GridSizeX) or (IndexX / GridSizeX) == (IndexY / GridSizeX) keep it. This should give you a cross-shaped pattern.
                  It's working, thanks! Although seems a little tricky solution in my case as I may need more complex custom attack patterns in the future. So I have to learn how it is calculated myself.

                  Comment


                    ClaimedInfinity : Finding algorithms for patterns on the grid requires some thought, but it is not terribly difficult, especially for square grids. Try drawing it out on graph paper or in excel first. Remember that for square grids, adjacent tiles are index +/- 1 for right and left tiles and -/+ GridSizeX for tiles above and below. Because of this, Index % GridSizeX gives you the column and Index / GridSizeX gives you the row of an index. Keep this in mind, and remember to add checks to prevent the pattern from going outside the grid, and you will be able to create many different patterns with just a moderate amount of work.
                    Advanced Turn Based Tile Toolkit (Marketplace - Support)

                    Dungeon Crawler Toolkit (Marketplace - Support)

                    Discord

                    Comment


                      Hey Monokkel,

                      I've been trying to experiment with changing edge costs at runtime. Basically what I'd like to accomplish is have the player stuck in a room and unable to leave until they click on a door. Once the door is clicked it calls "Get Hit Tile Location and Index" goes to "Set Edge Costs" then its my understanding we would need to rerun the "Pathfinding" event, all referencing the grid manager. I've only dabbled in unreal on and off for some time and I just purchased the toolkit a week or so ago. Its very possible I'm misunderstanding how these functions interact with each other. Any input you might be able to offer would be greatly appreciated.

                      Comment


                        Originally posted by Gameran13 View Post
                        Hey Monokkel,

                        I've been trying to experiment with changing edge costs at runtime. Basically what I'd like to accomplish is have the player stuck in a room and unable to leave until they click on a door. Once the door is clicked it calls "Get Hit Tile Location and Index" goes to "Set Edge Costs" then its my understanding we would need to rerun the "Pathfinding" event, all referencing the grid manager. I've only dabbled in unreal on and off for some time and I just purchased the toolkit a week or so ago. Its very possible I'm misunderstanding how these functions interact with each other. Any input you might be able to offer would be greatly appreciated.
                        Hi Gameran, you're thinking along the right lines. I've thrown together a quick and dirty solution which should be enough to get you started. I first duplicated TileCloseThinWall_E, called it Tile_Door_East and colored it green + scaled it a bit (for visuals). I then changed the collision settings of its mesh to block everything but PathTrace (so it registers click events, but ignores the trace in the Player controller that uses PathTrace).

                        Then I added the following to the door's event graph:


                        Here I'm using UE4's built-in OnClicked event to register the player clicking on the door.

                        I then use the AddEdgeBothWays function in BP_GridManager to connect the tiles on either side of the door. Since this door is a copy of the east wall actor, which during setup removes its eastern edge I want to re-add this edge. In the toolkit east is +1, west -1, north - GridSizeX and south + GridSizeX. You would likely want to set up a less hard-coded implementation in your game, but this works fine for a demonstration.

                        Then I move the mesh out of the way with a timeline. This does not pathfinding, but is just for looks. You would want a more proper animation, of course.

                        Lastly I reactivate the current unit. Since the current unit was originally activated before we altered the edge array, the pathfinding it ran was using the old edges. We want it to take the altered edges (and change in visibility now that the wall has moved, for that matter) into account.

                        Hope this helps you implement doors how you intended. Like I said, this was a very quick and dirty solution, but if you understand the steps you should be able to build on it and make something better. The first step would probably be to move this to being part of the click event in the player controller, so you can have more control over when it activates. Best of luck, and let me know if you need any more help.

                        Click image for larger version

Name:	Door.gif
Views:	35
Size:	497.3 KB
ID:	1432239
                        Last edited by Monokkel; 02-21-2018, 06:54 AM.
                        Advanced Turn Based Tile Toolkit (Marketplace - Support)

                        Dungeon Crawler Toolkit (Marketplace - Support)

                        Discord

                        Comment


                          First, the toolkit is awesome and exactly what my team was looking for. As a novice to UE4 it gives my team a jump on transferring a real life TB game model into a mobile version as well for cross promotion. With that said, is there any possibility of tutorial on player HUD design in the future? When we run the HUD, it compiles correctly but does not show on the progress bars. We are assuming it is due to the casting to pawns, and not actually finding the pawns through the grid system. We noticed you used billboards instead of traditional HUDs, which may be the reason why this was done. Any insight would be appreciated as we continue our game progress. Thanks again for this system and the many tutorials you have provided.

                          Comment


                            jeff_northrop : Happy to hear the toolkit has been helpful to your team! UI and HUD is not on the top of my list of planned tutorials, but I'll be happy to help you with your specific problem. I'm not sure if I completely understand your question, though. Do you mean the health bars when you say progress bars? They do appear in the default toolkit, so what have you changed so that they disappear? I use a billboard so I do not have to update the health bar facing every tick, but instead exploit the fact that billboards always face the camera. If it helps you can take a look at the VR example map, where I use meshes instead of billboards, since billboards to not work properly in VR.
                            Advanced Turn Based Tile Toolkit (Marketplace - Support)

                            Dungeon Crawler Toolkit (Marketplace - Support)

                            Discord

                            Comment


                              Hi Monokkel, thank you for the super awesome toolkit! I have one question, if I want to make a basement level in another map, how do I preserve the pawns on previous maps? For now I only store and load data for each map. But if possible I want to make it seamless with level stream for UI and pawns consistency. Sort of like Divinity: Original Sins.

                              Comment


                                drpsyko : Depends a bit on exactly what you want to achieve. There ar quick and hacky ways to achieve some of this stuff, but depending on what you want you may need to make larger changes. I plan to add the option to have multiple grid managers in the future, but until then there are some other things you can do.

                                So if I understand your question correctly, you're not asking how to preserve say the heatlh and other attributes of units across maps, but rather having something like a basement in a level where combat can go on simultaneously while it is also happening on the floor above, with unit turns hopping back and forth between the levels as they are activated. Is this a correct interpretation?

                                If so, here is a quick hack you can try. Set Heightmap to multilevel in the Grid Manager. Set Max Grid Height to something really high (say 10000). Then create your various levels on top of one another, making sure that the distance between them is higher than the maximum zoom distance set up in your grid camera.

                                Already all of these layers should function as separate grids, though you can always add edges to allow movement between them. Now what you need to do is make sure layers below cannot be seen when on levels above. You can do this simply by having a landscape/plane mesh between them or you can use cull distance volumes, object hierarchies with visibility set through blueprints or whatever.

                                Last thing you need to do is prevent the camera from moving smoothly when switching between units on different layers and instead jump instantly. Look in the event graph of grid camera in the comment box "Follow the current active unit unless the player is currently panning the camera". Here you can see I use lerps for smooth movements. Promote the lerp alpha to a variable and set it to 1 whenever you switch between units on different levels (you can do this by comparing the height of the previous and the next unit in the ChooseNextPawn event in ATBTT_GameMode).



                                Seems to work pretty well for Divinity-style instant switching between multiple grids. A bit hacky, sure, but looks good in game.
                                Advanced Turn Based Tile Toolkit (Marketplace - Support)

                                Dungeon Crawler Toolkit (Marketplace - Support)

                                Discord

                                Comment

                                Working...
                                X