Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Originally posted by Studder View Post

    Something like this?

    My Player activate :
    https://blueprintue.com/blueprint/aqm4av2q/

    My Show Build Markers function:
    https://blueprintue.com/blueprint/sh827i08/

    Click function
    https://blueprintue.com/blueprint/dqj3ul8z/


    When I click on a "Build Marker Tile" my print function in click never gets called. Do you see what I did wrong?
    https://youtu.be/HXTPdxI33cE
    Ok so far so good.

    I can now have 2 actions per turn for a player. One is moving and one is "Building" although the build action is nothing more then placing a static mesh on the clicked index.

    I am having a hard time wrapping my head around the build action |-_-|.

    "Subtract the Z location of each tile to the Z location of the center tile and get the absolute value. If it is below an arbitrary threshold you want to add edges between the tiles (if there is not an edge there already). If it is above you want to remove the edges (if they exist).

    To add and remove edges is simple. Use the RemoveTileEdgeBothWays and AddTileEdgeBothWays functions in BP_GridManager. There are already checks in place to make sure a tile is not added twice. For these functions input the grid index of the center tile and its neighbor. The order does not matter. You want to use the "both ways" function, as if you only add or remove one way you will still be able to move one of the directions."

    Can you maybe elaborate this some more how I would stack the meshes and add a tile?

    https://youtu.be/nXZoSy3G4zk



    https://blueprintue.com/blueprint/uxglo48r/


    edit: Ok stacking of blocks works now. I forgot to name the Socketname to get the Z value of the mesh . Need to figure out now how to get up on the block.
    Last edited by Studder; 08-30-2018, 04:40 AM.

    Comment


      Ok I think I am almost there :

      https://youtu.be/IXSyIX4YrU0


      https://blueprintue.com/blueprint/581iqvww/

      Comment


        Originally posted by Studder View Post
        Hey, sorry it took a while to reply. Been busy. Good to see that you're almost there. There are just a couple of small changes you need to do to get it working, as well as some less important suggestions.

        Lets start at the left side of your graph. This is minor, but I think it would be cleaner to include the static mesh in your custom GridActor itself so you don't have to add a component manually every time. Also, since you are not using the Box variable any place later (unless you have more stuff that I'm not seeing) you do not need to set that variable. Buy yeah, minor stuff.

        The first real issue is for your MapAdd node. It works great the first time you add a tile (provided the grid manager is at Z location 0), as you set the grid location to 0 + the top of the box. However when you then add a new box on top of that one the new location stored at Z in the map will also be 0 + the top of the box, which I assume is not what you want. You want it to increment by the box height every time you add a new one. Therefore you need to add the Z location that is already there (which you have in your BreakVector node) to the socket location.

        The next and final issue is when you check the height differences of surrounding tiles. Your last branch in the graph you linked is not connected, so will of course not work, but I assume you're aware of this. You're getting the correct height values, but I think you want to change how it is checked. I assume how you want it to be is that you can walk between two tiles unless the height difference between them is equal to or higher than twice the height of a box. So you don't need two branches for this. After subtracting the height of the clicked tile index from the height of the neighboring tile use the "abs" node to get the absolute value (which does not care if the value is positive or negative). Use a branch and check if this absolute value is lower than BoxHeight*2. If so, AddTileEdgeBothWays. If not, RemoveTileEdgeBothWays. Since the locations are vectors made up of floats their values are not 100% precise (a float of 0 might for instance really be 0.00001), so you should add a tiny bit of leeway in your calculations. Instead of checking if the absolute value is smaller than BoxHeight*2, maybe check BoxHeight*2-1 or something, or even BoxHeight*1.5 if you want some leeway in the heights of your box meshes.

        Edit: Checking the video you sent me on the board game you are basing this on it seems you want to be able to move down any distance, but to move up only one box. This changes my suggestion a bit. Instead of using absolute value you need to keep the information if the difference is negative or positive. Then when you get all the surrounding indexes, if a surrounding tile is higher than BoxHeight*1.5 compared to the center tile you want to RemoveTileEdge (not both ways) with the tile index as the center tile as TileIndex input and the tile index of the tall neighbor as Edge. Then you want to do the opposite for the neighbor, using AddTileEdge (again not both ways) with this tile as the TileIndex input and the center tile as the Edge. If instead the neightbor tile is lower than negative BoxHeight*1.5 compared to the center tile you do the opposite, with AddTileEdge for the center tile and RemoveTileEdge for the neighbor tile. Lastly if the difference is somewhere between positive and negative BoxHeight*1.5 you can use AddEdgeBothWays like before. Hope that makes sense.
        Last edited by Monokkel; 08-30-2018, 04:58 PM.
        The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

        Comment


          Hello again!

          The game I'm making will base it's abilities on playable cards that will be discarded and drawn during the game. At first I was thinking I need to intertwine your toolkit with the CCG Toolkit (as I've seen you've been asked about earlier here in this thread). However, looking through your new tutorials, I'm starting to feel that the only thing that needs modification to get this functionality is the UI (playable cards instead of the box of abilities as is shown in the Jungle Raid map).

          My first question is then: Adding and removing abilities from the AbilitiesComponent array, can this be done at runtime?

          As far I can can tell, all the UI stuff for the cards will be client only (both due to how I want it and also since UMGs only exist on client if I've understood correctly).

          I will probably think of more questions on this topic but this is at least the first one.

          Cheers!

          Comment


            Originally posted by Mivke1 View Post
            Hello again!

            The game I'm making will base it's abilities on playable cards that will be discarded and drawn during the game. At first I was thinking I need to intertwine your toolkit with the CCG Toolkit (as I've seen you've been asked about earlier here in this thread). However, looking through your new tutorials, I'm starting to feel that the only thing that needs modification to get this functionality is the UI (playable cards instead of the box of abilities as is shown in the Jungle Raid map).

            My first question is then: Adding and removing abilities from the AbilitiesComponent array, can this be done at runtime?

            As far I can can tell, all the UI stuff for the cards will be client only (both due to how I want it and also since UMGs only exist on client if I've understood correctly).

            I will probably think of more questions on this topic but this is at least the first one.

            Cheers!
            Yep, I've thought the same thing. A card system is basically just the ability system with a random number of abilities drawn from an array every turn which cannot be reused on the same turn. One of the changes I made in the last update was actually done with just this sort of thing in mind. Previously in order to have an ability accessible it had to be spawned at the beginning at the game (or at BeginPlay of a newly spawned unit) and then references assigned to these spawned abilities which were used by the ability system.

            I changed this so that the ActivateAbility event in the player controller takes an ability class as input and not a reference and then it intelligently spawns a new ability or uses an already spawned one if it is accessible. This frees you from having to spawn all possible abilities that might be used during your game at the beginning (which in digital card games with random card gain effects etc. would need you to store a lot in memory).

            Without checking I don't this should require more than changing the array of ability class references in the ability system component at the start of a unit's turn, though there might be some things I'm forgetting since I have not tested it myself. I think the ability bar might still make use of an array of hard references to abilities, which would prevent the UI from updating properly if you only use the array of classes. If so this is something I should look into changing in a future update. Let me know how it works out
            The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

            Comment


              Hey Knut

              I saw in this thread that you are working on a way to show the movement area for a unit like its done for XCOM.
              (just a kind of outline around the move area)

              Could you share the logic you are using to build that?
              I would really appreciate that, so I dont have to reinvent the wheel

              Thanks!

              Comment


                Originally posted by RobinZinser View Post
                Hey Knut

                I saw in this thread that you are working on a way to show the movement area for a unit like its done for XCOM.
                (just a kind of outline around the move area)

                Could you share the logic you are using to build that?
                I would really appreciate that, so I dont have to reinvent the wheel

                Thanks!
                Hey Robin! There are some experimental functions included in the current toolkit that I used for creating the outline effect I showed a few pages back. However that method was quite hacky and not very performant. I would instead suggest to use a post processing volume to create an outline effect. elec2ron suggested this to me in this thread and I have since looked into how to get this working in ATBTT. I now have something that works great for flat grids, though it still needs some work for grids with height differences.

                So first you need to add a post processing volume with an outline shader. The best one I've found is the one by Tom Looman (found here). Follow his instructions to create the post processing material and set up an unbounded post processing volume in your level that implements it. If you are using a flat grid your work is nearly done at this point. Just make sure that the meshes used to display tiles in move range are big enough to be completely flush with one another and enable "RenderCustomDepthPass" and disable "RenderInMainPass" in the meshes' rendering settings.

                If you use multi-level terrain this can look weird (though test it out for your game to make sure), especially if the tiles have height differences within the tile itself. If so you need to do some more work to make sure all the move meshes are perfectly connected with one another at all edges or you're going to see holes between them. A way to do this suggested by elec2ron is to use procedural mesh components. In the current method I'm using line traces to find the center points in height between adjacent tiles. This works great for some maps, but results may vary for multi-level grids depending on collision. It is also not terribly performant, though more so than my previous spline-based method. I'm working on finding a way to efficiently cache the height data to improve performance. But for now this is the best I got. Sorry for the godawful spaghetti, but this is very much a work in progress.

                This should give you the following result. Note that whether or not you want the outline to be blocked by overlapping meshes can be adjusted in the shader.



                Hope that gives you the results you're hoping for
                The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                Comment


                  Hi Knut

                  Im completely new to this but I have been messing around with this for a few hours so I thought I might ask for some advice.
                  Following your tutorials is great but a bit hard sometimes since some of them are old and major changes have been made since then, half of this is probably due to me not knowing the Unreal engine editor either

                  I have started with a few small goals to try and get going.
                  First I want to get a simple mesh with some hills and walleys setup.
                  I follow that part of your tutorial but when I start the pawns float down to the base grid as soon as I move them.

                  Anyone know what I might have missed?

                  Second question is for the pawns themselves, is there anything special I need to think about when introducing my own units?
                  Plan here is to copy one of your units and change the mesh to a simple box like vehicle while disabling animations.

                  Comment


                    Hello Monokkel, long time no talk. I see I have missed alot being away most of the year, and I have alot to relearn.. I was reading a few pages back you are planning another big update after Christmas, I was wondering if it will be compatible if I start a new project with your latest version.
                    I know you are busy a quick reply is not necessary, now I'm back maybe other users and I can get the self-support on this support thread will reappear to help you out...Bah Hah..
                    Also Thanks for your latest video
                    Originally posted by Monokkel View Post
                    Hey, my support thread has become self-supporting Thanks for helping each other out, guys. I'll chime in now too.



                    Like I said I'm not 100% confident on all the lobby and map transition stuff, but I would think it makes the most sense to have separate PCs and Game modes for the lobby and game. All the stuff in the included game mode and player controller is really geared towards handling turn based gameplay and I don't think it has much use in a lobby.



                    Not entirely sure what has gone wrong here. I will give it a try myself and report back. Are the custom characters using the default UE4 humanoid skeleton?

                    Comment


                      Originally posted by Doxs Roxs View Post
                      Hi Knut

                      Im completely new to this but I have been messing around with this for a few hours so I thought I might ask for some advice.
                      Following your tutorials is great but a bit hard sometimes since some of them are old and major changes have been made since then, half of this is probably due to me not knowing the Unreal engine editor either

                      I have started with a few small goals to try and get going.
                      First I want to get a simple mesh with some hills and walleys setup.
                      I follow that part of your tutorial but when I start the pawns float down to the base grid as soon as I move them.

                      Anyone know what I might have missed?

                      Second question is for the pawns themselves, is there anything special I need to think about when introducing my own units?
                      Plan here is to copy one of your units and change the mesh to a simple box like vehicle while disabling animations.
                      Hi there! Sorry about the outdated tutorials. It is something I'm working on improving, but it is going to be a pretty long process. I decided fairly early that I would not compromise making the toolkit as good as possible in order to keep things consistent with earlier versions or older tutorials. The consequence is a few major refactorings that I believe have substantially improved the toolkit, but the consequence is unfortunately that the old tutorials become less useful and converting to new versions is sometimes a bit of a hassle.

                      In making new tutorials I have prioritized videos covering the new major systems which were not present in older versions, such as the action and ability systems. This is good for users who are already experienced in using the toolkit, but have not worked with that particular system yet. However, for new users who are trying to figure out how the basics of the toolkit work, these are less useful, and since these users are in some cases also new to Unreal Engine in general, they might have a bigger need for precise and up-to-date tutorials.

                      I still feel that making sure all central part of the toolkit is at least covered by tutorials in some way is even more important, which is why I have prioritized as I have, but I realize this is a problem and will make new tutorials when I have the time. The issue is that I have a major work-deadline hanging over my head that is sucking up almost all of my free time, so I will not be able to consistently put off time for tutorials (or really development) until after Christmas. I will do my best to make some tutorials before that, but I cannot make any promises. If you run into anything in the tutorials that is confusing and halts your progress, let me know here and I will do my best to help you out. It is also very useful to me to hear what things are not covered well in the current tutorials so I can make sure to revisit it in the future.

                      As for your specific questions, for the first it seems you want to use the toolkit's heightmap system to automatically generate a walkable grid on top of a terrain mesh, is that right? If so the variables you need to modify is in the public variables of BP_GridManager; more specifically in the Procedural category. If you set the heightmap variable to OneLevel the toolkit should automatically use line traces to create a walkable grid on top of your terrain, as long as you have set up GridSizeX and GridSizeY to size the grid appropriately and placed the terrain to overlap the grid. There are many variables to tweak in the Procedural variables, including how high and low UE4 should fire line traces to search for terrain, how large the height difference has to be between two adjacent tiles for movement between them to be disallowed etc. Play around with those and come back to me if you're not able to get the desired result.

                      As for introducing your own units there is not really anything special you need to do. The base unit, BP_Unit, is set up to work fine even without adding meshes or anything, so it works just as well if you add a box mesh or whatever you want to it. BP_Unit_Anim is a child actor of BP_Unit I have made as an example of how to use a skeletal mesh and animations within a unit and if you were making a unit with a skeletal mesh I would recommend making a duplicate of this and modifying it as you see fit. For something like a vehicle, however, I would create a fresh child actor of BP_Unit and add your meshes. Then you can look at BP_Unit_Anim for ideas on how to add specific stuff. One thing to keep in mind is to not have the meshes block PathTrace or RangeTrace in the collision settings of the mesh, or you will see some weird pathfinding and visibility behavior as the toolkit will think the top of the unit is the center of the tile it stands on, and its own mesh will block its line of sight.

                      Hope that helps!

                      Originally posted by Skulldug View Post
                      Hello Monokkel, long time no talk. I see I have missed alot being away most of the year, and I have alot to relearn.. I was reading a few pages back you are planning another big update after Christmas, I was wondering if it will be compatible if I start a new project with your latest version.
                      I know you are busy a quick reply is not necessary, now I'm back maybe other users and I can get the self-support on this support thread will reappear to help you out...Bah Hah..
                      Also Thanks for your latest video
                      Hey Skulldug, it had been a while. Happy to have you back

                      I might have been a bit unclear regarding updates. It is not that I have a new, big update planned for Christmas, but rather that I have almost no time to work on the toolkit until around Christmas, so that is the earliest could event begin to work on a new feature update, and if I do so then it will certainly be released several months after that.

                      I'm actually starting to be pretty happy with where the toolkit is at. Adding networked multiplayer and multi-tile units were the last two major features on the list I made for myself three years ago of things I wanted in the toolkit. Because of this I do not really foresee myself making any new major, transformative updates like I have in the past. New updates are more likely to consist of bug fixes, performance improvements and new example maps to demonstrate ways to implement more game-specific features. I might do some medium-sized overhauls for some of the sub-systems. The initiative system is for instance something I might want to make easier to modify, and there are some parts of the toolkit, such as the touch controls and edge-panning in BP_GridCamera that I have not touched in a long time and could use some refactoring.

                      Other than that I am (finally) planning to make my own turn-based strategy game. I will naturally be using the toolkit for this, and as I make a game I hope to be able to add stuff from the game branch to the toolkit branch as I go along. I think this might even be better for the toolkit in the long run than me simply adding features for some nebulous game as I will get a stronger feel for what stuff is most useful and needed during actual game development. Still, not something I will be doing until Christmas time.

                      To sum up, if you've previously been reluctant to use the toolkit because of a big update on the horizon I don't really think there is a better time to start than now. I cannot promise that I will never again do a major refactoring, as I sometimes get jolts of inspiration and am unable to stop myself, but if that happens it is a long way off.
                      The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                      Comment


                        Thanks for the reply Monokkel, it's not that I am reluctant to use, I didn't have time in the past 6 months, still might be a while before I start full speed ahead. I am waiting to see what happens with UE4.20 as I would like to use it for the project and still making some media.
                        Also good luck on your own game, if you need a hand with media, just ask and I will see what I can do. Good luck with your thesis also.
                        I signed up on the discord channel and that will be alot of help to everyone. Alot of nice people using your toolkit and a lot of excellent projects being worked on...Good job on this toolkit and update.
                        Will talk soon..

                        Comment


                          Originally posted by Monokkel View Post

                          Hey, sorry it took a while to reply. Been busy. Good to see that you're almost there. There are just a couple of small changes you need to do to get it working, as well as some less important suggestions.

                          Lets start at the left side of your graph. This is minor, but I think it would be cleaner to include the static mesh in your custom GridActor itself so you don't have to add a component manually every time. Also, since you are not using the Box variable any place later (unless you have more stuff that I'm not seeing) you do not need to set that variable. Buy yeah, minor stuff.

                          The first real issue is for your MapAdd node. It works great the first time you add a tile (provided the grid manager is at Z location 0), as you set the grid location to 0 + the top of the box. However when you then add a new box on top of that one the new location stored at Z in the map will also be 0 + the top of the box, which I assume is not what you want. You want it to increment by the box height every time you add a new one. Therefore you need to add the Z location that is already there (which you have in your BreakVector node) to the socket location.

                          The next and final issue is when you check the height differences of surrounding tiles. Your last branch in the graph you linked is not connected, so will of course not work, but I assume you're aware of this. You're getting the correct height values, but I think you want to change how it is checked. I assume how you want it to be is that you can walk between two tiles unless the height difference between them is equal to or higher than twice the height of a box. So you don't need two branches for this. After subtracting the height of the clicked tile index from the height of the neighboring tile use the "abs" node to get the absolute value (which does not care if the value is positive or negative). Use a branch and check if this absolute value is lower than BoxHeight*2. If so, AddTileEdgeBothWays. If not, RemoveTileEdgeBothWays. Since the locations are vectors made up of floats their values are not 100% precise (a float of 0 might for instance really be 0.00001), so you should add a tiny bit of leeway in your calculations. Instead of checking if the absolute value is smaller than BoxHeight*2, maybe check BoxHeight*2-1 or something, or even BoxHeight*1.5 if you want some leeway in the heights of your box meshes.

                          Edit: Checking the video you sent me on the board game you are basing this on it seems you want to be able to move down any distance, but to move up only one box. This changes my suggestion a bit. Instead of using absolute value you need to keep the information if the difference is negative or positive. Then when you get all the surrounding indexes, if a surrounding tile is higher than BoxHeight*1.5 compared to the center tile you want to RemoveTileEdge (not both ways) with the tile index as the center tile as TileIndex input and the tile index of the tall neighbor as Edge. Then you want to do the opposite for the neighbor, using AddTileEdge (again not both ways) with this tile as the TileIndex input and the center tile as the Edge. If instead the neightbor tile is lower than negative BoxHeight*1.5 compared to the center tile you do the opposite, with AddTileEdge for the center tile and RemoveTileEdge for the neighbor tile. Lastly if the difference is somewhere between positive and negative BoxHeight*1.5 you can use AddEdgeBothWays like before. Hope that makes sense.
                          No worries. Thanks for the explanation.

                          My blueprint is now this: https://blueprintue.com/blueprint/_ykc_zvf/

                          And I check in "CheckIfValidTarget" if the player can move to a tile or not.

                          I still have a weird issue though that sometimes when I place the second mesh next to a player the blue markers for this player gets on top of the first mesh instead of the second mesh this doesn't happen if I place a second mesh that's not next to a player. You are correct that the player can only move 1 mesh up at a time and can move from second mesh to the floor directly.

                          I tried adding the Z location of the grid location like I think you said but that gave me some weird results. Resulting the marker being two times above the meshes.

                          Another thing I am having trouble with is figuring out how you can end the turn of the whole faction.

                          Following situation:

                          I have two players. Each can control 2 units in 1 turn. But they can only use 1 unit each turn. I had no idea to switch between units inside factions so it's now an ugly hack to switch between units in a faction.
                          https://blueprintue.com/blueprint/32bp12ct/

                          When I click on a unit if it's the same faction then it's switching to that unit.

                          Now what I want is when ever a player end it's turn it should always go to the other faction. This works some what if use "End Entire Faction Turn" in the ReactivateActiveObject but this only seems to work if I don't switch between units in a turn. If I switch between units in a turn and end a turn it is possible to go to a unit's turn in the same faction which I don't want.

                          You have any thoughts how to approach this?

                          Sorry to bug you but one other thing

                          I want the player not to walk to another tile but to gracefully jump to another tile. I tried some attempts to do it in BP_Unit but I don't know how I would get the ClickedIndex in there to know where the player must jump to.

                          Thanks in advance!!

                          Comment


                            Originally posted by Monokkel View Post

                            As for your specific questions, for the first it seems you want to use the toolkit's heightmap system to automatically generate a walkable grid on top of a terrain mesh, is that right? If so the variables you need to modify is in the public variables of BP_GridManager; more specifically in the Procedural category. If you set the heightmap variable to OneLevel the toolkit should automatically use line traces to create a walkable grid on top of your terrain, as long as you have set up GridSizeX and GridSizeY to size the grid appropriately and placed the terrain to overlap the grid. There are many variables to tweak in the Procedural variables, including how high and low UE4 should fire line traces to search for terrain, how large the height difference has to be between two adjacent tiles for movement between them to be disallowed etc. Play around with those and come back to me if you're not able to get the desired result.

                            As for introducing your own units there is not really anything special you need to do. The base unit, BP_Unit, is set up to work fine even without adding meshes or anything, so it works just as well if you add a box mesh or whatever you want to it. BP_Unit_Anim is a child actor of BP_Unit I have made as an example of how to use a skeletal mesh and animations within a unit and if you were making a unit with a skeletal mesh I would recommend making a duplicate of this and modifying it as you see fit. For something like a vehicle, however, I would create a fresh child actor of BP_Unit and add your meshes. Then you can look at BP_Unit_Anim for ideas on how to add specific stuff. One thing to keep in mind is to not have the meshes block PathTrace or RangeTrace in the collision settings of the mesh, or you will see some weird pathfinding and visibility behavior as the toolkit will think the top of the unit is the center of the tile it stands on, and its own mesh will block its line of sight.

                            Hope that helps!
                            Hi again, thanks for the help, I got the mesh working now, It was the heightmap setting under Procedural.
                            Dont worry about the tutorials, remember I am completely new to the Unreal engine and editor.

                            Now I will proceed to mess with all the other stuff, most likely Ill break it in all sorts of impossible ways

                            Comment


                              Hi Monokkel, I bought this toolkit a while ago but just started going through the tutorials last week. I wanted to use this toolkit to create a tactics game that plays like a rogue-like (Pause the game and give commands but have movement and attacks function like a rogue-like). I see that there is a rogue-like example in 2D game but I want my game to be in 3D. I'll let you know if I figure out a way to do this, but I wanted to know if you have any ideas or suggestions on implementation in the meantime.

                              Comment


                                Does this toolkit have an official Discord? If not can the creator (or a user) create one?
                                Atoms4D - Indie VR Game atoms4d.com *site needs updating(soon)*
                                XAXISvr - A Marketplace for VR Dev's: xaxisvr.com
                                Owen Prescott - Official Concept Art & Design: owenprescott.com

                                Comment

                                Working...
                                X