Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Hi Knut
    I think you missed my previous post.
    I just bought the toolkit and it is great.
    How easy would it be to add scrolling to your kit (ie mouse to edge of screen moves map) as my game will have large maps.
    I went through your tuts - in #6 I think it was, you show updated tiles vs decals vs landscape/terrain.
    In your experience, for large maps which would be the best way to go? (memory/performance-wise).
    Thanks in advance

    Comment


      Originally posted by emptyT View Post
      Hi Knut
      I think you missed my previous post.
      I just bought the toolkit and it is great.
      How easy would it be to add scrolling to your kit (ie mouse to edge of screen moves map) as my game will have large maps.
      I went through your tuts - in #6 I think it was, you show updated tiles vs decals vs landscape/terrain.
      In your experience, for large maps which would be the best way to go? (memory/performance-wise).
      Thanks in advance
      Hello, and sorry for not replying to your previous post. I did indeed miss it. I must gave gotten caught up in answering DarkRa88iT and must have filtered it out. Terribly sorry about that. Mouse scrolling is in fact something that will be included in the next update. I have implemented it fully. I will show you the blueprints I use as soon as I'm able (though I'm heading straight to town after work today, so probably tomorrow). The general idea is to get the 2D position of the mouse, comparing it to the size of the screen and using this information to adjust the panning events in BP_GridCamera. I'm not exactly sure what you mean by using decals to display large maps. Decals are generally not very performant and should be used fairly sparingly. If you are thinking of displaying tiles, using hierarchical instanced static meshes is the best solution, which is the one I use in the toolkit. Using landscape/terrain can also be very efficient, depending on how you do it. If you are thinking of the tiles that are displayed to indicate move range, either decals or HISMs should be fine, unless you have truly outrageous movement ranges.

      Originally posted by Selentic View Post
      Also no, those screenshots are from Fire Emblem: Sacred stones which is just a quality example of the mechanics im looking for
      Ouch. Right in the TBS credentials. I should probably know that, but I've only played the newer Fire Emblem games. To be fair, it would have been pretty easy to replicate those screenshots using ATBTT, though.

      [QUOTE=Selentic;625063]I'd still like to know how to handle that function for enemies. (not sure if that's been covered elsewhere in this thread, unfortunately the search function is really poor at finding relevant things )

      The thread is a pretty long read at this point, so no worries. I have not discussed that before anyway, so searching would not have helped you much. I'm guessing what you want to do is to display what tiles can be attacked by the AI during the player's turn, so that this can be used for tactical decisions? What you need to do is to run the Pathfinding function using the index and move range of the AI unit and then run the Display All Possible Visible Tiles function (the name might not be entirely correct as I cannot check at the moment). Note that this will override any other pathfinding you have run before that same turn, so that you would need to rerun pathfinding for the current unit after you are done displaying tiles in range for the AI. That is the general idea. If you find this difficult to implement I'll test it out myself.
      Advanced Turn Based Tile Toolkit (Marketplace - Support)

      Dungeon Crawler Toolkit (Marketplace - Support)

      Discord

      Comment


        Originally posted by Monokkel View Post
        Ouch. Right in the TBS credentials. I should probably know that, but I've only played the newer Fire Emblem games.
        rip street cred, the old gba fire emblem games are pretty sick, if you're into that kinda thing you should definitely give them a play.

        Originally posted by Monokkel View Post
        To be fair, it would have been pretty easy to replicate those screenshots using ATBTT, though.
        Just you wait until I get mechanics setup

        Originally posted by Monokkel View Post
        The thread is a pretty long read at this point, so no worries. I have not discussed that before anyway, so searching would not have helped you much. I'm guessing what you want to do is to display what tiles can be attacked by the AI during the player's turn, so that this can be used for tactical decisions? What you need to do is to run the Pathfinding function using the index and move range of the AI unit and then run the Display All Possible Visible Tiles function (the name might not be entirely correct as I cannot check at the moment). Note that this will override any other pathfinding you have run before that same turn, so that you would need to rerun pathfinding for the current unit after you are done displaying tiles in range for the AI. That is the general idea. If you find this difficult to implement I'll test it out myself.
        Thanks! I'll start working on that.
        Anime Shading Model - Twitter

        Comment


          Originally posted by Monokkel View Post
          :
          ATBTT_GameMode contains an array called InitiativeOrder that by default contains all the units placed in the game. This array is ordered so that the currently active unit is stored in index 0, the next one in index 1 and so on. When a unit's turn ends it is placed at the last index of the array while all other items are shuffled forward one step. After a unit ends its turn the value of HasActedThisTurn of that unit is set to true. When a new unit is activated we check if HasActedThisTurn is true. If it is, this means that we have gone through a full round of all units acting, so we reset HasActedThisTurn for all units.

          I have also included an option of switching between multiple units of the same faction by clicking them. This is enabled by setting Can Player Switch Pawns to true in the public variables of BP_GridManager. The logic for switching between units is contained in the event tree of ATBTT_PlayerController. When a unit is clicked we check if it is the same faction as the current unit. If it is we check if it has acted this turn already. If it hasn't we want to switch to this unit. This is done by putting that unit first in the initiative array and activating that unit. This only works correctly if different factions do not have overlapping initiative values, but act one faction after the next, since we can in principle switch to a unit that has a lower initiative value than a unit of a different faction.

          *SNIP*

          That should hopefully give you a good foundation for building the sort of turn ordering you are interested in. I hope it was easy enough to follow. Good luck on your game and let me know if you have any other questions
          Hey, I tried following along this, and while it seems to work at first, after I order a unit to perform a an attack I can't select any other units, even after I end my turn with that button. Additionally if I attempt to select the unit that would normally already be selected first with the vanilla system, it just shows the attackable spaces around him (However if I select another unit and then select him he has the expected functionality, as long he has remained unselected before). I'm guessing this happens because your changes don't actually provide the system with a state where no units are actually selected and it just selects what it would normally select, except with the related ui hidden, idk im still trying to wrap my head around all this.

          Any idea what I may have missed that's causing my units to be unable to continue their turns properly?

          Also I'm trying to work around the no unit issue by having a dummy player pawn that gets selected whenever the player hasn't selected anything, or deselects one of his units. Is this a good idea or did I just miss something important in your example?
          Last edited by Envieous; 11-18-2016, 10:55 PM.
          Anime Shading Model - Twitter

          Comment


            Seems like there were a couple of things I skipped when making the explanation. My bad for not taking notes while I experimented. To fix your issues, first set Disable Player Controller Input (contained in ATBTT_PlayerController) to false at the far right of the Event Graph of the Game Mode (same place where I set Local Current Unit to empty). This should prevent input from being disabled after you have attacked:

            Click image for larger version

