Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Regarding the skill system, I've also made a Skill Parent blueprint and created all specific skills with blueprints based on the parent.
    My implementation is based on 4 different steps:

    1) Skill Target Selection: this event is called by pressing a button in the HUD. It simply applies a boolean IsSkillSelectingTarget to TRUE and, inside the hover part of the player controller, just changes the tile selection crosshair with a custom implementation or custom mesh. For example, for the skill "Conefire", I draw a cone light upon the grid. The cone light is refreshed and repainted every time I hover to a different tile.

    2) Skill Target Selected: Bound to a valid mouse click (skill target must be valid) just opens a Gate component into the skill parent which activates the "Skill Target Activation" event. The gate is "ticked" by the tick event inside the Skill Parent

    3) Skill Activation: activate and execute the skill. For conefire, for example, I spawn a cone of fire with a particle system, then I check if there are enemy pawn inside the cone using a MultiSphere collision system (two foreach loops to scan the left part and the right part of the cone). For every collision, ignoring the grid manager itself, self, and other items or props of the map, it calls the receive damage event. When the loop is completed, it calls the last event: Skill Deactivation

    4) Skill Deactivation: set to False the isSkillTargetSelecting flag, ends the particle system emission and, if AP are finished, ends the turn.

    I don't think my system is genius, but helps to me to easily add a skill, its target selection mesh and its effect. I just bet that your system is more refined
    Last edited by Wisdom-HELLy; 11-04-2016, 12:35 PM.
    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


      Thanks for giving a thorough explanation. It seems like there are many similarities to our solutions, though I'm wondering where exactly you are running the code relevant for each skill. Are you spawning skill actors in the world and running the nodes contained in the skill actor or are you doing something different?

      1) The UI consists of three nested widgets, where the lowest ones in the hierarchy are buttons for selecting the skills. These are chosen at the start of each unit's turn by looping through the skills array, which is an array of Skill classes contained in the unit. The icons for each skill is contained in a Button Style variable in each skill actor.

      2) When a skill button is clicked an actor from that skill class is spawned in the world at the location of the current unit and the Activate Skill event is run on that skill actor.

      3) The Activate Skill sets things up for the skill more generally and displays to the player what can be done. For instance the laser skill runs Find Tiles in Range to display any possible targets.

      4) Skills generally have an On Input Click event to handle player interaction that functions similarly to this event in ATBTT_PlayerController.

      5) Some skills are more like passive effects, though, and are stored in an Active Effects array of skill actors in the relevant unit. This array is checked every time a unit activates or ends its turn to see if any of them should do something/be destroyed.

      6) After a skill has been used and it has run through all the relevant node it calls the Deactivate Skill event, which removes it from any arrays it is stored in and destroys the actor.

      Worth noting is that the Activate Skill event contains its own nodes for when AI units activate its skill, which is similar to the nodes for finding and choosing a target in ATBTT_AI_Controller. The end result is that the event graphs of the Player and AI Controllers are almost never used and that the stuff that was previously handled by these blueprints are handled by the various skill blueprints in a much more modular fashion. I'm uncertain if I will be converting the entire toolkit to using this method or to contain it within an example map and example child actors. It will be the latter for the next update, but if the feedback is good I might make this solution the standard for the update after.

      Hope I explained things clearly. If you have any questions or ideas for improvements let me know
      Advanced Turn Based Tile Toolkit (Marketplace - Support)

      Dungeon Crawler Toolkit (Marketplace - Support)

      Discord

      Comment


        Regarding your first question:

        At game start, I check the GameSparks ID of the connected player. Then, I take the associated pawn ID array (user can select his troops on the menu before the game start) by querying the cloud backend.
        After that, I'm able to spawn in the first phase of the GameMode (all at location 0,0,0: it is not important to place a skill in a particular point) all the skills linked to the in-game troops.
        In this way, I don't have to spawn additional skills in runtime: I already have all the possible skill spawned on the Map.

        The general code is running on the parent (Skill parent), as I have explained on the above post, meanwhile the particular implementation (for example, the cone of fire implementation) is running on the skill blueprints based on the parent.

        Regarding the passive effect skills, in my case I have created another Parent blueprint: Altered Status Parent. An altered status is whatever influences the pawn stats turn by turn (ex. Poison is an altered status that removes 2HP every turn start). I've implemented a cycle through the active altered status in the GameMode after "Choose Next Pawn" where I decrement by one the duration of the altered status and I apply the effect, until it's over.
        So, basically I've separated all the active skills (the ones you need to activate with a target selection) from the passive abilities and/or altered effects.

        Regarding the arrays: I've also created a Skills Array and an Altered Status Array inside the Unit Parent blueprint.

        Anyway, I fully understood your six implementation points. I think that our skill systems share a lot of similitudes.
        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


          Thanks for clearing things up. Seems like there are indeed a lot of similarities. I'll be looking forward to hearing your thoughts when I'm done with the update.
          Advanced Turn Based Tile Toolkit (Marketplace - Support)

          Dungeon Crawler Toolkit (Marketplace - Support)

          Discord

          Comment


            Hi,

            I noticed a few people mentioned using GameSparks with your toolkit earlier in the thread so I thought I'd pop in and offer some support from our end. We've just added Real Time support to our Unreal SDK. A guide on this can be found here. If anyone plans to use GameSparks with this toolkit and runs into any problems we'll be happy to help. We have a dedicated support page here if you guys don't want to clog up the thread

            Thanks !
            Liam

            Comment


              Thanks for sopping by, Liam. GameSparks looks like a great platform and I'll surely look into it when I implement networked multiplayer somewhere down the line.
              Advanced Turn Based Tile Toolkit (Marketplace - Support)

              Dungeon Crawler Toolkit (Marketplace - Support)

              Discord

              Comment


                Hi there!

                My name is Hendre van der Walt. I bought your Advanced Turn-Based Toolkit and it's incredible! The amount of work you put into is absolutely astounding.

                The game that I am looking to develop with the toolkit needs to follow a control scheme similar to a game called Duelyst. This is basically what it needs to do:

                - There is no initiative order, but rather that you select each unit that you want to move.
                - After a unit has moved, it can attack or choose not to.
                - The unit does not need to move before it can attack.
                - If the unit hasn't attacked this turn and the player selects and moves another unit, they can go back to the first unit and still perform that unit's attack.
                - Turns end when the player decides to end it, not based on whether they still have units that haven't performed any actions this turn.

                I think that's the gist of it. Any advice that you can provide as to how I would achieve this would be greatly appreciated!

                Thank you for making the toolkit and I look forward to hearing from you!

                Regards

                Comment


                  UE4.14 is out! I have updated the toolkit to be compatible and sent a new version to Epic which should be available in the launcher soon. Until then there is almost nothing you need to change if you want to use the 4.13 version of ATBTT with UE4.14. The only issue I found was that the materials for the tilemaps in Content/AdvancedTurnBasedTileToolkit/Maps/2D_Game_Example/Tilemaps have been set to none. If you want to play my 2D game example in a 4.13 ATBTT project opened in UE4.14 you need to set the materials of the tilemaps to MaskedUnlitSpriteMaterial. There, that's it!

                  [MENTION=57462]DarkRa88iT[/MENTION]: Hello! I'm glad you're having fun with the toolkit. I've played a bit of Duelist and it is not very difficult to get ATBTT to follow a similar control scheme. Before going into how to change the toolkit to work similarly to Duelyst I'll quickly describe how things work in ATBTT by default:

                  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.

                  Also by default HasActedThisTurn is set to true whether a unit moves and attacks, attacks or just moves, so if you have done any action with the current unit before switching you will not be able to switch back to it later.

                  With all this in mind I will tell you how to achieve a control scheme similar to Duelyst. This also assumes that units of different factions act one faction after the next (e.g. all units of one faction having higher initiative values than all units of the next faction and so on).

                  First in ATBTT_GameMode you will want to prevent the current unit to be activated automatically. Also we set Local Current Unit in ATBTT_PlayerController to be false. Normally this would be identical to Current Pawn in ATBTT_GameMode (I see that I need to do some cleanup on my naming conventions: P ) and is just there to prevent unnecessary casting. We can however exploit this so that there is a current unit in ATBTT_GameMode, but that the player controller does not act as if there is currently one. Also we set the current marker to invisible.

                  At the very right end of the Event Graph of ATBTT_GameMode:
                  Click image for larger version

