Announcement

Collapse
No announcement yet.

[SUPPORT] Advanced Turn Based Tile Toolkit

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

  • replied
    Sorry for the late reply, people. The last couple of days were very busy. I'll get to your questions now:

    Originally posted by SpamBotWinner View Post
    Hello, I'm just curious, what is the idea behind Action System? I just want to know its pros and cons, especially as part of the multiplayer system.
    Hi SpamBotWinner, there are several benefits to the action system, both in regards to multiplayer and otherwise. Firstly it is a tried and true way to design turn based games. Games like Hearthstone, XCOM and Gears Tactics work like this under the hood (hints to this is how the EndTurn button in Hearthstone is immediately disabled if you initialize some RNG based spell which eventually results in a player death, or how you get an achievement in XCOM for killing a new type of enemy right at the start of the AI's turn instead of after you hit it with an overwatch shot seconds later).

    One benefit can be seen in considering how you would have to structure your code without an action system. Say you have an AI unit who wants to move to a tile and attack a unit. Without an action system you would need a function or event dispatcher to make a call to the attack system after movement has ended. Then the attack system would have to make a call to a damage dealing system etc. You can quickly end up with spaghetti code where all sorts of objects point and execute events in other objects, which becomes confusing and requires manual setup for every single thing you want to be able to call in sequence. The action system provides a standardized way to call events in sequence, which can call an arbitrary sequence of actions.

    The action system is also effectively a sectioning off of gameplay logic and what is visually transmitted to the player. A benefit of this is that all the gameplay logic would work the same if you changed everything on the visual layer, which makes it easier to do extensive modifications of the toolkit.

    The fact that all the game logic for a turn (or indeed several turns) can be carried out over a single tick (instead of waiting for animations to finish) opens for many advanced possibilities. You could in theory have an AI test out several different options before deciding on the best one, and only then queueing the resulting actions. You could even do this for multiple AI units to enable coordination (Gears Tactics does this). Knowing before the turn starts animating all the things that will happen during the turn opens up for many possibilities, such as guiding the camera in a way that will best capture the action etc.

    So for these reasons, even if it did not improve multiplayer, I would still want to have an action system. However, another benefit is that the action system essentially takes care of replication for you. You generally want all game logic to happen on the server, while still showing to the players what they need to see. This distinction is built into the action system, and any variable passed through an action is automatically replicated, meaning you don't have to mess around with manually replicating variables and calling RPCs. Each client is also responsible for their own action queue, which results in lagless animation within each action. In a real time game you will have to continously update the location of a moving actor to all clients (and often build in prediction algorithms for when transmission is slow). For actions the client gets a single command once and then it takes care of the entire animation itself, meaning that you will never see a unit lagging during movement.

    I hope that made things clear. Note that I am making some major changes to the action system in the coming update. Although the current system is functional, it feels a bit hacky, and it is easy to make coding mistakes in forgetting to end an action or ending an action twice, which causes many strange issues. The current setup also creates quite a bit of circular dependencies and runs into many of the problems related to OOP (you have to inherit from an actor in order to access its action). I'm moving to a system of encapsulating actions within actors, which makes everything a lot cleaner.

    Originally posted by codeyhanson View Post
    I was not able to solve it I really Tried I assume there is a fix to be found in the bp manger or the grid camera hybrid but I was unable to find one
    No worries, I'll see if I can solve it. I'm not exactly sure what the problem is, though. Could you give me the exact steps to reproduce the issue you are seeing?

    Originally posted by LuxJahi View Post
    ok sooo im back with kind of a dumb issue, and seeking some advice. before you ask, yes i have been looking at tutorials. now on to the issue in question.

    first is the goal
    Goal: make a delay based on faction and display a count down timer to match it.

    so far i created a working delay. its not pretty but it works.
     
    Spoiler


    the function works like this

     
    Spoiler


    the issue i am having tho is with trying to make a ui widget to call for the seconds left in the delay
     
    Spoiler


    it gives me this error

     
    Spoiler


    i have also tried this to make it work buuuut, it dosent display anything
     
    Spoiler


    lastly: i looked into world settings and tried to make sure i was calling correct sections. i have tried with your hud and with a hud i made. clearly im doing something wrong

     
    Spoiler
    Ok, so I see a few mistakes here. I will point out the obvious mistakes I am seeing, but cannot give you more specific suggestions, since I'm not sure exactly what you are trying to achieve? Do you want a timer displayed on the screen that counts down from 5, once per second, before the goblin turn starts?

    The PlayerInputCountdown function looks a bit weird to me. You are aware that delays don't work within functions? The DelayAllActions isn't really a delay, but rather a command to have the action system delay continuing the action queue. From how I read it I think this function would print 12345 immediately during the same tick and then you would have a five second delay in the action queue based on five one-second delay actions back to back. I think this is probably not what you're after?

    From the last two screenshots it seems you have misunderstood how casts work. The game mode is not of type turn manager, and casting it won't make it so. Similarly the Owning player is not a turn manager. Casting is a way to check if a reference is of a specific class, and if so you are able to access its variables. So, for instance, you can have a reference to a unit in a blueprint. The reference is of the type BP_Unit. However, the unit stored in this reference right now is actually of the class BP_Unit_Anim. You want to have access to the variables and functions that are specific to BP_Unit_Anim, but UnrealEngine does not know that your variable is of this class (since the reference variable is of type BP_Unit). This is when you cast it to access the child class. I recommend checking out the documentation on casting here: https://docs.unrealengine.com/en-US/...des/index.html

    Leave a comment:


  • replied
    ok sooo im back with kind of a dumb issue, and seeking some advice. before you ask, yes i have been looking at tutorials. now on to the issue in question.

    first is the goal
    Goal: make a delay based on faction and display a count down timer to match it.

    so far i created a working delay. its not pretty but it works.
     
    Spoiler


    the function works like this

     
    Spoiler


    the issue i am having tho is with trying to make a ui widget to call for the seconds left in the delay
     
    Spoiler


    it gives me this error

     
    Spoiler


    i have also tried this to make it work buuuut, it dosent display anything
     
    Spoiler




    lastly: i looked into world settings and tried to make sure i was calling correct sections. i have tried with your hud and with a hud i made. clearly im doing something wrong

     
    Spoiler

    Leave a comment:


  • replied
    I was not able to solve it I really Tried I assume there is a fix to be found in the bp manger or the grid camera hybrid but I was unable to find one



    Originally posted by codeyhanson View Post
    Hello Monokkel that worked almost but now anytime I move the camera that snaps camera back to location 0 going to try and see if I can find the camera in the blueprint and convert that with the same node

    Note I was not able to find it for the hybrid again thank you so much for your help plan to show a small demo video of what I have so far all thanks to you.

    Happy to help! Too bad you still have a remaining issue. Let me know if you are not able to solve it. I try to correct for the grid manager's transform in everything I add, but the maps in the experimental folder will generally not be as polished as the core toolkit, so some issues like this might crop up when you try to modify them. I play it a bit more fast and loose with the experimental maps, which enables me to demonstrate possible features quickly.
    Last edited by codeyhanson; 09-08-2020, 07:36 PM.

    Leave a comment:


  • replied
    Hello, I'm just curious, what is the idea behind Action System? I just want to know its pros and cons, especially as part of the multiplayer system.

    Leave a comment:


  • replied
    Originally posted by codeyhanson View Post
    Hello Monokkel that worked almost but now anytime I move the camera that snaps camera back to location 0 going to try and see if I can find the camera in the blueprint and convert that with the same node

    Note I was not able to find it for the hybrid again thank you so much for your help plant to show a small demo video of what I have so far all thanks to you.
    Happy to help! Too bad you still have a remaining issue. Let me know if you are not able to solve it. I try to correct for the grid manager's transform in everything I add, but the maps in the experimental folder will generally not be as polished as the core toolkit, so some issues like this might crop up when you try to modify them. I play it a bit more fast and loose with the experimental maps, which enables me to demonstrate possible features quickly.

    Originally posted by Christian Beauclair View Post

    Thank you. I've applied the changes you have suggested and works the same but I am sure it is more efficient now. Looking forward to the changes in the next version. For now, back to the game.
    Yep, the results will look the same. I'm not always this **** about performance, but the inner pathfinding loop is the part of the toolkit which is by far the most affected by inefficient code, since it is run so often. If your game does not have extremely long movement ranges it is unlikely to be an issue, but I couldn't help myself in suggestion a more performant option in this case.

    Leave a comment:


  • replied
    Originally posted by Monokkel View Post

    Nice work! Pretty close to what I had in mind, though I would make a few adjustments.

    All in all pretty close to your implementation. I used a custom set instead of SpecialEdges, as SpecialEdges is designed to mark the edges between tiles as special, and not the tiles themselves. Also, although the way you modified the pathfinding function will work, it is not very performant. That particular function is potentially called a very high number of times during pathfinding, so it important to set it up so it does not do any unnecessarily expensive calls. You want to order the branches so that the ones that are most likely to be false are called first, which will usually be after the stored paths have been checked.

    The reason I have not made the pathfinding tutorials yet is that I am in the middle of a refactoring which changes the pathfinding a bit. The current way of having to expand an enum and modify a function to add new pathfinding types is quite awkward, as is having to copy paste a lot of the standard pathfinding function each time you make a new pathfinding type. This is something I am fixing in the next update. It is mostly a change in organization, but the code looks visually quite different, so I did not want to make new tutorials only to have them be immediately outdated when the next update hits.
    Thank you. I've applied the changes you have suggested and works the same but I am sure it is more efficient now. Looking forward to the changes in the next version. For now, back to the game.

    Leave a comment:


  • replied
    Hello Monokkel that worked almost but now anytime I move the camera that snaps camera back to location 0 going to try and see if I can find the camera in the blueprint and convert that with the same node

    Note I was not able to find it for the hybrid again thank you so much for your help plan to show a small demo video of what I have so far all thanks to you.
    Last edited by codeyhanson; 09-08-2020, 07:36 PM.

    Leave a comment:


  • replied
    Originally posted by Christian Beauclair View Post

    Hello Monokkel.

    thanks for looking into it. I am still a newbie when it comes to Blueprint but after some work I was able to achieve something. I just need to validate that this is a good approach if you don't mind. Attached are the modified Custom Pathfinding function in GridManager and the Move ability I use. I decided to make use of the SpecialEdges enum. The third attachment is my tile Begin Play. I just check if the tiles as a zero index specialedges that is of enum type Hindering.

    That do you think?

    Thanks,
    Christian
    Nice work! Pretty close to what I had in mind, though I would make a few adjustments.

    So first what I did was to create a new integer Set in BP_GridManager which I called GridHindered, which holds the grid indexes of all hindered tiles.

    Next I added a new type of GridObject which adds its index to the GridManager on BeginPlay:



    I modify the Custom1 pathfinding type so that pathfinding search stops if it reaches tiles that are in the GridHindering set:



    Lastly in the ability I am using I select pathfinding type based on if the index the owning unit is standing on is in the Hindering Set:



    And there we are:

    https://gfycat.com/scarcecourageouscreature

    All in all pretty close to your implementation. I used a custom set instead of SpecialEdges, as SpecialEdges is designed to mark the edges between tiles as special, and not the tiles themselves. Also, although the way you modified the pathfinding function will work, it is not very performant. That particular function is potentially called a very high number of times during pathfinding, so it important to set it up so it does not do any unnecessarily expensive calls. You want to order the branches so that the ones that are most likely to be false are called first, which will usually be after the stored paths have been checked.

    The reason I have not made the pathfinding tutorials yet is that I am in the middle of a refactoring which changes the pathfinding a bit. The current way of having to expand an enum and modify a function to add new pathfinding types is quite awkward, as is having to copy paste a lot of the standard pathfinding function each time you make a new pathfinding type. This is something I am fixing in the next update. It is mostly a change in organization, but the code looks visually quite different, so I did not want to make new tutorials only to have them be immediately outdated when the next update hits.

    Leave a comment:


  • replied
    Originally posted by Monokkel View Post

    Hi, seems like I forgot to convert from grid space to world space in one place in the experimental hybrid map. Sorry about that. This should hopefully fix things:




    I am currently working on this problem. I will update this post when I have a solution.
    Hello Monokkel.

    thanks for looking into it. I am still a newbie when it comes to Blueprint but after some work I was able to achieve something. I just need to validate that this is a good approach if you don't mind. Attached are the modified Custom Pathfinding function in GridManager and the Move ability I use. I decided to make use of the SpecialEdges enum. The third attachment is my tile Begin Play. I just check if the tiles as a zero index specialedges that is of enum type Hindering.

    That do you think?

    Thanks,
    Christian
    Attached Files

    Leave a comment:


  • replied
    Originally posted by codeyhanson View Post

    Ok I looked around to try to find out where to put this fix but im unable to find it im using the hybrid map if you could point me in the right direction so I can move that grid manager from 0,0,0 I just need to know where to put the fix sorry
    Hi, seems like I forgot to convert from grid space to world space in one place in the experimental hybrid map. Sorry about that. This should hopefully fix things:


    Originally posted by Christian Beauclair View Post
    Hello Monokkel.

    I am trying to understand what I need to modify or create in terms of pathfinding in my game. You mentioned a video on pathfinding and edge costs at the very end of this one https://www.youtube.com/watch?v=r5j3...15jXKF&index=9 but I could not find it.

    I have a Title type with a Boolean variable called Hindering (represented by the blue tiles in my screenshot). I want the pathfinding to stop movement on those tiles and not go beyond if you start from a regular tile. If you start from an hindering tile, you can go anywhere at half the speed.

    The screenshots represents only a portion of the grid. The unit can move 4 squares in any directions. The first one shows the output of pathfinding from a clear tile. The second one shows the output of path finding if starting from a hindering tile on the second move command since the unit is half speed 4/2=2.

    Any pointer on how to implement this would be greatly appreciated. I think I need to modify Search and Add Adjacent Tiles Custom 1 but you would save me time if you have a hint for me.

    Thanks,
    Chris

    N.B. I made a mistake on screenshot 1. The unit can reach 14001 due to the diagonal entry but not beyond. Sorry.
    I am currently working on this problem. I will update this post when I have a solution.

    Leave a comment:


  • replied
    Hello Monokkel.

    I am trying to understand what I need to modify or create in terms of pathfinding in my game. You mentioned a video on pathfinding and edge costs at the very end of this one https://www.youtube.com/watch?v=r5j3...15jXKF&index=9 but I could not find it.

    I have a Title type with a Boolean variable called Hindering (represented by the blue tiles in my screenshot). I want the pathfinding to stop movement on those tiles and not go beyond if you start from a regular tile. If you start from an hindering tile, you can go anywhere at half the speed.

    The screenshots represents only a portion of the grid. The unit can move 4 squares in any directions. The first one shows the output of pathfinding from a clear tile. The second one shows the output of path finding if starting from a hindering tile on the second move command since the unit is half speed 4/2=2.

    Any pointer on how to implement this would be greatly appreciated. I think I need to modify Search and Add Adjacent Tiles Custom 1 but you would save me time if you have a hint for me.

    Thanks,
    Chris

    N.B. I made a mistake on screenshot 1. The unit can reach 14001 due to the diagonal entry but not beyond. Sorry.
    Last edited by Christian Beauclair; 09-07-2020, 11:46 AM.

    Leave a comment:


  • replied
    Originally posted by codeyhanson View Post

    I think this might a fix going to try and see if this works
    Ok I looked around to try to find out where to put this fix but im unable to find it im using the hybrid map if you could point me in the right direction so I can move that grid manager from 0,0,0 I just need to know where to put the fix sorry

    Leave a comment:


  • replied
    Originally posted by Monokkel View Post

    Ok, thanks for clarifying. Seems like I forgot to correct for the location of the grid in the experimental unit's SimulateMove function. Here is a version of the function where I've corrected for the grid's transform.

    Less certain about your other issues, though, as I'm not able to replicate them. Do they still appear if you use BP_Unit_Anim_Ex instead of your own custom unit? Also, what is the precise height of the box the unit is climbing and where have you placed the ladder blueprint's 3D widget?
    I think this might be a fix going to try and see if this works
    Last edited by codeyhanson; 09-07-2020, 03:14 AM.

    Leave a comment:


  • replied
    Hello Thank you for all your help so ran into another odd thing that is happening so if I move the gridmanger to any location other than 0 0 0 it makes it not work correct. is that correct?

    Leave a comment:


  • replied
    Originally posted by emmedand View Post
    Thank you for your answer, Monokkel! It's of great help.

    Yep, I guess that it can work. I'll try it!

    Actually none. I just mentioned it to give you a full overview

    Sounds great, I'll try to customize the blueprints as you suggested. Thanks again!
    Best of luck, and let me know if you have any additional questions!

    Leave a comment:

Working...
X