Name:	ePwTESk.png
Views:	1
Size:	128.2 KB
ID:	1118630

            Also in the the player controller in the End turn if the current unit is clicked comment box check the local current unit instead of the current pawn from the game mode. This prevents the issue where you click an inactive unit which is stored as the current unit and it skips straight to showing attack range:

            Click image for larger version

Name:	sFAFsd8.png
Views:	1
Size:	214.2 KB
ID:	1118631

            Having a dummy unit could of course also work, of course. That basically comes down to preference.
            Advanced Turn Based Tile Toolkit (Marketplace - Support)

            Dungeon Crawler Toolkit (Marketplace - Support)

            Discord

            Comment


              Worked flawlessly. Thanks a bunch!
              Anime Shading Model - Twitter

              Comment


                I attached a picture of a simple setup I'd like to realise as a starting point, where the key aspects are as follows:
                1. The player can only interact with creatures in his current area (marked in light grey), he can see the adjacent areas he could travel to, but not what's going on inside of them (I guess that could be realised with something like walls and doors or sth like that).
                2. Inside an area, the player has a certain line of sight (marked green) and a certain movement range (marked in teal) and he can't see what's going on outside his line of sight.
                3. When the player has no movement/action points left, the turn ends automatically - enemies/wildlife in the current area move around (shouldn't take too long), then the player can start moving again (similar to the movement in Cardinal Quest 2).
                4. When the player transitions to a different area, let's say to the one in the top right, the previous area should grey out and the one on the bottom blacked out (it's no longer adjacent to the area the player is currently in, this might change if the player is drawing a map or has a follower who is ordered to keep track). Areas that are adjacent to the new area get revealed.
                5. When the player has recruited allies they automatically move with him, but can't be controlled unless the player uses a specific skill and takes control of one or more allied units.
                6. While the player takes control of an allied unit, he can create a loop (e.g. patrol between point A and B), which will then be followed by this unit unless another order is given or an enemy moves into his line of sight.

                I believe your toolkit would prove quite useful for realising some of these points, are there certain limitations I should be aware of?

                Comment


                  I'm not sure if this has been noticed before, but I found an issue that makes pawns pathfind ontop of each other.



                  Steps to reproduce:

                  Fresh Project
                  Enable show all visible tiles in friendly pawns
                  Disable camera following active unit (So that you can keep your mouse on a tile)

                  You can't see my cursor in the video but what I'm doing is not moving it off the unit im attacking, and simply clicking it again as each new pawn becomes active. In the second half I move it one tile up and then back for the second unit, and then leave it on the enemy and click for the third.
                  Anime Shading Model - Twitter

                  Comment


                    Thanks a lot for reporting the bug, including the repro-steps, Selentic! I guess this bug has gone unreported for so long because it has hidden by the auto-panning camera. It seems the cause of the issue is that the tick event in ATBTT_PlayerController fires after a new unit is activated, but before pathfinding is done calculating, which is done over a couple of ticks by default when using Find All Possible Visible Tiles. Finding the reason for the bug was difficult, but solving it is very easy. In the Begin Unit Turn comment box in ATBTT_PlayerController move the node setting Current Tile Hover to -1 from at the very start of Activate Unit to the very end (at the far right, after Disable Player Controller Input is set to false):

                    Click image for larger version

