Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    I was just wondering by watching the blueprint and without read the side note
    Probably I will use a similar function to spawn units after a network match has been successfully created, and also it could be an help for a "spawn minion"-like skill for my troops.

    As I promised to Monokkel, when I will collect some working code for multiplayer implementation with GameSparks I will post here
    Fantasy Turn-Based Tactical Game
    STEAM: https://store.steampowered.com/app/9...Arcane_Legacy/
    IG: https://www.instagram.com/arcanelegacyofficial/
    FB: https://www.facebook.com/ArcaneLegacy/
    WEB: http://www.arcanelegacy.com

    Comment


      Originally posted by Wisdom-HELLy View Post
      I was just wondering by watching the blueprint and without read the side note
      Probably I will use a similar function to spawn units after a network match has been successfully created, and also it could be an help for a "spawn minion"-like skill for my troops.

      As I promised to Monokkel, when I will collect some working code for multiplayer implementation with GameSparks I will post here
      That's exactly how I am using it

      Select Unit/s in UI -> Spawn Units to grid at specified placement -> Allow abilities to spawn minions.

      Comment


        In the blueprint for spawning units I sent to isthisbad some weeks ago there was also a part that added the unit to the initiative order array. This was a work in progress of a function I'll be including in the next update, where I will also include some other utility functions.

        I'm excited to hear that you're still working on the multiplayer implementation, Wisdom_HELLy! Can't wait to see what you come up with
        The Advanced Turn Based Tile Toolkit (Marketplace page - Support thread - Discord)

        Comment


          Hey there, sorry if this has been previously brought up but im wondering how to spawn units into the game without placing them in the level first?
          Like choosing what units you want before game starts and then spawning in
          I have tried this way but the unit can be interacted with or moved,
          Click image for larger version

Name:	Screenshot 2015-08-29 14.53.12.png
Views:	1
Size:	156.4 KB
ID:	1084659

          Comment


            Hey LDodds. That same question was asked on the previous page of this thread, where isthisbad pasted a modified version of a function I sent him some weeks ago for doing just this. I'm finally back home, though, so I can finally post my own current version. Here is the WIP function for spawning units at runtime (BlueprintUE link):

            Click image for larger version

Name:	iS2Ys4a.png
Views:	1
Size:	253.1 KB
ID:	1084669

            It still has a few small issues, but it's mostly complete. I'll explain what it does. First it spawns an actor of the Unit_Parent class (the specific one is specified outside the function) at a certain location. The user can choose to either spawn the unit at an index or a transform. If transform is selected the location of this transform is first run back and forth through the VectorToIndex macro and the Vector Field Array to return the location of the closest grid cell center to the transform entered (don't want to spawn the unit between two tiles). Then the index value of the actor is set to the index of the tile it is spawned on. After this the unit is added to the Pawn Actor array and its faction to the pawn array, both at the index of the tile it was spawned. Lastly it is added to the initiative order, or it will never be selected. This always adds the spawned unit to last in initiative, and might cause issues if you allow switching between units (the default toolkit assumes players and enemies will have distinct turns, which might be altered if you alternate adding enemy and player units).

            The way you have done it has a few issues, and I'll point them out so you can understand the inner workings of the toolkit better. When you add the unit to the pawn actor array, what you are doing is increasing the size of the pawn actor array by one by adding the unit to the end of it. The Pawn Actor array is the size of the grid with each index representing a grid cell, so if you add a unit to the end of it it will be placed at the last tile index +1, outside the bounds of the map. Instead you should use the Set Array Element node and set the index corresponding to the unit's location. "Has acted this turn" defaults to false, and so you do not need to set this to false when spawning a unit. Place actor at anchor and ignore snap to custom grid are variables that only have an effect when you're working on the game in the viewport, and not when you're actually playing the game, so modifying these at runtime serves no purpose. Lastly if you always want the max move of the spawned units to be 4 you would be better off modifying the default value of this variable in the unit's own blueprint.

            I hope this helps you with your problem. And congratulations on reaching your Kickstarter goal
            The Advanced Turn Based Tile Toolkit (Marketplace page - Support thread - Discord)

            Comment


              Awesome this really helps
              Thanks for taking the time to explain it all
              Yeah im really happy it got funded, now iv just got to work hard towards an amazing game!

              Comment


                Hey there, Im starting to implement my AI and change whats currently there to suit my game.
                Thought I would post it up here incase other people are wondering how to do the same/similar things.
                There are a few things I would like to cover at some point (Making AI search for things other then a player, Factions that can wander around without attacking player, Multiple different factions on one map)
                For now though I would like to sort out the former.
                I have set up a basic pick up duplicated from a hex tile, It works as when a unit walks over it, it randoms a number between 1 and 3, depending on that number you get +1 to one of your resources.
                I would like to set it up so the AI would also look out for these tiles and go to them if they are closer then the player/if they arent attacking the player.
                From looking at the AI controller, iv determined (ish) that I would need to either: Add in some extra functionality to Pathfinding, Find Tiles In Range or adding more variables to the pathfinding struct to take specific tiles into account.
                How far off am i?
                Thanks

                Comment


                  Hey LDodds; Probably the best thing you can do is add a boolean check to the Tile_Parent, something like 'Has Consumable?', and set it to true if it contains one. Then after the Find Tiles In Range check that you are doing in the ATBTT_AI_Controller, you can loop through all of those tiles and check if it 'Has Consumable?' and check if the Tile 'Distance' is shorter/further from the closest/furthest Enemy Faction by looking through the Pawns in Sight Array or Reachable Pawns Array.
                  Last edited by EricCorso; 08-31-2015, 04:02 PM.

                  Comment


                    @isthisbad: that would be a good soluting, but unfortunately the Tile_Parent actors are not stored in any grid sized arrays, so you cannot find them by using find tiles in range. For your solution you would need to look at every Tile_Parent actor in the level and compare its index to all the indexes outputted from the Find Tiles in Range function, which is not very efficient. I know it sounds like you should find specific tile actors when you use "Find Tiles in Range", but what you're really finding are tile indexes. The way the toolkit works currently there are other solutions that would be better. What I'll be suggesting LDodds should do is still pretty close to what you're suggesting.

                    @LDodds: You're on the right track. There are of course many different ways to do this, and which is best will depend on a lot of factors. When searching for enemy units to attack the toolkit does this in the Pathfinding function, adding units to an array every time a unit is found on a reachable tile. Then in ATBTT_AIController the AI looks at all these units and finds the unit of faction player with the lowest health.

                    I would not do the same thing for your resource tiles. This would be have to be done in the innermost pathfinding functions, and adding to these is a quick way to slow pathfinding down considerable. Instead I would create a new child actor of Tile_Parent for your resource tile. After pathfinding I would look at all actors of this class in your level and check the indexes of CanMoveToArray (in BP_GridManager) corresponding to the index variables of the actors. If these indexes have costs higher than 0 it means they can be reached (you should also check that PawnArray on that index is empty).

                    I would then store all such candidates in an array to compare them later on. In ATBTT_AIController you can use a function similar to the one I use for finding the unit with the lowest health for finding the resource tile with the lowest move cost. You could then compare this value with the move cost of the CanMoveTo Array cost of the index of the target pawn, and move to it if it's lower (if this is how you want the AI to act. I'm not entirely clear on what conditions you want for the AI to decide against attacking).

                    Hope that helps as a start. This is a bit tricky to accomplish, so feel free to ask for clarification.
                    The Advanced Turn Based Tile Toolkit (Marketplace page - Support thread - Discord)

                    Comment


                      Hey there, thanks for the feedback but yes as you suspected I do have some questions.
                      Am I to be doing this in the AI controller or Grid Manager after Pathfinding?
                      I have created a child as you suggested and moved the tile functionality into there.
                      After Pathfinding I call a Get All Actors Of Class - Tile_Hex_RandomResource.
                      This is the bit im less sure about, am I dragging off a GridManagerRef and getting the CanMoveToArray?
                      Well anyway I cant see a way to get the indexes of the Array or the Tiles thats where im currently stuck.
                      Click image for larger version