Name:	0BTdS0C.png
Views:	1
Size:	126.7 KB
ID:	1118408

                  Then we make a small change to the event graph of ATBTT_PlayerController so that the current unit does not get Has Acted This Turn set to true if it has only moved and not attacked. Just skip this at the beginning of the Initialize Movement - Step 2 comment box:

                  Click image for larger version

Name:	qK5XyxY.png
Views:	1
Size:	121.0 KB
ID:	1118412

                  Instead we add a new node setting Has Acted This Turn to true when End Unit Turn is called:

                  Click image for larger version

Name:	Ker9RVO.png
Views:	1
Size:	130.9 KB
ID:	1118413

                  In addition we do a small change in the nodes just to the right of Touch Input where we decide what action should be executed depending on the faction of a clicked unit. Here we check the faction of the clicked unit up against the faction of the current unit and not the local current unit. This is to prevent a different chain of events from firing when clicking the "current unit" when the player has not actually selected a unit yet.

                  Click image for larger version

Name:	9gvwEco.png
Views:	1
Size:	207.7 KB
ID:	1118418

                  Also we want to make the current pawn marker visible when we actually activate a unit:

                  Click image for larger version

Name:	98pyOri.png
Views:	1
Size:	164.3 KB
ID:	1118419

                  Now for the most complicated step we want to add the option of ending the turn for the entire current faction by pressing an End Turn button in the UI. First we create a new function in ATBTT_GameMode that loops through all units in the initiative array and puts each of them at the back of the initiative order unit it finds a unit of a different faction to the current unit. When one such unit is found we end the turn of the unit before this one as normal so that the following unit is activated normally.

                  Click image for larger version

