Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

    Originally posted by Monokkel View Post
    Ok, I'll show you what you need to do. I'm sure you've made some small mistake which will hopefully become clear now. You want to rotate the unit when it has ended its move and clicks a an empty tile. By default this ends the unit's turn, so you want to have it rotate before the turn ends. The logic determining if the unit's turn should end when a tile is clicked is held in ATBTT_PlayerController, so that is the simplest place to add the rotation code (though calling a custom "rotate unit" function in the unit blueprint might be more "correct"). I've added these few nodes to the event grah of the player controller, in the Initialize Movement - Step 1 comment box right before End Unit Turn is called. Here they are:

    [ATTACH=CONFIG]139313[/ATTACH]

    I apologize that it does not really make sense that End Turn is called within a comment box saying initialize movement, which is not really intuitive. This is one of the many things I'm cleaning up in the big refactoring I'm doing.

    Let me know if it works like you want it to.
    That is exactly it. I was close pretty close except for getting the "Vector Field Array" and calling everything in that spot in the graph. Thanks once again for your help.

    Comment


      Originally posted by Monokkel View Post
      I took a look at the forum page about your mod. Looks like a very ambitious project! Have you completed the mod already and now want to remake it, or are you at the planning stages?
      The majority of the game is completly playable and done, but of course ONLY IN THE OLD ENGINE. (So around 80 maps: poland till stalingrad - for comparision: Panzer Corps 2, which is beeing developed now in the ue4 will have only 20 maps) Some Campaign "Sideways" f. ex. when you are degraded and beeing transfered from russia to africa have to be done, the invasion of the usa too, but in the old 2D Engine you could package the first three parts of the game. (if i release it someday with the ue4, i plan to release it in parts: 39,40,41 etc.)
      Creating the levels in UE4 is no problem, but the ai, and the tb system will be difficult (surprisingly the old 2D Enigne of Panzer Corps 1 does relativly well reg. AI, Pathfinding etc) and I dont know if i will ever get the necessary programming skills for that ambitious project. Since i am more the artist, writer and design guy, maybe i will have to look for help. So to answer your question, the planning phase is long over, the game is ready to be sold, but only in the old engine, where i am not allowed to sell it. In UE4 i am in the learning phase, i did 60 tutorials and i will do additional 140. After that i will know, how far i can get with my ue4 skills.

      Originally posted by Monokkel View Post
      Not by default, no. ATBTT uses an array to determine what units are positioned at what tile, which only holds one unit per array index. However you have full access to the source code and can add this yourself. I do not know the mechanics of Panzer Corp, but if there can only ever be a maximum of two units on one tile (one flying and one on the ground), then making another array for flying units would probably be the easiest. If you want the possibility of stacking an arbitrary number of units on one tile, then a nested array with each array index containing an array of units would be the way to go. Note that making this change would require you to modify many other parts of the toolkit, such as scripting which unit is selected when clicking a tile with multiple units etc.
      Again not something that is included by default (I try to design the toolkit as a blank slate where you can add your own features rather than having lots of game specific features cluttering up the blueprints), but not something that would be difficult to add. At the end of a unit’s turn you could check how many unused movement points it has, and if it does you could increase its defense. Defense is a new attribute you would also need to add and implement yourself.
      So your ATBTT will be of great help, but first i have to become much better reg. blueprints. Then your work could be the foundation for mine.

      Originally posted by Monokkel View Post
      There is good reason AI is often a weak point of TBS games, and that is because it is actually very difficult to do well. I have included a game example in ATBTT that includes fairly complex AI blueprints for determining the best course of action, and it is some of the most challenging work I’ve done. I’m pretty happy with it and it works well, but it is still not “true” AI, but rather a complex state machine. How difficult something is to script depends on a lot of factors. Moment to moment decisions where a unit only needs to use information of the game’s present state is the easiest (and the only sort of AI I have made so far). Your artillery example is an example of this. It is easy enough to add a check when the artillery unit decides its move so that it does not move to tiles adjacent to units. Pincer movements are a lot more difficult to implement, since you need to have each unit determine not just the possible actions it can do, but also all allies. Planning complex strategies involving multiple units over multiple turns again makes this exponentially more difficult. Don’t get me wrong, this sort of stuff can be done, and can also be a lot of fun to program, but it requires a ton of work to do well. I’m sure you’ll be more sympathetic of TBS developers once you’ve tried your hand at it.
      There is hope that machine learning will be used for game AI in the future (my research group has just used this for determining the age of research participants from their MR-images at my day job), but if you want to go that route it is a whole new, complex field to learn.
      Regarding the artillery example: It´s not that easy, ai has to plan future turns, because its not enough to be one tile away of the enemy. Idealy it should analyze which kind of enemy it is and if the enemy can reach it in the next turn. (tanks are fast f. ex.) Then ai should place defence units like antitank guns to keep the tanks away. In defence thats no problem, with the old 2D Engine, because i can set the arty to "hold position and just fire" and place anti tank guns in front of the artillery. And add a skript like "if enemy kills one anti tank gun, retreat to another prebuild def. pos. with anti t. guns).
      But large counteroffensives with many units acting together, thats so much harder. Maybe its wise to combine the units of one pincer and treat them like one big unit. So the wedge formation f. ex., while moving, could be maintained, mostly. And when the pincer has contact with the enemy, every unit will be treated like usual.

      Real learning ai in a tbs, that would be my dream. Hopefully i will see that before i die.

      Originally posted by Monokkel View Post
      I’m embarrassed to say that I have not played either game, though I know they are considered to be classics. You would have to be more specific about what features you suspect might be difficult to implement in ATBTT.
      Master of Orion 2 is a special game. It´s the genre primus reg. 4x Spacecivgames for two decades now. Many companies tried to release a modern, better game of that kind and all failed. (Mostly because of dumb design decisions, like developing an rts battle system with nearly no depth and challenge, instead of a much improved turn based system, or its just autobattle what i regard as total fail) If you don´t know, go check the game Alpha Centrauri. Its a mixture of Civilization and Master of Orion and is still regarded as the tbs with the best ai ! Jagged Alliance 2 is in many regards like X-com. X-Com has the better grafics, JA2 the better gameplay, and a dynamic campaign. Those games are pearls, that every designer should know.

      Originally posted by Monokkel View Post
      Best of luck learning UE4! You should try to become very confident with UE4 before attempting to recreate your mod with ATBTT. I would recommend working gradually towards your goal by making several small, simple games first that teach you various aspects of the engine before trying to convert your mod.
      I am starting with a simple zombie game, which i have tutorials for. Second i try to recreate the orig. castle wolfenstein. (i should be able to create better grafics )
      Its a pity, that the tbs tutorial of epic games is no longer available.

      Last but not least, thanks for your answer.
      Last edited by Metalfan66; 05-03-2017, 06:33 AM.

      Comment


        Originally posted by Selentic View Post
        I probably just got lucky, that's disappointing to hear. I was really hoping they finally nailed it.
        Well, I have actually not encountered this bug again since I replied to you last. It only happened consistently and repeatedly with one old map I was working on. Maybe there is reason to be cautiously optimistic. Let me know if you encounter the bug again.

        Originally posted by SpineRazor View Post
        That is exactly it. I was close pretty close except for getting the "Vector Field Array" and calling everything in that spot in the graph. Thanks once again for your help.
        Glad it worked I hope the reason it now works when it didn’t before makes sense. Let me know if you want me to clear up anything.

        Originally posted by Metalfan66 View Post
        The majority of the game is completly playable and done, but of course ONLY IN THE OLD ENGINE. (So around 80 maps: poland till stalingrad - for comparision: Panzer Corps 2, which is beeing developed now in the ue4 will have only 20 maps) Some Campaign "Sideways" f. ex. when you are degraded and beeing transfered from russia to africa have to be done, the invasion of the usa too, but in the old 2D Engine you could package the first three parts of the game. (if i release it someday with the ue4, i plan to release it in parts: 39,40,41 etc.)
        Ok, neat! Having a completed game to work towards replicating will probably be very useful. A common recommendation for new game developers is to attempt to recreate an existing game, and in your case you will have created the game you planned to make in the process.
        Originally posted by Metalfan66 View Post
        So your ATBTT will be of great help, but first i have to become much better reg. blueprints. Then your work could be the foundation for mine.
        I’m quite sure it will be very useful to you as a foundation. I’ve tried to keep it as flexible as possible so that it can be used as a base for many sorts of TBS games.
        Originally posted by Metalfan66 View Post
        Regarding the artillery example: It´s not that easy, ai has to plan future turns, because its not enough to be one tile away of the enemy. Idealy it should analyze which kind of enemy it is and if the enemy can reach it in the next turn. (tanks are fast f. ex.) Then ai should place defence units like antitank guns to keep the tanks away. In defence thats no problem, with the old 2D Engine, because i can set the arty to "hold position and just fire" and place anti tank guns in front of the artillery. And add a skript like "if enemy kills one anti tank gun, retreat to another prebuild def. pos. with anti t. guns).
        Ok, I see. Designing AI is both tricky and fun. One important thing to remember is that it matters more that the AI looks intelligent to the player than that the AI is super complex and carefully evaluates all possible actions it can do. There are often many ways to slightly fake it and use heuristics.

        Originally posted by Metalfan66 View Post
        Master of Orion 2 is a special game. It´s the genre primus reg. 4x Spacecivgames for two decades now. Many companies tried to release a modern, better game of that kind and all failed. (Mostly because of dumb design decisions, like developing an rts battle system with nearly no depth and challenge, instead of a much improved turn based system, or its just autobattle what i regard as total fail) If you don´t know, go check the game Alpha Centrauri. Its a mixture of Civilization and Master of Orion and is still regarded as the tbs with the best ai ! Jagged Alliance 2 is in many regards like X-com. X-Com has the better grafics, JA2 the better gameplay, and a dynamic campaign. Those games are pearls, that every designer should know.
        I am aware of all the games you mention and know what they are about, but have just not played all of them. It is on my to-do list, but the last couple of years playing games has taken a back seat to making games. I still play games when I have the time, though, and when I do they tend to be TBS games.
        Originally posted by Metalfan66 View Post
        I am starting with a simple zombie game, which i have tutorials for. Second i try to recreate the orig. castle wolfenstein. (i should be able to create better grafics )
        Seems like you have a good idea of how to best learn the engine. Watching tutorials and making simple games is a great plan. Best of luck, and when you begin making your TBS feel free to ask questions in this thread anytime.
        Originally posted by Metalfan66 View Post
        Last but not least, thanks for your answer.
        My pleasure
        Advanced Turn Based Tile Toolkit (Marketplace - Support)

        Dungeon Crawler Toolkit (Marketplace - Support)

        Discord

        Comment


          Originally posted by Monokkel View Post
          Hi Mewbits, that's a question I've always been really bad at answering. My estimates are always way off when I do so. I am making great progress and have managed to mostly complete big units (only for square grids at the moment, but I'm working on it).

          I feel that this update should be a significantly quicker, but it might just be the planning fallacy doing its thing again. On paper the list of stuff I am adding is bigger rather than smaller than the last update, though my scripting skills have also improved since then. In other words, expect it to take some time. When I'm happy with it I could post my solution for large units if you are interested in implementing this earlier.
          I'm hyped too. If you can pop out multi tile units on their own before the next major update that'd be awesome.

          E: How do you calculate movement costs for large units currently? Take each cluster of four, add their costs, and then divide by four?
          Last edited by Envieous; 05-03-2017, 05:39 PM.
          Anime Shading Model - Twitter

          Comment


            Originally posted by Selentic View Post
            I'm hyped too. If you can pop out multi tile units on their own before the next major update that'd be awesome.

            E: How do you calculate movement costs for large units currently? Take each cluster of four, add their costs, and then divide by four?
            Movement costs is the one thing I haven't really figured out yet. Partly it is because how this is implemented seems to differ from game to game. In some games big units are slowed down if any of its tiles enters a tile of difficult terrain, while in others the unit ignores difficult terrain unless all occupied tiles are difficult terrain. The other issue is that tiles in the toolkit can have varying costs depending on which direction they are entered from. This means that I cannot simply check all occupied tiles and see if they have a cost or not, but I have to check several different edges. This quickly becomes very costly, and multi-level grids makes this even more difficult still. I will try to find a way to precalculate these costs so that there is no performance impact during actual gameplay, but I still want something that is fairly performant during setup. I will find a solution and have a few ideas, but I'm not sure what I'll end up with using.
            Advanced Turn Based Tile Toolkit (Marketplace - Support)

            Dungeon Crawler Toolkit (Marketplace - Support)

            Discord

            Comment


              One of the things I'm trying to do while refactoring is making the grid manager functionality independent of rotation, location and scale. This makes it easier to use the toolkit in games where the turn based strategy board is not the entire focus of the game, but could be a board game placed on a table in a fps, or something similar. It is also beneficial in VR games where having the possibility of rotating and moving the game board can help users with smaller VR playspaces play large virtual board games.

              I've pretty much got it working at this point, but I thought I'd share a gif I made when I was still figuring things out and accidentally created a simulation of what being sucked into a black hole might look like :P

              Attached Files
              Advanced Turn Based Tile Toolkit (Marketplace - Support)

              Dungeon Crawler Toolkit (Marketplace - Support)

              Discord

              Comment


                Originally posted by Monokkel View Post

                My brain does this every time I look at your AI blueprints.
                Last edited by pigneedle; 05-06-2017, 02:23 PM.

                Comment


                  Originally posted by pigneedle View Post
                  My brain does this every time I look at your AI blueprints.
                  Hehe, yeah I'm assuming you're thinking of the AI in the sci-fi game example. It is pretty complex compared to the AI in the base toolkit. The game examples are a bit of a playground where I experiment with adapting the toolkit to various genres and the solutions in them are a bit more experimental and often a bit more convoluted than the base toolkit functionality. One of the thing I'm doing in the next update is making the skill system a part of the base toolkit and in the process I'm trying to make it easier to understand and manipulate.

                  The general idea of the AI in the skill blueprints is to first identify all possible targets, then weight those target based on some criteria decided in the skill and assign a value based on this. Then either that value is stored to be compared to the calculated value of other skills or the skill is executed, at which point the AI unit also finds the optimal tile from which to use the skill, based on cover, distance from enemies and specific criteria based on the skill being used. That is a lot of stuff to go through, so I understand if it is a challenge to understand initially.
                  Advanced Turn Based Tile Toolkit (Marketplace - Support)

                  Dungeon Crawler Toolkit (Marketplace - Support)

                  Discord

                  Comment


                    I think I've failed to mention that the toolkit works fine in UE4.16 preview. Just open a 4.15 copy of your ATBTT project in 4.16 preview and it should work without any errors (though let me know if any of you spot any). As per usual I won't send a new version to Epic until the full release of 4.16 is out. If you decide to work in the preview make sure to back up your work as you should with any project.
                    Advanced Turn Based Tile Toolkit (Marketplace - Support)

                    Dungeon Crawler Toolkit (Marketplace - Support)

                    Discord

                    Comment


                      Hey [MENTION=4318]Monokkel[/MENTION], bought your toolkit a while ago but only just getting around to playing with it now. It looks incredibly robust! I can't wait to see what can be done with it.

                      Currently, I'm trying to figure out multiplayer. I'd really like to do this using the UE4 SocketIO plugin, where I can send information to and from a remote Node.js server. From what I can see, I think this is the easiest way I could add multiplayer to this toolkit: if I can somehow just represent another player's units as inert AI which moves based on some input from the server, I'll have that set.

                      I've figured out right now how to get the index of the tile a player clicks on and send it to the server. I suppose my question is, what's the easiest way to just tell a Unit to "move to" or "attack" a particular index? It looks like a lot of this logic is coupled to the player controller, of which there will only actually be one in the game. Thanks again for such a great tool.

                      EDIT: basically, the easiest way to do what I'm trying to do here would be if I knew some way to try and force, for example, a unit to try and move towards a particular index. I tried modifying the AI controller to do this, but I want some results that work irrelevant of trying to target other pawns on the grid.
                      Last edited by Rockhopper; 05-11-2017, 04:04 AM.

                      Comment


                        Hi [MENTION=151429]Rockhopper[/MENTION], I'm glad you like the toolkit! Networked multiplayer is actually one of the things I'm currently working on myself. I'm not using any plugins and sticking with UE4's built-in networking. I've got it more or less working like I want at this point, though it is still a bit rough around the edges. In general terms, what I'm doing is do most things on the server, including all calculations such as pathfinding, visibility, whether a clicked tile can be moved to etc. (this is essential to prevent cheating). Input is handled from the player controller, but unlike the version of ATBTT currently on the marketplace I do not do things like check the cost of the clicked tile, the move value of the current tile or anything like that. I just convert the clicked location into a grid index and do the rest on a server only event in a separate, replicated actor.
                        Advanced Turn Based Tile Toolkit (Marketplace - Support)

                        Dungeon Crawler Toolkit (Marketplace - Support)

                        Discord

                        Comment


                          [MENTION=4318]Monokkel[/MENTION] wow, that's great! This toolkit just gets even better if the built-in multiplayer works.

                          Unfortunately, for this application I'm already using significant server logic a team member wrote for a SocketIO Node.js server and will need to stick to implementing multiplayer this way. The multiplayer isn't that important though, what I can't figure out is how to create something different from the AI Controller which is basically "scripted" motion.

                          For example: do you have any ideas for how I might be able to tell a unit something like, "go from your current index (3) to index 0, taking the path through 2 and then 1?"

                          We're going to use the PlayerController from your toolkit and have one player just use it as it is. When one of their units move, it emits its path data to our server, is verified by the server, and passed down to other clients to move these "scripted controller" units accordingly. This way, as far as UE4 networking is concerned, our game is entirely offline. The motion of certain units just correspond to actions taken by a remote player. Hopefully this clarifies my actual question, thank you for taking the time to answer!

                          Comment


                            [MENTION=151429]Rockhopper[/MENTION]: Thanks! It will be quite some time until the next update is done, so if time is of the essence using your own solution is the best idea anyway.

                            For having a unit go a custom path, here is a simple solution. In this case I'm calling it from the player controller, though it could be called from anywhere. You would probably use a less hard-coded way to make the int array, but you get the idea.

                            Click image for larger version

Name:	YTuXPrM.png
Views:	1
Size:	118.0 KB
ID:	1127962

                            Your explained solution for networked multiplayer seems reasonable. I'm not sure if you have solved all the issues you were asking about, though. Do you have any remaining questions?
                            Last edited by Monokkel; 05-11-2017, 06:13 PM.
                            Advanced Turn Based Tile Toolkit (Marketplace - Support)

                            Dungeon Crawler Toolkit (Marketplace - Support)

                            Discord

                            Comment


                              [MENTION=4318]Monokkel[/MENTION] thank you so much! I've been trying to figure that out all day. I literally just got to the point where I figured out that I was never setting "Path Index Array." I confused myself because when I searched your blueprints I could only ever find examples of that variable being retrieved, never set. Would you mind clarifying where that typically gets set, just in case I run into any other issues?

                              Also, with my current approach I've created a new ATBTT_RemotePlayerController holding this logic and added a new setting to select which controller to use. I think I've updated all references to the "AI Controlled" boolean to account for this possible third controller. I haven't had enough time to dig fully through all of the blueprints or wrap my head around all of your tutorials yet, though. Do you foresee this approach having any fundamental issues with parts of the toolkit?

                              You've been a great help.

                              Comment


                                Happy to help! I apologize that it is sometimes unclear when certain variables are set in the toolkit. This is one of the thing I'm working hard to improve in the next update. I'm making it so that variables are very rarely set inside functions, but are instead added as output to the functions so that it is more transparent and so that users can more flexibly choose how to use function output.

                                For the time being, though, I recommend using UE4's Find References functionality to find all instances where a variable or function is used. If you are not aware of this you can right click any variable or function and select Find References to find all such instances (unchecking find in current blueprint only is often a good idea as well). If you do this you will find that the only place the Path Index Array is modified is in the Find Path to Index function in BP_GridManager. If you again Find References of this function you will find that is called two places: In the AI controller and in the Find Path Within Pathfinding Array function. Once more we Find References of this function and... I'm not going to type it all out, but you get the idea Keep going and you will find all places the Path Index array is modified.

                                I'm not immediately seeing any issues with the way you are handling the controllers. I'll let you know if I think of anything. If you run into any issues I'll do my best to help.
                                Advanced Turn Based Tile Toolkit (Marketplace - Support)

                                Dungeon Crawler Toolkit (Marketplace - Support)

                                Discord

                                Comment

                                Working...
                                X