Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Hi! I finally finished getting the basics of my board game to work. Implementing the game rule turned out to be a bit tricky but I've got it now. I made a custom ability which queues an action. This action triggers an event just like Animate Movement in the unit blueprint, only that it spawns a static mesh on the clicked tile to indicate that the player controls it now. I tried to add the reference object of every new mesh to an map in the grid manager with the coordinates as keys and the mesh reference as values. I'm doing this to find them in the course of an action which should delete the mesh if the tile with its specific coordinates is clicked. But when I do this the mesh doesn't get deleted with destroy component - the mesh reference can't be found. Is this the way I should be doing it?

    Comment


      Originally posted by izckl View Post
      Hi! I finally finished getting the basics of my board game to work. Implementing the game rule turned out to be a bit tricky but I've got it now. I made a custom ability which queues an action. This action triggers an event just like Animate Movement in the unit blueprint, only that it spawns a static mesh on the clicked tile to indicate that the player controls it now. I tried to add the reference object of every new mesh to an map in the grid manager with the coordinates as keys and the mesh reference as values. I'm doing this to find them in the course of an action which should delete the mesh if the tile with its specific coordinates is clicked. But when I do this the mesh doesn't get deleted with destroy component - the mesh reference can't be found. Is this the way I should be doing it?
      Good to hear you got the basics working. So the main reason this is isn't working is that you cannot reference a specific static mesh like this. You will want to use an actor with a static mesh attached instead.

      Another suggestion is to not include important events using the action system. My action system should only be used for displaying stuff to the player. The reason for this is that the server side code happens instantly while the action system is a queue where the action happens at an unpredictable point depending on whatever actions are queued up beforehand. This means for instance that if the AI on its turn first moves, then spawns a mesh and then tries to interact with the mesh it will not be able to, since movement happens instantly server side and the mesh is not spawned until after the slow movement animation is done. Check out my three tutorial videos on the action system for a more in depth explanation with examples.

      So how to do this in your example? You need to disentangle what the server sees and what the player sees,since these might happen at different times. To keep this close to your original solution you could spawn an invisible actor server side and add the reference and then make it visible as a queued action. This will look just like spawning to the player, but give the server earlier access to the reference.

      Hope that clears things up and solves your problem.
      The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

      Comment


        Hey Mon I hope you are well.
        Sent you over an email but figured others would be interested to know.
        I checked out your trello for planned features, exciting stuff!

        in that regard do you have an estimate deadline for the next update?

        Tah

        Comment


          LDodds : Hey Luke, long time no see! To be honest I'm probably not going to release the next update until I'm done with my PhD, which is still several months of work. The closer I get to deadline there the less time I will have to work on the toolkit. Really looking forward to being able to jump back in one I'm done, though. Which particular planned features are the ones you are considering holding out for? The next update will be mostly iterative and not transformative as the last one, so updating a project to the next version from this one should be relatively less painful.
          The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

          Comment


            This is what I'm most holding out for at the moment because my project has bases and structures as children of Unit so I'd be interested to see what you do with this.
            "Interface-based initiative system allowing for multiple types of actors besides units."

            goodluck with the rest though, really looking forward to it !

            Comment


              Thanks again for the support ,

              I tried to seperate what comes through the action system and what is done beforehand. In the picture you an see Simulate Growth (with growing I mean the controlled area) which includes updating the arrays in the grid manager and the coordinates are handed to an action through which the meshes were spawned at the clicked location. If I understand you correctly I should spawn the actor with an attached invisible mesh (Spawn Invisible... in the picture) and in the action I should make it visible and in the attack case in which a mesh on a tile is supposed to be made invisible or the mesh destroyed? In my case the meshes differ between the two players so I check the tile on which the units are (which is the same at every point) and I attach the right tile to the actor. In the actions I will then destroy the actor or make it visible respectively? (The picture is just to show what I mean - there are some things not right - the index has to go to the spawn function and the vector wouldn't be needed anymore in the action but the actor reference would)

              {"alt":"Click image for larger version Name:\tBP_Unit.png Views:\t1 Size:\t202.6 KB ID:\t1495578","data-align":"none","data-attachmentid":"1495578","data-size":"full"}{"alt":"Click image for larger version Name:\tSapwnInv.png Views:\t5 Size:\t257.8 KB ID:\t1495582","data-align":"none","data-attachmentid":"1495582","data-size":"full"}
              Attached Files

              Comment


                Originally posted by LDodds View Post
                This is what I'm most holding out for at the moment because my project has bases and structures as children of Unit so I'd be interested to see what you do with this.
                "Interface-based initiative system allowing for multiple types of actors besides units."

                goodluck with the rest though, really looking forward to it !
                Ok, I see. Yeah, controlling buildings etc. or activating timed events are some of the main reasons I'm changing the initiative system. You can still achieve this how you have done by having all such things be units, of course, and that does not make much of a practical difference, but it is a bit inelegant. In my WIP build I have added a new blueprint interface called BPI_Initiative, where every actor implementing this interface is added to initiative at the start of the game instead of all units. When the turn of an actor implementing this interface comes up its Activate_Turn interface event is called which can be individually defined for each actor.

                Originally posted by izckl View Post
                Thanks again for the support ,

                I tried to seperate what comes through the action system and what is done beforehand. In the picture you an see Simulate Growth (with growing I mean the controlled area) which includes updating the arrays in the grid manager and the coordinates are handed to an action through which the meshes were spawned at the clicked location. If I understand you correctly I should spawn the actor with an attached invisible mesh (Spawn Invisible... in the picture) and in the action I should make it visible and in the attack case in which a mesh on a tile is supposed to be made invisible or the mesh destroyed? In my case the meshes differ between the two players so I check the tile on which the units are (which is the same at every point) and I attach the right tile to the actor. In the actions I will then destroy the actor or make it visible respectively? (The picture is just to show what I mean - there are some things not right - the index has to go to the spawn function and the vector wouldn't be needed anymore in the action but the actor reference would)
                Hey, so the most obvious issue here is that you are not specifying what actor to spawn. I believe this will result in you spawning nothing, so you do not have an actor to attach the static mesh to. Rather you should create a new actor class for you to spawn. Either simply base it on Actor or you can make it a child of BP_GridObject if you want the extra functionality. Add the static mesh to this actor when you define it and set it up, not during gameplay. Make the whole actor hidden by default. Then you can select this as the class to spawn, get a reference to its static mesh and set that up instead of attaching a new one. Another small thing is that you do not need to use the ConvertIndexToLocation function after the grid manager is set up. You can simply find an index in the GridLocations map. This is more efficient and agnostic of grid type.


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

                Comment


                  Hi Monokkel,

                  Is there a way I can make multiple Grid managers interact with each other? I've attached a picture to hopefully give a better idea of what I'm trying to accomplish. Basically there are going to be multiple rooms and the idea would be to have each room have its own grid manager. Is there a way to allow for the pathfinding to extend past the bounds of a given grid manager?

                  Thanks!

                  Comment


                    Originally posted by Gameran13 View Post
                    Hi Monokkel,

                    Is there a way I can make multiple Grid managers interact with each other? I've attached a picture to hopefully give a better idea of what I'm trying to accomplish. Basically there are going to be multiple rooms and the idea would be to have each room have its own grid manager. Is there a way to allow for the pathfinding to extend past the bounds of a given grid manager?

                    Thanks!
                    Hey Gameran, the toolkit is not set up for using multiple grid managers in the same level. It is something I have on my to-do list down the line, but at the moment a lot of stuff is hardcoded with the assumption that there is only one grid manager. You can attempt to change this on your own, but it is going to be a lot of work. Generally this would involve editing the various blueprints so that they reference the grid manager closest to them or one manually specified in their public variables instead of using the first grid manager it can find or getting the reference from the game state (as is generally done now). Since this is a tricky modification I would highly recommend thinking of ways you can achieve the same effect using just a single grid manager and some creativity. Can you explain the effect you want to achieve by using multiple grid manager and why you don't think it is possible using one?
                    The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                    Comment


                      Originally posted by Monokkel View Post

                      Hey Gameran, the toolkit is not set up for using multiple grid managers in the same level. It is something I have on my to-do list down the line, but at the moment a lot of stuff is hardcoded with the assumption that there is only one grid manager. You can attempt to change this on your own, but it is going to be a lot of work. Generally this would involve editing the various blueprints so that they reference the grid manager closest to them or one manually specified in their public variables instead of using the first grid manager it can find or getting the reference from the game state (as is generally done now). Since this is a tricky modification I would highly recommend thinking of ways you can achieve the same effect using just a single grid manager and some creativity. Can you explain the effect you want to achieve by using multiple grid manager and why you don't think it is possible using one?
                      The best way I can explain it is: We want to start in a main room. When the player walks through one of the doors of that room we generate a new tile with a randomly selected pre-made room on it. We started out having each room be a tile then we decided we wanted the character to have a little more movement within that room. So the thought was instead of generating a tile with a room on it, we could generate a grid manager with a room set to scale on it. That way the character has room for movement within the room. I'ts definitely possible using one grid manager. Like you said I'll likely just need to get more creative with it. The goal, ultimately, was to have a more modular setup.

                      Hopefully this all makes sense. I'm on my first cup of coffee so I may have not explained myself properly.

                      Comment


                        Hi Monokel ,

                        i was making a chess game and came across your toolkit ,intersting logic fantastic job a perfectionist approach to pathfinding , i guess it will be perfect fit for my chess project hence i'm willing to purchase the toolkit ,and before that i need to clear out some points :


                        1- first to make sure the starting point for my game is great which is the chess board grid , i just recreated the starting point from your construction script of the grid manager ,but i have an issue the collision plane is not scaling and positioning properly to the grid size , ....
                        ....So my question is the collision plane you used a simple plane component or a collision box component , and i can see it parented to "scene1" is it the "defaultsceneroot" that you just renamed or what ....?? ..... see pictures 1 and 2 below ...


                        2- is the pathfinding in your toolkit suitable for a chess game right off the bet or do i need to make major adjustments to fir a chess logic responsible for scanning the chess board and finding out the surrounding chess pieces and setting the rules to interact with them in various situations .


                        3- what payment options are available for your toolkit cause i'm planning to purchase it.

                        Best wishes ,
                        Thank you for your support .

                        Attached Files

                        Comment


                          Hey there, So I bought this awhile back and have been enjoying it. I was wondering how I would be able to determine the direction currently being faced, as well as perhaps how to determine from that direction the tile directly in front of it? This would help me make an ability or simple command to turn characters, place objects, and also to determine the swing lengths and properties of certain attacks. Lot of potential functionality here and was curious if theres any settings currently in place to assist with this?

                          Comment


                            Gameran13 : Keeping everything in one grid manager is very likely going to be the simplest solution. The only drawback here is that you need to make sure the grid manager covers the entire area of possible rooms. If I was to do what you are trying I would probably pregenerate all the rooms at startup, but keep them invisible until they are needed in game.

                            Carter10 : Hi there, I think the toolkit can work as a decent base for chess with some modification. I'll do my best to answer your questions:

                            1. I'm not sure from looking at your screenshot exactly what you have gotten wrong when it comes to the collision plane. However, if you're making chess you already know the size of your grid, so you do not need to have something that automatically resizes. Just place a static mesh plane, collision box or whatever that blocks PathTrace and make it cover your chess board.

                            2. Pathfinding is not set up for chess. Chess pathfinding is actually pretty different from the sort of pathfinding I'm using, so you would need to do most of it from scratch. However, the underlying array structure of the grid should make this quite a lot easier than starting from nothing, and you can utilize some of the functions. For many types of chess movement I think you can use the simple GetIndexesInRange function (which ignores pathfinding edges, visibility etc) and then make custom functions to decide which of the output grid indexes to keep.

                            For example, for a knight you would use get indexes in range with a range of 2. Then you would loop over all the output grid indexes and add them to a new set if they combined X and Y distance to the tile is equal to the width of your tiles * 3 and there are no friendly units occupying the tile (checking the Grid Units map). For a queen you would get all indexes within a range of 7 and keep tiles that either have an equal X and Y distance or tiles where either the X or Y distance is 0. Then you would have to check if there are any units in the way, either by creating a new loop that checks the unit array from the edges and inwards or a quick and dirty solution like adding unit collision to your chess pieces and using a line trace. Modifications of these two techniques should give you the movement of all different chess pieces.

                            3. The toolkit is sold only in the Unreal Engine marketplace (check my signature), so any forms of payment they accept on the marketplace should be good. I don't have an overview over all the forms of payment they accept, but I'm sure you can find that information easily.

                            Gyawaki : Glad you're enjoying the toolkit You should be able to get the facing of a unit by getting its yaw world rotation (or relative rotation to the grid manager if you need the grid manager to be rotated for whatever reason). You could convert this float value to a facing enum in any number of ways if needed. For instance, if you have 8 possible facings you could divide the yaw float by 45, convert the result to an integer and input it into a switch. There are probably more elegant solutions as well, but that is one solution that comes to mind. For a square grid these facings will correspond to north, north east, east etc. You can make a function to convert these results to the appropriate adjacent tiles. North = the unit's tile - GridSizeX, east = tile + 1, south west = tile + GridSizeX - 1 etc.
                            The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                            Comment


                              Sorry for late reply, thanks Mon I will give that a try soon

                              Comment


                                Originally posted by LDodds View Post
                                Sorry for late reply, thanks Mon I will give that a try soon
                                Great, hope you like the newest version
                                The Advanced Turn Based Tile Toolkit (Marketplace page - Feedback thread)

                                Comment

                                Working...
                                X