Name:	Screenshot 2015-08-31 22.54.26.png
Views:	1
Size:	195.7 KB
ID:	1086767

                      Comment


                        @Monokkel: Yeah that's kind of what I meant.. Use the Tiles in Range Array to 'Get' the Tile Index through Find all Actors of Class Tile_Parent; It has been a long day of messing around with Tile Index/Distance to get custom Attack Markers working, so Find Tiles In Range is on the brain lol

                        Comment


                          @LDodds: I think Monokkel was referring more to doing something like this;
                          (Replacing Tile_Parent class reference to your Tile_Hex_RandomResource Class)

                          Click image for larger version

Name:	check_consumable_tiles.JPG
Views:	1
Size:	199.4 KB
ID:	1086768

                          Once the Array is created, you can then do something similar to his Make Choice Array Function where you would pass in the 'Consumable Array' instead of the Reachable Pawn Array.

                          Hope this helps

                          Edit:
                          You will want to Clear the 'Consumable Array' before looping through all of the actors found, because you wouldn't want it to add to what is already in it from the previous pawns turn, only on the current pawns turn.
                          Last edited by EricCorso; 08-31-2015, 07:46 PM.

                          Comment


                            Thank you very much
                            I will start implementing this now

                            Comment


                              Okay done some tweaking now, could you look over it please?
                              Right now AI still doesnt move to resources if they are closer but im guessing I havent added that functionality in the event graph yet/correctly.
                              Instead of moving to the player, one of my AI punched the air ?
                              Click image for larger version

Name:	Screenshot 2015-09-01 00.27.51.png
Views:	1
Size:	109.7 KB
ID:	1086769
                              Click image for larger version

Name:	Screenshot 2015-09-01 00.27.13.png
Views:	1
Size:	149.8 KB
ID:	1086770

                              Comment


                                Just to add to what I posted before; You will want to Clear the Resource Array before looping through all of the actors found, because you wouldn't want it to add to what is already in it from the previous pawns turn, only on the current pawns turn.

                                I think the issue you are having here is that you are also using the Make Choice Array in the wrong context and it is trying to attack the Resource Index tile Instead of a Pawn (which it was intended for). The Branch check for 'Is the best target pawn in attack range?' will always be True and it will always move to it and attempt to attack.

                                You need to include your own logic; Checking first if the lowest Resource Index is less than the 'Pawn with Lowest Health from Choice Array' Index. If True, move to the Resource Index, if False, connect to the Branch for 'Is the best target pawn in attack range?'.

                                Comment

                                Working...
                                X