Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    #61
    Thanks Monokkel! That worked! Adding the extra casts was quick enough to do. Now I can focus on messing with the camera some more. Trying to make the cursor more free cam friendly.

    Comment


      #62
      Cool, thanks a ton!
      Hopefully your new update will be online soon.
      I've just done it quick and dirty way, I was wondering if rotation could be stored on grid generation, in fact tiles don't move.

      Thanks for the update! :-)

      Comment


        #63
        Originally posted by Gugenheimer View Post
        Thanks Monokkel! That worked! Adding the extra casts was quick enough to do. Now I can focus on messing with the camera some more. Trying to make the cursor more free cam friendly.
        Great that you managed to get it working, and good luck on the camera controls

        Originally posted by Oskarek15 View Post
        Cool, thanks a ton!
        Hopefully your new update will be online soon.
        I've just done it quick and dirty way, I was wondering if rotation could be stored on grid generation, in fact tiles don't move.

        Thanks for the update! :-)
        No, thank you After considering your solution of finding rotation based on tracing I did some experimentation with doing traces at startup to get info about the underlying terrain. Using traces and decals I've managed to have the grid conform to any underlying terrain, irrespective of tile placement, and have the displayed grid conform to said terrain. It's still a bit rough, but it looks promising:

        Click image for larger version

Name:	ghkuI85.jpg
Views:	1
Size:	47.2 KB
ID:	1067973
        The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

        Comment


          #64
          Wow! This is amazing!
          Great stuff Monokkel, can't wait for the new update!

          Comment


            #65
            First of all Geart work here. I have been clowning around with it for a few days.

            I have 2 newbie questions

            Is there any way to make the enemy pawn unable to know where the player pawn is. For ex: Ouy of the box If I place an object wall between the enemy and the player, the enemy will still always know where my player is. I wanted to try and create a stealth based prototype using turn based squares?

            Using this template is it possible to create nav meshs so that my Ai patrols certain areas on its turn ?

            Many thanks

            Comment


              #66
              Hi RugarEk, good to hear you're enjoying the toolkit, and I'm excited to see it used for a stealth game. The two things you want to accomplish should be pretty straightforward to implement.

              For enemies ignoring the player until they have seen them, the simplest thing to do is to create a new "Find Tiles in Range" node in front of all the AI logic, like this:

              Click image for larger version