Name:	1wF6vRP.png
Views:	1
Size:	235.0 KB
ID:	1118414

                  Then create a button in HUD_Faction_Turn. Add an OnClicked event to it and have this call our new Skip All Units Of Current Faction function in ATBTT_GameMode:

                  Click image for larger version

Name:	LiMpqzH.png
Views:	1
Size:	69.5 KB
ID:	1118417

                  Also if you want to have a static camera like in Duelyst you might want to set EnableFollowCam to false in BP_GridCamera. If not then you want to prevent Follow Cam from activating when it is the Player's turn so that the camera does not follow a unit that has not actually been activated yet. This can be done in ATBTT_GameMode like so:

                  Click image for larger version

Name:	H7JkBLd.png
Views:	1
Size:	101.0 KB
ID:	1118420

                  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
                  Attached Files
                  Advanced Turn Based Tile Toolkit (Marketplace - Support)

                  Dungeon Crawler Toolkit (Marketplace - Support)

                  Discord

                  Comment


                    Hi Knut
                    I just bought the toolkit and am very impressed. Also, looking through this thread I see you give excellent feedback and help.
                    Like all here I'm sure, I have plans for a game, but being a programming amateure I figured Unreal was the way to go.
                    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 want 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
                    Mark

                    Comment


                      Thank you so much for the insanely detailed answer! I was able to follow along and perform all of the steps. I am, however, running into some errors which I believe is messing up the pawn behavior. This is the error:

                      Click image for larger version

Name:	ATBTT Error.PNG
Views:	1
Size:	22.1 KB
ID:	1118467

                      The 'Branch' in question is this one:

                      Click image for larger version

Name:	ATBTT Problem Branch.PNG
Views:	1
Size:	105.5 KB
ID:	1118468

                      I know 'Accessed None' errors usually come from variables or objects not being properly referenced, but with all the reference variables that you have in place, that shouldn't happen. Plus, the area where this error is occurring now isn't even one of the pieces that I changed following your instructions. Could I have just messed something up or are you getting this error too?

                      As per usual, any advice would be greatly appreciated!

                      Comment


                        I might have forgotten to include one small change I made. I cannot check until I'm back from work, but try getting the faction of the current unit from game mode instead of local current unit at the part of the graph directly to the left of your screenshot. See if that fixes the problem.
                        Advanced Turn Based Tile Toolkit (Marketplace - Support)

                        Dungeon Crawler Toolkit (Marketplace - Support)

                        Discord

                        Comment


                          Thank you! I'll give it try and let you know.

                          Comment


                            Hey dude, this toolkit is pretty sick. I just started playing with it a couple days ago. I'm still trying to get a handle on these blueprints, but right now I'm specifically trying to change how it displays squares that can be attacked by a unit. Right now unless there's a unit specifically within another unit's movement range it won't highlight attackable squares with red, when you select it all the edges of its move range are empty, and it's not until you finish moving a unit you can see the units it can attack.

                            I'd like to know where I should be looking if I want it to function like this, where if you click a unit it shows all squares they can possibly attack:

                            e: nvm found it, still would like to know how to show it for enemies tho



                            And also how to make it so the same function is available when clicking on an enemy:

                            Last edited by Envieous; 11-17-2016, 02:05 AM.
                            Anime Shading Model - Twitter

                            Comment


                              Glad you figured it out, Selentic! Let me know if you have any additional questions. For anyone else wondering what you need to do is to either set Find Only Pawns to False for the Find Tiles In Range function in the Begin Player Turn section of ATBTT_PlayerController's Event Graph. Alternately set Show All Possible Visible Tiles to true for your units if you want to achieve a result like the one above, for displaying all tiles that can be attacked by a unit when its movement is taken into account.

                              Awesome pixel art, by the way! Have you drawn it yourself?
                              Advanced Turn Based Tile Toolkit (Marketplace - Support)

                              Dungeon Crawler Toolkit (Marketplace - Support)

                              Discord

                              Comment


                                Originally posted by Monokkel View Post
                                Glad you figured it out, Selentic! Let me know if you have any additional questions. For anyone else wondering what you need to do is to either set Find Only Pawns to False for the Find Tiles In Range function in the Begin Player Turn section of ATBTT_PlayerController's Event Graph. Alternately set Show All Possible Visible Tiles to true for your units if you want to achieve a result like the one above, for displaying all tiles that can be attacked by a unit when its movement is taken into account.

                                Awesome pixel art, by the way! Have you drawn it yourself?
                                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 )

                                Also no, those screenshots are from Fire Emblem: Sacred stones which is just a quality example of the mechanics im looking for
                                Last edited by Envieous; 11-17-2016, 08:42 PM.
                                Anime Shading Model - Twitter

                                Comment

                                Working...
                                X