Name:	QQVEVGI.png
Views:	1
Size:	155.3 KB
ID:	1118678

                    Though it will occur frequently in most games, this is a very serious bug, so I'm sending a hotfix to Epic immediately. Thanks again!
                    Advanced Turn Based Tile Toolkit (Marketplace - Support)

                    Dungeon Crawler Toolkit (Marketplace - Support)

                    Discord

                    Comment


                      Originally posted by Monokkel View Post
                      Though it will occur frequently in most games, this is a very serious bug, so I'm sending a hotfix to Epic immediately. Thanks again!
                      np, thanks for the quick fix

                      It may be worth noting that the issue is still present if the modification for having no unit selected (Atleast I'm pretty sure this is the cause, since it doesn't occur when I revert this change) has been made to the toolkit. If you have the time to check that out too that'd be greatly appreciated.


                      Additionally is there a way to tell the game to select a specific unit? I'd like to pursue having a dummy player unit to be activated when no selection is made, since leaving it empty spits out a few warnings and causes some weird issues like the one mentioned above.
                      Last edited by Envieous; 11-20-2016, 01:12 AM.
                      Anime Shading Model - Twitter

                      Comment


                        I attached a picture of a simple setup I'd like to realise as a starting point, where the key aspects are as follows:
                        1. The player can only interact with creatures in his current area (marked in light grey), he can see the adjacent areas he could travel to, but not what's going on inside of them (I guess that could be realised with something like walls and doors or sth like that).
                        2. Inside an area, the player has a certain line of sight (marked green) and a certain movement range (marked in teal) and he can't see what's going on outside his line of sight.
                        3. When the player has no movement/action points left, the turn ends automatically - enemies/wildlife in the current area move around (shouldn't take too long), then the player can start moving again (similar to the movement in Cardinal Quest 2).
                        4. When the player transitions to a different area, let's say to the one in the top right, the previous area should grey out and the one on the bottom blacked out (it's no longer adjacent to the area the player is currently in, this might change if the player is drawing a map or has a follower who is ordered to keep track). Areas that are adjacent to the new area get revealed.
                        5. When the player has recruited allies they automatically move with him, but can't be controlled unless the player uses a specific skill and takes control of one or more allied units.
                        6. While the player takes control of an allied unit, he can create a loop (e.g. patrol between point A and B), which will then be followed by this unit unless another order is given or an enemy moves into his line of sight.

                        I believe your toolkit would prove quite useful for realising some of these points, are there certain limitations I should be aware of?

                        Click image for larger version

