Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    For the most part I feel that blueprints have very few limitations, and this is probably an issue that will be resolved in the future, but for the moment I will be a bit more careful about using child blueprints for very complex blueprint actors. I'm sending an error report to Epic.

    For aggro ranges where you enter turn based mode when spotting an enemy, this is exactly what I'm doing in the 2D example, so I recommend taking a look there. I also describe all the 2D example blueprints in my latest tutorial video.

    Spawning units should be very simple indeed thanks to the function I've added.

    When it comes to AI that is pretty well know to be the hardest thing about making a turn based strategy game. I think it is a really fun challenge, though, and I'm absolutely up for the task.
    The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

    Comment


      Hello again, and thank you so much for the answers! Your tutorials are great indeed ^^

      I'm trying to implement mechanics very similar to https://forums.unrealengine.com/show...l=1#post509167, and suffering problems with one important addition. I added factions variables for cities, and now I need AI units to ignore cities with the same faction as theirs (and switching the faction of the city, if any non-allied unit "conquers" this point). Could you please help with an advice, if there would be some time, how should I make it correctly? Accessing this change through BP_Grid_manager and modifiing the range arrays seems bad idea, or I'm doing something terribly wrong.
      Thank you!

      Comment


        Hey Monokkel!
        Im having two issues I think you should know about, well one isnt an issue its something im unsure of and others may want to know it aswell.

        1. Whats the best way to remove a time in-game?
        I have several bases jotted about a map, that block pathtrace so units cant walk or spawn on them.
        However at times I want to remove/destroy these tiles, but doing so makes them still appear on the grid like so.
        I did try a few things before asking ( changing collision settings, destroying the actor and then resetting the grid)




        2. I have a had play in your bunker map as I would like to get into multi level maps,
        however with a normal spawn unit function, it doesnt put it at the correct place.
        It says its the right transform but the pawn array index says something else.
        I havent moved the map itself so the grid is still 0,0,0
        Adding units to the grid before play does work though
        Attached Files

        Comment


          I just ran into a weird issue where every time a enemy unit is supposed to walk up to player controlled unit. The pathing will send them to the 0 index on the grid. So the AI will run through walls and the floor to the top left corner of the map. then turn and attack my unit dealing damage. I am pretty sure I broke something here but not quite sure what. It does report an error saying that a null value was obtained.

          This is kind of strange because I didn't really change anything that I know would cause this.
          - Russell Meakim AKA The Castle
          BLOG: https://steemit.com/@thecastle

          Comment


            Originally posted by Waldesfray View Post
            Hello again, and thank you so much for the answers! Your tutorials are great indeed ^^
            Thanks! Happy to help!
            Originally posted by Waldesfray View Post
            I'm trying to implement mechanics very similar to https://forums.unrealengine.com/show...l=1#post509167, and suffering problems with one important addition. I added factions variables for cities, and now I need AI units to ignore cities with the same faction as theirs (and switching the faction of the city, if any non-allied unit "conquers" this point). Could you please help with an advice, if there would be some time, how should I make it correctly? Accessing this change through BP_Grid_manager and modifiing the range arrays seems bad idea, or I'm doing something terribly wrong.
            I’m not exactly sure what you need the range array for. It is just used for temporarily storing what tiles are in range of a unit.
            The simplest way to get a city to change faction when a unit moves into it is to use collision. Enable collision for your units (but make sure their collision do not block PathTrace and RangeTrace) and add a trigger volume to your cities in the middle of their tile. In the city blueprint you can get any colliding actors, cast them to Unit_Parent, get their faction and alter the faction of the city.
            AI is a bit more tricky. In ATBTT_AI_Controller after pathfinding but before finding if there are any units in range you could get all actors of your city blueprint class, loop through them and use the vector to index function in BP_GridManager to convert their locations to indexes on the grid. You then check if that index in the CanMoveTo array in BP_GridManager is higher than 0 (meaning the current unit can move to it) and that the Pawn Array at that index is empty. If so you should set that tile index as the unit’s target and move it there using the same nodes in the AI controller used for directing the unit towards an enemy unit.
            This is one possible solution, at least. I hope my explanation was understandable and that I understood your question correctly.
            Originally posted by LDodds View Post
            1. Whats the best way to remove a time in-game?
            I have several bases jotted about a map, that block pathtrace so units cant walk or spawn on them.
            However at times I want to remove/destroy these tiles, but doing so makes them still appear on the grid like so.
            I did try a few things before asking ( changing collision settings, destroying the actor and then resetting the grid)
            I have two functions called Make Tile Passable and Make Tile Impassable that should be useful to you. You should first get references to all the tiles you want to modify and loop over them, using Make Tile Passable for each. This should hopefully do the trick. To get the appropriate tiles you could possibly use the Get Indexes in Range function, though you could end up making surrounding tiles passable that you want to be impassable if you’re not careful.
            Originally posted by LDodds View Post
            2. I have a had play in your bunker map as I would like to get into multi level maps,
            however with a normal spawn unit function, it doesnt put it at the correct place.
            It says its the right transform but the pawn array index says something else.
            I havent moved the map itself so the grid is still 0,0,0
            Adding units to the grid before play does work though
            Hmm, that’s not good. This might have been an oversight on my part. I will look into it when I have access to my home computer.
            Originally posted by Castle View Post
            I just ran into a weird issue where every time a enemy unit is supposed to walk up to player controlled unit. The pathing will send them to the 0 index on the grid. So the AI will run through walls and the floor to the top left corner of the map. then turn and attack my unit dealing damage. I am pretty sure I broke something here but not quite sure what. It does report an error saying that a null value was obtained.
            This is kind of strange because I didn't really change anything that I know would cause this.
            This is an error I have seen a few times, but it should not happen without you changing something. It is caused by the AI searching for player units to attack and one of the functions for finding targets returning false (or 0), causing the unit to move to index 0. Have you made any modifications to ATBTT_AI_Controller?
            The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

            Comment


              Originally posted by Monokkel View Post
              Thanks! Happy to help!

              I’m not exactly sure what you need the range array for. It is just used for temporarily storing what tiles are in range of a unit.
              The simplest way to get a city to change faction when a unit moves into it is to use collision. Enable collision for your units (but make sure their collision do not block PathTrace and RangeTrace) and add a trigger volume to your cities in the middle of their tile. In the city blueprint you can get any colliding actors, cast them to Unit_Parent, get their faction and alter the faction of the city.
              AI is a bit more tricky. In ATBTT_AI_Controller after pathfinding but before finding if there are any units in range you could get all actors of your city blueprint class, loop through them and use the vector to index function in BP_GridManager to convert their locations to indexes on the grid. You then check if that index in the CanMoveTo array in BP_GridManager is higher than 0 (meaning the current unit can move to it) and that the Pawn Array at that index is empty. If so you should set that tile index as the unit’s target and move it there using the same nodes in the AI controller used for directing the unit towards an enemy unit.
              This is one possible solution, at least. I hope my explanation was understandable and that I understood your question correctly.
              Thank you, the collision solution seems to be almost ideal one! But how could I make AI ignore its own faction (an allied factions) cities? These cities may stay unoccupied, but faction-allied by default.

              Comment


                Hey
                I tested that out with a large cube in map, that blocks everything dynamically.
                Unfortunately it still doesn't work, im sure theres something iv missed.


                Edit: No worries man, take the time you need was just keeping you updated and showing what iv tried.
                Last edited by LDodds; 09-05-2016, 04:13 PM.

                Comment


                  When looping through the city blueprint get the faction variable of each city. Do not add a city as a possible target if its faction variable matches the faction of the current unit (from ATBTT_game_mode)

                  Edit: Looking into you problem, LDodds. Just don't have an answer yet.
                  Last edited by Monokkel; 09-05-2016, 03:55 PM.
                  The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                  Comment


                    Ok, LDodds, I've checked out the issues with changing edge costs at runtime. The Make Tile Passable function really only works properly for single tiles and not large areas of impassable tiles, as edges are not added to surrounding tiles that are themselves impassable. Below is how you can add edges manually. I'm also changing the height of the vector field array to 0. This only works well if your game is uniformly flat. If not you should use a line trace to find the new height, similar to how I do in the Add Viewport Terrain to Arrays function. I'm doing this stuff in the event graph of BP_GridManager, but you can of course do it anywhere by getting a reference to the grid manager.



                    Still looking into the heightmap stuff. I'll get back to you when I've figured it out.

                    Edit: Seems like the spawning unit on heightmap is a twofold problem. The first is simply that the grid manager of the heightmap example map is not placed at 0,0,0 and the Spawn Unit function is not correcting for this. This can easily be fixed by adding the location of the grid manager from the spawn location. A second problem seems to be that the construction script of Unit_Parent is run through when a unit is spawned, causing it to search for the ground beneath it twice and being placed below the ground. This might not be a problem in your game if there is nothing blocking pathtrace below ground level. Try out Spawn Unit in a different level than the heightmap one and you should not have any problems. I will look into it and find a fix as soon as I'm able, however.
                    Last edited by Monokkel; 09-05-2016, 05:11 PM.
                    The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                    Comment


                      Hey thanks for the speedy reply, however I clicked your link and got this
                      "Invalid Attachment specified. If you followed a valid link, please notify the administrator"

                      Comment


                        Oh, sorry about that. I'll try again. Here is how I solved it:

                        Click image for larger version

