Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Originally posted by Asheron View Post

    This looks great as it's something that I have had on my list for awhile, albeit lower priority than others. What is your spline point type set to? Linear?
    Thanks, I think it is a promising start. The frame is actually not a continuous spline. That is something I tried to do for the longest time, but I was not able to do this in a performant way. The frame is actually made up of individual two-point spline meshes: long ones within the tiles and short ones connecting them. The tangents for each of these points are zeroed out, so in this case I might as well use simple, straight instanced static meshes. The spline points are set to linear, but that does not matter at the moment. The fact that the spline meshes are not informed by an underlying, connected spline should not be an issue in itself, but it does make it more difficult to figure out the appropriate tangents to get them to line up, which is what I'm currently struggling with.
    The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

    Comment


      Today's work: Finally got big units working for hexagonal grids. The combination of hex grid math and the algorithms for making big unit walkability arrays was pretty tough to work with, but I got it done. The big unit implementation is pretty close to final now. There are some functions that can be made more "elegant", but I think I've at least got it about as as performant as it is going to get.

      Beware of the hexagonal thicc bois. Unless you're on the other side of a wall without a huge gap, I guess.

      The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

      Comment


        Originally posted by Monokkel View Post
        RC_Malokai : Ok, so I'm trying to wrap my head around this. In the screenshots you pasted you are printing values from OwningUnit to the screen in screenshots 5 and 6. Are these the ones that are printing incorrect values?
        Yes, to be more precise its more like this (see pic #1)

        Originally posted by Monokkel View Post
        RC_Malokai : Do you run the exact same nodes for previewing the actions and for actually performing the actions?
        Yes.

        Originally posted by Monokkel View Post
        RC_Malokai : Have you checked that the value of OwningUnit is actually valid? Use the isValid node to test this out. If it is valid, make sure that the same actor ID is returned in all cases. Print the actor ID to the screen for both the place you got it working correctly and the place where it returns 0. Are you getting the same actor?
        ID is correct. Its valid. (see pic #2 and 3)


        Originally posted by Monokkel View Post
        RC_Malokai : Check if this could be the culprit in some of these cases and try testing with delay nodes to see if this changes anything. Those are the thoughts I have at the moment.
        Thing is , that we don't spawn units to do this.We add/remove from array & map. (see pic #4-5-6) , as i mentioned before we reversed the RemoveFromGame function.

        Attached Files

        Comment


          RC_Malokai : Ok, still not sure what is happening here, but here is something you can try to help you figure it out. For the variables you are changing that are reset, try setting one of them to replication OnRepNotify. Then in the OnRepNotify event add a branch that checks whether the value is true. If it is true add a print string (or any arbitrary node) where you add a break point. Run your game until you hit the break point, and then look at the call stack and step through the execution chain to find out exactly when the variable is reset. This should hopefully lead you to the cause of the variable resetting.
          The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

          Comment


            Hi. Units have "Initiative" attribute. I wonder if it would be hard to make that this value would not only decide who acts first but also how many times the unit would act before the next unit.
            Like if one unit1 has initiative value of 0.21, unit2 of 0.51 so the action order would look like this:

            Unit1 (0.21) -> Unit1 (0.42) -> Unit2 (0.51) -> Unit1 (0.63) and so on. It was in Heroes there units head "speed' attributes and unit with speed 7 moved twice before unit with "speed" 15.

            Comment


              Originally posted by SimBuz View Post
              Hi. Units have "Initiative" attribute. I wonder if it would be hard to make that this value would not only decide who acts first but also how many times the unit would act before the next unit.
              Like if one unit1 has initiative value of 0.21, unit2 of 0.51 so the action order would look like this:

              Unit1 (0.21) -> Unit1 (0.42) -> Unit2 (0.51) -> Unit1 (0.63) and so on. It was in Heroes there units head "speed' attributes and unit with speed 7 moved twice before unit with "speed" 15.
              Hey SimBuz, that is actually pretty easy to do. Since the initiative order is informed by a simple array you can just increase the initiative value of the current unit at the end of its turn, loop through the initiative array until you find a unit with higher initiative and insert it at that index. I tried it out and it works great. Here are the precise steps:

              1) Add a new CurrentInitiative float variable to BP_Unit.

              2) Modify the SortUnitsInInitiativeOrder function in BP_TurnManager so that the units with the lowest initiative go first. Also set the CurrentInitiative value of each unit at the start of the game equal to its regular initiative value (this can be done anywhere, but I do it in the same function here):



              3) Override MoveActiveUnitInInitiative (also in BP_TurnManager), which is called at the end of a unit's turn, so that its current initiative is increased by its initiative value and it is inserted at the index of the first unit we find with a higher initiative than this new value. If no such units are found add the unit to the end:



              That is it, really. Have fun!

              Note that this way of setting it up means that there will never really be a new "turn", but initiative will increase constantly for all units until combat is over. If this is not desirable you can always add a check at the end of the turn to see if the initiative of the current unit will hit a certain threshold and if so reset the current initiative of all units.
              The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

              Comment


                Originally posted by Monokkel View Post
                RC_Malokai : Ok, still not sure what is happening here, but here is something you can try to help you figure it out. For the variables you are changing that are reset, try setting one of them to replication OnRepNotify. Then in the OnRepNotify event add a branch that checks whether the value is true. If it is true add a print string (or any arbitrary node) where you add a break point. Run your game until you hit the break point, and then look at the call stack and step through the execution chain to find out exactly when the variable is reset. This should hopefully lead you to the cause of the variable resetting.
                Well we found where it happens , its part of our code here during the end turn(see attachment).

                We cant figure out why we cant modify them both after its "reset" , it feels like we loose access to it after new turn starts.

                Attached Files

                Comment



                  Originally posted by RC_Malokai View Post

                  Well we found where it happens , its part of our code here during the end turn(see attachment).

                  We cant figure out why we cant modify them both after its "reset" , it feels like we loose access to it after new turn starts.
                  Well, the active unit reference is set to blank as part of the EndTurn event. Could that be affecting things?

                  In other news I revisited the the FreeRoam ability today. I've set it up so that movement can be cancelled mid-movement to allow for non turn-based movement that still uses the grid for pathfinding. Check it out:



                  Also I've changed the macro I use within units and abilties to check whether the actor is owned by a specific player controller. I looked into the suggestion by Wisdom-HELLy and did something similar. I'm using the unique player id contained within the player state and assign this to a replicated variable in all units based on which player is the owner. Since the player state ID is replicated to all clients and easily accessible from anywhere through the default UE4 singleton classes this works great and is much less hacky than my previous solutiuon. Like Wisdom's solution this also makes it much easier to work with client-side objects like UI widgets when they need access to replicated actors.
                  Last edited by Monokkel; 07-18-2018, 11:10 AM.
                  The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                  Comment


                    Okay, so UE4.20 is out and ATBTT converts fine, with one major exeption. Because of a bug in 4.20 arrays cannot be sent from servers through multicast events to clients. What this means is that replication no longer works for the entire action system (which passes an array of actions to clients), which basically means replication breaks entirely. Thankfully after some trial and error I was able to find a workaround. If you are working on a project using the 4.19 version of 4.20 and want to convert your project, here is how you need to change the event graph of BP_ActionManager:



                    Note that the events are multicast and need to be set to reliable.

                    I have sent a bug report of this to Epic. As soon as it is up on the bug tracker I will post a link here so people can vote on it if they want it fixed sooner.

                    This fix is included in the new version I have sent to Epic along with a few of other bug fixes unrelated to the update by Epic (meaning these bugs also exist in the 4.19 version). One is simply that I forgot to turn the health bars in the 2D example visible. The second is that I had forgot to reconnect some nodes in the construction manager of BP_Unit, causing units not to be added to the grid when spawned (apologies to LDodds for me not realizing this when he asked how to add units to the grid in the new version). The last two were both reported by JinPengfei in this thread. The first is that multi-level grids did not work properly for rotated grids. The other was that adding tile actor's edges to the edge array did not work correctly for tiles placed on the edges of levels, causing them to remove connecting edges between the levels. Thanks a lot to JinPengfei for pointing these ones out. This is a pure bugfix-update, so none of the new features on my Trello have been included here.

                    I hope anyone reading this thread who encounters any bugs, weird unconnected nodes or typos can report them to me if you see them. The toolkit has become so feature packed now that it is very difficult to properly test for all combinations of things when updating the toolkit, so getting this sort of input is invaluable. As an added incentive, from now on if someone reports a bug I will add a thank you to that developer in the update note above the bug

                    Same goes for suggestions on how to improve the toolkit that I follow up on (like the improved OwnsUnit macro suggested by Wisdom-HELLy that will be in the next update).

                    Here is a shorter description of the fixes for the changelist:

                    v1.83 (19.07.18)
                    • Workaround in BP_ActionManager to get around UE4.20 bug of arrays not being passed to clients.
                    • Multi-level grids now work for rotated grids. (thanks to JinPengfei for reporting)
                    • Tile actors no longer remove incorrect edges between levels on multi-level grids. (thanks to JinPengfei for reporting)
                    • Health bars no longer hidden in HydrasLair map.
                    Last edited by Monokkel; 07-19-2018, 06:17 AM.
                    The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                    Comment


                      Originally posted by Monokkel View Post


                      Well, the active unit reference is set to blank as part of the EndTurn event. Could that be affecting things?
                      1)Well, i guess that its the case.
                      Seems to be the culprit.
                      Any suggestions how we can amend this ? (Also it will be helpful if you can pinpoint us to places it is being set to blank , is it only EndTurn event or other parts as well?)

                      We really need to access those variables dynamically



                      2) Also we have extra question that is related to making this feature happen :

                      We need a way to manipulate decals to come out of selected (clicked on) arbitrary tile index without actually moving the unit , or having the unit already on this tile and having to involve changing a turn (end/new turn)
                      Do you have any suggestion , what is the best way to approach this?

                      Comment


                        Ok, version 1.83 of the toolkit has been uploaded by Epic to the launcher. This version works with UE4.20. Check my last post for a description of the changes.

                        Originally posted by RC_Malokai View Post

                        1)Well, i guess that its the case.
                        Seems to be the culprit.
                        Any suggestions how we can amend this ? (Also it will be helpful if you can pinpoint us to places it is being set to blank , is it only EndTurn event or other parts as well?)

                        We really need to access those variables dynamically

                        I think the simplest solution, and safest if you want to make updating to future versions simpler, is to make a new variable separate from ActiveUnit. This way you can control when you want it altered/null without having to make changes to how the regular ActiveUnit variable is modified. I'm guessing you will generally want to set it to the same value as ActiveUnit when it is set to a reference, but not when ActiveUnit is set to null.

                        2) Also we have extra question that is related to making this feature happen :

                        We need a way to manipulate decals to come out of selected (clicked on) arbitrary tile index without actually moving the unit , or having the unit already on this tile and having to involve changing a turn (end/new turn)
                        Do you have any suggestion , what is the best way to approach this?
                        I'm not sure I fully understand the question. Do you want to spawn decals when clicking a tile? There is a function for that in BP_GridManager called SpawnTileMarkersAtLocations you can use for this. I don't understand what you mean regarding having a unit already on a tile and changing the turn. Are you talking about teleporting a unit to a tile and then ending the turn? Could you please explain a bit more in-depth?
                        The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                        Comment


                          Hey Knut,

                          currently wondering where the actual unit AI logic takes place?
                          Is it happening only within abilities? Or where can I see the logic for moving/attacking and so on?

                          Thanks in advance

                          Comment


                            Unreal engine bug report for the issue with using array inputs for multicast events is up on the issue tracker. It seems like Epic is making this a priority and the target fix is for 4.20.1, so that is good. I'd still encourage anyone here to vote on it to decrease the chance of it being backlogged. The issue can be found here.

                            Originally posted by RobinZinser View Post
                            Hey Knut,

                            currently wondering where the actual unit AI logic takes place?
                            Is it happening only within abilities? Or where can I see the logic for moving/attacking and so on?

                            Thanks in advance
                            Hi Robin, the AI logic happens almost solely within the abilities. The only exception is if you're using the ability system component from the advanced example map, in which case some minor stuff is done to compare the evaluation result from each ability and to generate cached arrays for pathfinding and tile safety estimation which are shared between abilities.

                            So to see the logic for moving and attacking I would recommend looking at BP_Ability_MoveAttack as well as the parent class BP_Ability. Look particularly at the AiActivate and AssesAbilityValue events.
                            The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                            Comment


                              Originally posted by Monokkel View Post
                              Ok, version 1.83 of the toolkit has been uploaded by Epic to the launcher. This version works with UE4.20. Check my last post for a description of the changes.



                              I'm not sure I fully understand the question. Do you want to spawn decals when clicking a tile? There is a function for that in BP_GridManager called SpawnTileMarkersAtLocations you can use for this. I don't understand what you mean regarding having a unit already on a tile and changing the turn. Are you talking about teleporting a unit to a tile and then ending the turn? Could you please explain a bit more in-depth?
                              Well ,thanks a lot we've were kinda blindsided and focused on the toolkit structure
                              Thanks for your help and support. I will come back if we will encounter any further problems , sorry if i'm not being very clear at describing the problem , the way we want to make toolkit work is pretty different from its default state so its hard to give you enough information without confusing you

                              Comment


                                Epic received and resolved the issue I reported on the same day! In the words of Civ V's science advisor: Now that's efficiency!



                                Originally posted by RC_Malokai View Post

                                Well ,thanks a lot we've were kinda blindsided and focused on the toolkit structure
                                Thanks for your help and support. I will come back if we will encounter any further problems , sorry if i'm not being very clear at describing the problem , the way we want to make toolkit work is pretty different from its default state so its hard to give you enough information without confusing you
                                Hope my comments still point you in the right direction, even if I didn't understand your issues completely
                                The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                                Comment

                                Working...
                                X