Name:	UkttgRy.png
Views:	1
Size:	96.2 KB
ID:	1068101

              This way the AI won't activate if there is not a player within 10 tiles that is not blocked by terrain. You might want to change the hard number 10 to a new public variable housed in the Unit_Parent_BP instead. This works, but has a few weaknesses you might want to adress. Firstly, the AI will stop following the player if it loses sight again. You might therefore want to create another public variable (boolean) called "chase player" or something which is set to true once the AI sees the player, and is checked before the new nodes pictured above, bypassing them if it is set to true. Another possible issue, depending on what you're going for is that visibility will only be checked on the AI's turn. So if the player moves in front of the AI on his turn, but ends his movement outside of sight the AI will be none the wiser. There are a few ways you could fix this. The simplest would be calling range traces towards the player for each AI every few ticks while the player is moving. This becomes a real time element, so if you don't like this solution there are many examples of live line of sight solutions on this forum. Another possible problem is that the current find tiles in range does not take the rotation of the pawn into account. If this is important you could, after a trace has confirmed that a player pawn can be seen, check the look-at-rotation between the two pawns and compare it to the enemy pawn's current rotation. Depending on how close these are you could decide to decide that the player was not seen after all.

              As for patrolling there are certainly many ways to do this as well. One solution would be to create two new variables in Unit_BP_Parent: an array of integers you could call Patrol Index List and a simple integer possibly called Patrol Counter. In the Patrol Index List you could add all indexes you'd want the AI to patrol to in order (A simple way to find the index numbers of each tile is to drag a pawn or tile on it in the viewport and see what its index variable changes to). Then, when it's the AI's turn and "chase player" is set to false, have it do pathfinding and move to the index equaling the value of Patrol Counter. At the end of movement, increase Patrol Counter by one, unless it is equal to Patrol Index List length -1, in which case you reset Patrol Counter to 0.

              I hope these suggestions help, or that they have at least given you ideas to how you might solve it.
              Last edited by Monokkel; 03-10-2015, 02:41 PM.
              The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

              Comment


                #67
                Hi Monokkel,

                I've a further implementation question.
                My game requires that the pawn have a bunch of AP (action points) at every turn start. Player can use these AP to move their pawn, use objects/special abilities and attack other pawns.
                Your toolkit right now implement a bit different solution where you have two phases: the movement phase and the attack phase.

                In my game idea, if a pawn remains static it may, (if pawn stats allows him) for example, attack twice in a single turn.

                Where should I act to make such changes and not break entire toolkit functionalities?
                I know this question may be a little harder than other ones, but it will be great for me to have an answer.
                Last edited by Wisdom-HELLy; 03-11-2015, 10:04 AM.
                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


                  #68
                  It should actually be quite simple to add. There are of course many ways to do this, and it will depend a bit on what you want to accomplish. I will assume that you are trying to do something akin to the original Fallout games or Arcanum, where action points can be used to walk, and attacks can have varying action point costs. Say, you have 9 action points where you for example use 2 to move, 5 to attack with a shotgun and 2 to kick. Here’s one way to accomplish this:

                  I’d first create a new public integer variable for Unit_Parent_BP called “Max Action Points” so that different units can vary in this attribute, and that it can easily be modified from other blueprints. Also, create another called “current action points”. When a unit moves, subtract the length of the path holder array (minus one, since it includes the start index) from its current action points. When it attempts to attack, first call a branch which returns true if current action points is greater or equal to whatever action point cost the attack has. If it’s true, resolve the attack and subtract the cost from Current Action Points; if not, display “not enough action points” or whatever best gets the message across. At the start of each new turn make sure to again set current action points equal to Max Action Points.

                  Edit: Forgot one thing. With the current setup, turns automatically end after an attack is resolved, which would have to be changed. I would add a new branch at the end of movement checking if current action points are 0 and in that case call the End Turn function. You'd have to replace the End Turn function at the end of an attack with something similar. If there are still action points left after attacking you'd set Combat Mode to Choose attack (not sure if I'm using the exact names. I'm at work and don't have access to UE4) and call find tiles in range again. You'd have to implement a way for players to end their turn with remaining action points. Either a UI button or clicking their character during choose attack. Also if you'd want the player to be able to do the reverse: first attack, then move, it would take a bit more work. You'd have to call both find tiles in range and pathfinding at the same time at the start of each turn and rework the on tile clicked logic to reflect that these combat modes have been merged. I'm working on implementing this, actually, but that won't be for a couple of patches.
                  Last edited by Monokkel; 03-11-2015, 10:53 AM.
                  The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                  Comment


                    #69
                    Thanks for the answer, anyway by reading your answer I think that my previous question in this case was not too clear.
                    I think that the most difficult part is not to create and manage the logic that implement action points instead of toolkit's default behaviour, but instead to manage the pawn attack as an action to be used "on demand".

                    For example, I might want to attack first with my pawn: if the enemy pawn do not die, I will like to flee in cover behind the closest high wall.
                    Right now, for example, I cannot attack and then move because attack is the final phase of every turn.

                    I'm afraid that I have to "destroy" a lot of toolkit's basic logic in order to achieve that, and also I'm not very sure on "where" should I act for doing it safely in the grid manager.

                    Sorry for the confusing last question, I hope this time my question will be clearer.

                    Edit:
                    I saw that your latest post been edited with additional info, so you finally answered my question. Thank you
                    Last edited by Wisdom-HELLy; 03-11-2015, 11:03 AM.
                    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


                      #70
                      I suspect you begun replying to my post before I had written the edit (edit: and it seems I did the same thing), where I've adressed some of these questions. I will reiterate and expand upon what I wrote now that I better understand what you're asking:

                      Currently movement and attacking are kept in separate phases. Creating code that can change between these two are easy enough; just take a look at how it is done at the beginning of initiative when movement is called or at the end of movement when finding visible targets for attack is called. This switch can for example be bound to clicking/re-clicking a weapon icon.

                      If you want both modes to be available simultaneously you need to do some work, as I created the system to avoid calling both at once for performance reasons, and thus some of the logic is split into different modes. Now that I'm close to achieving efficient calculation of pathfinding and visibility over multiple ticks, calling both at once will not be a problem in the future, and I'll want to add the option to having a combined attack/move mode. Honestly, for most games the current system is fast enough to call both at once as it stands, but I want to make sure there is no perceivable lag for things like VR and mobiles.

                      If you'd rather want to be able to toggle between modes, like I describe above, that can be done a lot more easily. Like I said in the previous comment, call a branch at the end of attacking and movement and only call End Turn if current action points are 0. Include another option the player can select to call End Turn early.
                      Last edited by Monokkel; 03-11-2015, 11:19 AM.
                      The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                      Comment


                        #71
                        Hi Monokkel. Your toolkit is providing something that I've been trying to accomplish on and off since UE4 was released! And now that yours is done I'm glad you did instead it of me because it does so many little things I never would have thought of. It really is amazing, great work.

                        I would like to pick your brain on a couple things I'd like to do. For example, how would you go about building a floating tile dungeon like the one pictured below? Actually I have managed to do it, but right now I have to manually place a bunch of invisible walls to get the line of sight to work properly.


                        As you can see the walls don't allow line of sight to travel across corners though.



                        Personally, I would like to be able to build dungeons out of prefabbed groups of tiles and walls like this. My goal is to be able to just drop finished rooms and hallways down onto the grid manager and have it all just kind of link together, and I wanted to see if you might have any suggestions.




                        By the way, do you have any plans in the future to include larger than one tile units? For example a monster that takes up 2x1 tiles or 2x2 tiles?
                        Attached Files

                        Comment


                          #72
                          Looking good! Its great that you worked out breaking up loops with a tick. Did you just figure out how to break the loop over a tick or are there any good resources online? I haven't even begun to look into that, though I can't wait to start!

                          Originally posted by TychoVII View Post
                          I would like to pick your brain on a couple things I'd like to do. For example, how would you go about building a floating tile dungeon like the one pictured below?
                          Have you taken a look at the procedural room generation tutorial in the learn tab of the launcher? There are a few other procedural room/maze/etc projects about that might also give you some insight.
                          Map Generator 1.0
                          Map Generator 2.0
                          Map Generator 3.0

                          Comment


                            #73
                            Hi TychoVII. Glad to hear that my toolkit saved you work. Sight is blocked by whatever you place in the level that has range trace set to block in its collision properties. If there are no walls in the rooms you will thus be able to look into other rooms, enabling creating floating islands and such. You could always place invisible walls if you want to have the look of your first image.

                            For your second problem with the pawn not being able to look through corners, that's because you've placed the tiles on the inside of the floor tiles, which cause them to block the visibility tracing. If you place them on the tile outside instead, they will allow for vision across corners. However, this will also allow for vision through corners in the way depicted below. I'll be adding a pillar component in the next patch to fix this, though anything placed within or behind the corner, like an invisible wall, should do. I've also resized the walls and placed them a bit lower in the screenshot below, since the walls will seem to be floating if they are placed in thin air with their current scale and location. I'll be changing the wall mesh to make it more visually appealing in the future, though they are of course just placeholders.

                            Click image for larger version

Name:	GF0pcyi.png
Views:	1
Size:	174.6 KB
ID:	1068297

                            As for placing modular rooms, one way is to do it procedurally like Zeustiak is suggestion. This takes a bit of work, but I created the system with adding procedural generation later in mind, so it shouldn't be too hard to do. Just feed your procedural algorithm into an array the size of the map, then for each index in the array place the appropriate instanced static meshes in the level at locations found in the Vector Field Array. A much simpler solution, however, is to simply group the actors in a room together. Select them all in the viewport and press ctrl + G. Then click "place actor at anchor", and after that you can freely copy and paste rooms across your level that should snap to the grid. This will not give you the possibility of having saved rooms stored in a folder, however, and you would have to have a palette of rooms on one side of the level to construct your dungeon with, which you could copy to other levels. Unreal Engine used to have a feature called "make composite blueprint" that would allow you to save such configurations, but I can't seem to find it. Maybe it has been patched out? Does anyone here know?

                            Click image for larger version

Name:	XdOAmhG.png
Views:	1
Size:	445.9 KB
ID:	1068298

                            @Zeustiak: Thanks for stopping by I pretty much figured out breaking up loops on my own. I used a similar solution to the one I sent you a PM about a couple of weeks ago. I sent the same to Rama and he seemed to think I was doing the right thing, so I just went with my original idea. It seems to work pretty well. It is still almost as quick as a regular loop if you put loops per tick to infinite. Here are blueprintue pastes of for loop per tick and for each loop per tick respectively. Plug whatever activates the loop into Initialize and a tick event into the tick execute node. It has a regular Loop Body output and completed output as well as a Tock output (I should probably call it tick, but couldn't resist) that fires at the end of each tick after the code for that tick has been fired. These haven't been added yet, but they will be in the next patch. Epic just told me that my previous patch will be uploaded today, by the way.
                            The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                            Comment


                              #74
                              Originally posted by Zeustiak View Post
                              Have you taken a look at the procedural room generation tutorial in the learn tab of the launcher? There are a few other procedural room/maze/etc projects about that might also give you some insight.
                              I did catch the Twitch stream that they discussed that on then got caught up in work and completely forgot to check it out! I glanced at it briefly today and it seems much more complicated than Monokkel's solution with all the quad trees and procedural generation. I will likely look into it more in the future because it does do some things I really like. I followed your Map Generator work while I was researching grid based pathfinding before and it looks amazing. Really looking forward to seeing it finished.

                              Monokkel: Thanks for the reply! For whatever reason I assumed that placing walls on the outside of tiles would mess up pathfinding somehow, because it's as if they're being placed on nothing at all? But glad to see that this solution works.

                              Sorry about being a bit unclear earlier, I actually do not intend to do any procedural stuff. I need the dungeon rooms to be modular because I intend to make a simplified in-game dungeon editor where the player can drag and drop preexisting modular rooms onto the grid and build a dungeon that way. I did take a step in that direction however by simply importing my own custom shaped collision pieces and placing them around the manually laid tiles. Right now the walls are a bit huge so they block line of sight since my grid assets are based on a grid with a tilesize of 32, so your guy's a bit big. I shaved off the corners so the line of sight calculator would work properly.



                              I briefly messed with the "Make Composite Blueprint" option. Apparently it's been moved to the Blueprints menu in the toolbar at the top and renamed to "Convert selected components to Blueprint Class" according to this post: https://answers.unrealengine.com/que...t-in-47-p.html

                              I tried it out after selecting a group of tiles along with one of my custom walls, but the tiles just vanished, so not sure what's going on there. Once I get some more free time I plan to mess around with it some more though. Also, how difficult do you think it would be to implement pawns/units that are larger than one tile?

                              Comment


                                #75
                                Originally posted by TychoVII View Post
                                Thanks for the reply! For whatever reason I assumed that placing walls on the outside of tiles would mess up pathfinding somehow, because it's as if they're being placed on nothing at all? But glad to see that this solution works.
                                Having to place walls on the outside to get visibility through corners is not an ideal solution, anyway, and not that intuitive. I’ll try to change this later. Do your new, shaved off wall meshes work well? I tried making something similar at some point, but I had trouble allowing looking past corners and blocking vision through the corners of two adjacent walls at the same time.

                                Originally posted by TychoVII View Post
                                Sorry about being a bit unclear earlier, I actually do not intend to do any procedural stuff. I need the dungeon rooms to be modular because I intend to make a simplified in-game dungeon editor where the player can drag and drop preexisting modular rooms onto the grid and build a dungeon that way. I did take a step in that direction however by simply importing my own custom shaped collision pieces and placing them around the manually laid tiles. Right now the walls are a bit huge so they block line of sight since my grid assets are based on a grid with a tilesize of 32, so your guy's a bit big. I shaved off the corners so the line of sight calculator would work properly.
                                Actually the stuff I’m making for the next update will let you create dungeons without placing a single Tile actor. I’ve created a solution that automatically generates walkability on any terrain and meshes placed in your level, as long as they are set to block path trace in their collision properties. Once I’m done with the update you can simply place room meshes (don’t have to be actors) of the appropriate size in the level and it should work instantly. For now I think you’ll have to use grouping, though.
                                Originally posted by TychoVII View Post
                                I briefly messed with the "Make Composite Blueprint" option. Apparently it's been moved to the Blueprints menu in the toolbar at the top and renamed to "Convert selected components to Blueprint Class" according to this post
                                Ok, thanks. I’ll look into it and see if I can find out if making composite blueprints is a viable option.

                                Originally posted by TychoVII View Post
                                Also, how difficult do you think it would be to implement pawns/units that are larger than one tile?
                                I do want to add this at some point. I’m an avid D&D DM, so one of my goals for the toolkit is to be able to recreate Dungeons & Dragons in UE4. This would require allowing for units taking up more than one tile. It’s Dungeons & Dragons after all; not Dungeons & Wyrmlings. I’ve thought of a few ways to do this. One way is to have larger units follow a separate pathfinding function that whenever it checks if the next tile in a search step is walkable also checks the walkability of surrounding tiles of the appropriate size. It would be slightly less efficient, but not terribly so. I’d still want to keep it in a separate function instead of checking a “is this unit larger than 1 tile” bool every search step for all units. I think “long” units that occupy a rectangular area might be a bit trickier, as their rotation will change which surrounding tiles they occupy, but I’m confident I can find a solution when I get to implementing large units.
                                The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                                Comment

                                Working...
                                X