Name:	first_setup.jpg
Views:	1
Size:	709.6 KB
ID:	1118699

                        Comment


                          Thanks for your reply - hope you had a good 'night on the tiles' (proud of the pun ) - any eta on when this next update will be available?

                          Comment


                            Originally posted by Selentic View Post
                            np, thanks for the quick fix

                            It may be worth noting that the issue is still present if the modification for having no unit selected (Atleast I'm pretty sure this is the cause, since it doesn't occur when I revert this change) has been made to the toolkit. If you have the time to check that out too that'd be greatly appreciated.


                            Additionally is there a way to tell the game to select a specific unit? I'd like to pursue having a dummy player unit to be activated when no selection is made, since leaving it empty spits out a few warnings and causes some weird issues like the one mentioned above.
                            I'm not sure how the issue can persist if you use that modification, because you would need to move the mouse to select a new unit, which would prevent the bug from occurring. However if you add new ways of selecting units without clicking them it would of course cause a problem. Setting the Current Tile Hover of ATBTT_PlayerController to -1 at the end of the game mode (where Activate Unit is normally called in the default toolkit) should probably do the trick.

                            As for selecting a specific unit you can use the same nodes that are used in the If CanPlayerSwitchPawns is true and a pawn that has not acted is click, switch to this pawn comment box in the Event Graph of ATBTT_PlayerController, just inputting whatever unit you want instead of getting the unit at the index equal to Clicked Tile from the Pawn Array.

                            Originally posted by kingdavve View Post
                            I attached a picture of a simple setup I'd like to realise as a starting point, where the key aspects are as follows:
                            1. The player can only interact with creatures in his current area (marked in light grey), he can see the adjacent areas he could travel to, but not what's going on inside of them (I guess that could be realised with something like walls and doors or sth like that).
                            2. Inside an area, the player has a certain line of sight (marked green) and a certain movement range (marked in teal) and he can't see what's going on outside his line of sight.
                            3. When the player has no movement/action points left, the turn ends automatically - enemies/wildlife in the current area move around (shouldn't take too long), then the player can start moving again (similar to the movement in Cardinal Quest 2).
                            4. When the player transitions to a different area, let's say to the one in the top right, the previous area should grey out and the one on the bottom blacked out (it's no longer adjacent to the area the player is currently in, this might change if the player is drawing a map or has a follower who is ordered to keep track). Areas that are adjacent to the new area get revealed.
                            5. When the player has recruited allies they automatically move with him, but can't be controlled unless the player uses a specific skill and takes control of one or more allied units.
                            6. While the player takes control of an allied unit, he can create a loop (e.g. patrol between point A and B), which will then be followed by this unit unless another order is given or an enemy moves into his line of sight.

                            I believe your toolkit would prove quite useful for realising some of these points, are there certain limitations I should be aware of?

                            [ATTACH=CONFIG]118318[/ATTACH]
                            Hey Kingdave, I'm glad you managed to get access to the forums. I have already sent you the answer by e-mail which you have replied to, but I'll repeat my answer here in case it is useful for any other people using the toolkit:

                            You have some pretty interesting concepts, but it will take a lot of tweaking on your part to get everything working the way you want it. Everything you mention should be achievable, but it all depends on your implementation. I'll tackle your questions one by one.

                            1. Should be easy to do. When the player clicks a tile, check its index and see if it in the allowed area/zone. If it isn't ignore the input. You would probably want a new array that stores which sub-grid each tile belongs to.
                            2. Check my 2D game example for one way to handle line of sight. It should be pretty close to what you're looking for.
                            3. Ending the turn automatically is as easy as running the End Turn event in the player controller.
                            4. If you have stored which tile belongs to which sub-grid this should not be too hard. You would loop through the grid array and hide each tile in the appropriate subgrid. Though if the areas are always the same size (as is the case in your screenshot) it would be much more performant to cover the entire area by one large, hexagonal mesh. You would need to find a way to figure out how many zones are between the current zone of the player and the other zones. You could run a function each time the player enters a new zone, check the distance from the current zone to the center of each other zone (you could store these locations beforehand) and cover them up if they are two zones away.
                            5. When you take control of your allies this would work just like the toolkit does currently, so that should be relatively easy. As for following the current player it will be a bit more tricky, but doable. When a unit moves it follows an array of vectors called the Path Vector Array. You would need to set it up so that the allies are always moving towards the previous vector in the array as compare to the player unit.
                            6. A bit tricky, and I'm not sure if I completely understand you . Are they moving at the same time as the player? You would need to store the path of these units in a separate array and move them along this path in parallel with the player moving along his path.

                            Like I said, I think all of these things should be doable. I'm wondering how large you want the maps to be in total, though (all zones). The size of the map in your screenshot should be fine, but if you go to more than twice that you'd probably want to implement some sort of level loading from an array, which would take a lot of work to implement. Is the game 2D or 3D by the way? This has great influence on the ease of hiding tiles.

                            The difficulty of all the things you have asked does of course depend on your skill with UE4 blueprints and ATBTT. You should be quite comfortable with both before tackling most of these, though I'll do my best to help you along the way.

                            I hope that helps clear up most of your questions. Let me know if you want me to clear anything up.

                            Originally posted by emptyT View Post
                            Thanks for your reply - hope you had a good 'night on the tiles' (proud of the pun ) - any eta on when this next update will be available?
                            Heh, good one I'm horrible at giving time estimates, so I don't think it would do much good. Work is pretty time consuming and unpredictable at the moment, which makes it hard to assess how much time I'll have for gamedev. It could take a few weeks or a few of months. I've also been using Unreal Engine at work lately which, while fun, has made it less tempting to keep working in UE4 when returning home. I'm done with that work for the moment, though, and I now have fMRI brain recordings of people watching something I made in UE4 which is neat

                            Instead of giving an exact estimate I can describe some of what I've done so far and what I'm still planning to do. I have created systems for cover and accuracy, for using special abilities that can be selected through the UI. I have added the example abilities heal, overwatch and grenades. I have added edge scrolling and units wielding weapon meshes firing lasers. I've added working VR controls with a few cool features. I am in the process of updating the AI to use the special abilities I have added, which is pretty difficult. I also want to update the VR map so that it works with special abilities, since I think it will look really cool. I also need to design some better looking example maps, as the ones I'm using for testing are very bare bones. I also need to stop myself from not constantly wanting to add new features, as I keep getting new ideas as I go along. I'll try to stick to just my planned features, and hopefully it should be done in the not too distant future.
                            Advanced Turn Based Tile Toolkit (Marketplace - Support)

                            Dungeon Crawler Toolkit (Marketplace - Support)

                            Discord

                            Comment


                              Originally posted by Monokkel View Post
                              I'm not sure how the issue can persist if you use that modification, because you would need to move the mouse to select a new unit, which would prevent the bug from occurring. However if you add new ways of selecting units without clicking them it would of course cause a problem. Setting the Current Tile Hover of ATBTT_PlayerController to -1 at the end of the game mode (where Activate Unit is normally called in the default toolkit) should probably do the trick.
                              Yeah, I'm not really sure. It may have been something I misconfigured vOv.

                              Originally posted by Monokkel View Post
                              As for selecting a specific unit you can use the same nodes that are used in the If CanPlayerSwitchPawns is true and a pawn that has not acted is click, switch to this pawn comment box in the Event Graph of ATBTT_PlayerController, just inputting whatever unit you want instead of getting the unit at the index equal to Clicked Tile from the Pawn Array.
                              I'll try that, Thanks!
                              Anime Shading Model - Twitter

                              Comment


                                My compatibility update for UE4.14 is out. The only thing that needed fixing was replacing the materials of the tile maps in the 2D game example, so this version is identical to the previous one, so don't get too excited

                                I've made some progress with the coming feature update, though, and I just managed to add something really cool. The AI now takes cover into consideration when choosing which tile to attack from. They calculate their own hit chance from each possible tile in move range and checks the combined hit chances of all enemy units for that tile. It still requires tweaking, but it is so cool to see the AI make tactical decisions.

                                [MENTION=16997]Selentic[/MENTION]: Hopefully that should do the trick. If you still encounter a lot of issues you can of course consider adding a dummy unit. This also involves quite a few changes to get working correctly, though. The central thing would be to have the unit in the initiative order, but not in the Pawn array and to always put the dummy unit at the end of the Initiative Order array when switching to another unit while the dummy unit is the current unit.
                                Advanced Turn Based Tile Toolkit (Marketplace - Support)

                                Dungeon Crawler Toolkit (Marketplace - Support)

                                Discord

                                Comment

                                Working...
                                X