Name:	lNltHUA.png
Views:	1
Size:	209.2 KB
ID:	1114727

                        Note that the Get all actors -> get index 0 stuff is just a lazy way to get a reference for testing purposes.
                        The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                        Comment


                          Hey!
                          I tried that out, initially it half worked because some tiles were still blocked.
                          But i think that was because it was the size of the cube, I increased the range and it cleared right up.
                          *what would happen if an enemy unit was caught in this function? Would it be unaffected or would you be able to walk onto its tile?*
                          Really helpful function because now I can remove/move things around in-game.
                          Thanks!

                          Comment


                            Due to the odd shape of some of the actors I was trying to remove, I had to scale up the range of the "Get Indexes in Range" to make sure they were all gone
                            It didnt affect units but if walls or other tile items were caught in the crossfire their cost was set to 1 and so I could walk onto them.
                            So instead I decided to add two arrays into my tile base (VectorIndex and IntegerIndex)
                            During the "Add Viewport Terrain to Arrays" linetrace I cast to the hit actor to see if it was the tile_base if so add the vector and index value to appropriate arrays.

                            When It came to removing the base I didnt bother getting indexes in range, Instead I looped through the integer array of the base, using the element value (indexes of the base) and changing the cost to 1 before the actor was deleted.
                            Its probably not that efficient so if you have any suggestions or feedback id appreciate it, but atleast this way It alters the indexes in question only and not any others surrounding the tile.

                            Edit: Thinking about it, I just needed the IntegerIndex array
                            Last edited by LDodds; 09-07-2016, 06:27 PM.

                            Comment


                              Good to hear that it worked! As you found out it will not affect walkability when it comes to moving into tiles occupied by other pawns. All it modifies are the edge costs between tiles, and pathfinding does a check independent of edge costs for pawns blocking tiles. But as you also noticed, any and all tiles in the affected area will become connected to all surrounding tiles, meaning that units might be able to walk inside walls and such which are caught in the collateral. The way you have solved it seems smart and sensible. As a rule of thumb it is a good idea to do as many calculations you are able to before the game starts. Your solution sounds like it should be pretty efficient, and looping through small arrays contained in the bases during gameplay should not be a problem at all.
                              The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                              Comment


                                I've sent a new update to Epic updating the toolkit to UE4.13. This is not the big feature update I'm working on, but does introduce several minor fixes. The biggest change by far is that ATBTT now supports blueprint nativization. If enabled when packaging this causes massive improvements in the performance of some blueprint. I'm talking 50 times(!) quicker in some cases. Hope you guys like the changes!

                                From the changelog in the second post of this thread:

                                v1.61 (being processed by Epic)
                                • UE4.13 support.
                                • Now supports blueprint nativization causing massive performance improvements when packaging.
                                • Custom Pathfinding types were not working in AI controller. This has been fixed.
                                • Spawn Unit and Move Unit on Grid functions now take into account the location of the grid manager if it is not at 0,0,0.
                                • The blueprint name for the sea-monster head in the 2D game example was too long and caused issues when packaging. Name has been shortened.
                                • Pathfinding per tick caused issues for child actors based on BP_GridManager. AI controller has been altered to not use the per tick function by default. Using it should still not cause any issues if using the BP_GridManager parent blueprint.
                                • Walls in the heightmap example were not turning translucent on mouse over as intended. This has been fixed.
                                • Free roam mode now takes into account custom pathfinding.
                                • Red "tiles in range" markers no longer appear under the current unit.
                                • Changed the function for determining if the game is over once only one faction remains. This still causes problems after nativization (see known issues above) and is thus disabled by default at the moment, though can be activated by setting nativization to false in BP_GridManager.
                                • All tiles now cast shadows as if static by default, improving performance.
                                The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                                Comment

                                Working...
                                X