Search Unity

  1. How can our website serve you better? Give us your feedback. Take our survey and let us know.
    Dismiss Notice

TurnBased-Toolkit (TBTK)

Discussion in 'Assets and Asset Store' started by songtan, Aug 11, 2013.

  1. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    1. It depends on the asset you are using and how you optimize the appearance of the grid. By default, it should be able to do 100x100 on an average pc.
    2. Yes. All source code are included. You are free to modify it.
     
  2. Liberation85

    Liberation85

    Joined:
    Apr 16, 2019
    Posts:
    52
    @songtan What was the fix for the units moving through units bug? I would like to incorporate it.
     
  3. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Check MoveRoutine() in latest version of Unit.cs
     
  4. notmonica

    notmonica

    Joined:
    Mar 2, 2019
    Posts:
    1
    Hello! I'm trying to make a unit have an ability that can spawn units, but only on particular tiles - something like Phantom Brave where the character has to spawn other characters on items.
    I'm wondering if this is possible using the SpawnUnit ability, and if so, how would I get that to work? A couple options I was considering were either having the spawnable 'items' be a Unit that transforms into another (real) Unit, or seeing if there's a way to only target a certain type of Node when using the SpawnUnit ability.
    Thanks so much !
     
  5. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I'm not familiar with Phantom Brave but 'SpawnUnit' ability is what it sounds like, spawning another unit. Getting it to work is like any other ability in this framework, except you need to specify which unit the ability spawn. Unfortunately you can't limit the ability to target a certain node type except an empty one. That will require extra code modification.
     
  6. SolidLoL

    SolidLoL

    Joined:
    Mar 2, 2019
    Posts:
    3
    Hy just purchased the framework, looks really good. Is there a way to implement abilities that can be used on the enemy's turn?
     
  7. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I'm afraid not. The AI only works for basic movement and attack, not abilities. The reason being there's too many factors to consider given the ability can be configured to many different things. It's very difficult to have a pre-determined AI algorithm that can competently decide when and what to use the abilities on.
     
  8. SolidLoL

    SolidLoL

    Joined:
    Mar 2, 2019
    Posts:
    3
    Thanks for your quick reply, what I meant was is sort of like an interrupt mechanic. While the other faction is acting the player would be able to use certain abilities to counter-attack. Like in magic you can use certain cards even tho its the enemy's turn.
     
  9. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I see. I'm afraid not. The closest thing we have is overwatch (fire at enemy if they come into attack range).
     
  10. Liberation85

    Liberation85

    Joined:
    Apr 16, 2019
    Posts:
    52
    I tried a fresh install and it is still isn't working correctly.

    upload_2020-5-28_10-27-54.png

    The unit that gets passed through loses the unit reference in the node section.
     
  11. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I'm sorry I forgot that I haven't uploaded that fix. I've just sent you an pm about the fix.
     
  12. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    191
    Could you post it here too? Would be curious about looking into that myself too.
     
  13. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Just email you about it.
     
  14. Liberation85

    Liberation85

    Joined:
    Apr 16, 2019
    Posts:
    52
    @songtan New question for you.

    I'm needing to amend unit objects names in the hierarchy, changing the name is easy enough using "thisObj.name = thisObj.name + whatever.." But what I'm struggling with is finding a unique number to add on.

    I've tried instanceId but that changes every time the scene is reloaded, along with a few other attempts.

    The only thing I can see that stays constant is the unit list index number, although I can not seem to find anyway to access that.
     
  15. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Well, if it's the index you need, you can just loop through the unit list, then change the unit name based on the loop counter. Like this:

    for(int n=0; n<unitList.Count; n++) unitList[n].gameObject.name+=n;
     
  16. Liberation85

    Liberation85

    Joined:
    Apr 16, 2019
    Posts:
    52
    Cheers Songtan, that worked a treat!
     
  17. anato33

    anato33

    Joined:
    Jun 21, 2018
    Posts:
    6
    Hey, is the persistent demo working for you guys? I'm just getting a blank screen after clicking on it. The other demos work great.
     
  18. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    191
    It has worked fine for me in the past since that's the main scene I'm working with. Dunno if anything has changed, but did you go into it through the PreGame first and have both the PreGame and DemoGame for Persistant in the Scenes Build to swap between them.
     
  19. anato33

    anato33

    Joined:
    Jun 21, 2018
    Posts:
    6
    I just played through the x com demo and now all of a sudden the persistent demo is working for me.
     
    Stexe likes this.
  20. anato33

    anato33

    Joined:
    Jun 21, 2018
    Posts:
    6
    Is there a way to transfer skills or collectibles from one unit to another?
     
  21. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I'm afraid not.
     
  22. SolidLoL

    SolidLoL

    Joined:
    Mar 2, 2019
    Posts:
    3
    Can you help me with how to implement different area attack types like cone or circle?
     
    Stexe likes this.
  23. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    38
    TBTK 3.0 shaders are broken with the last Unity 2019.4 8f1. They are all Pink with URP.
     
  24. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    38
    UnitY_Turret2(Clone) shooting point not assigned by default

    In persistent game Pre-Game, the 7th unit wont show if purchased. The money is spent even if you reach the maximum units slots.

    There is a Discord server for your assets support ?
     
    Last edited: Aug 26, 2020
  25. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I'm very sorry for not responding. For some reason unity has stopped sending me any notification for new post.

    @SolidLoL, please email me with the specific and I'll see what I can do. However I must warn you it's probably not going to be straight-forward.

    @Warsoul, Thanks for pointing out the error. I'll get it fixed. Also I'm afraid the asset used in the package does not support either URP or HDRP. Feel free to use your own asset.
     
    Stexe likes this.
  26. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    191
    Would be useful for everyone if we could get cone and/or circle attacks shapes as well. I'd love to see how you approach some of those.

    I'm still working on my stuff, just been busy with other business at the moment. Keep up the great work though. =)
     
  27. sisko89

    sisko89

    Joined:
    Mar 8, 2019
    Posts:
    20
    I had already figured out the cone and circle shape attacks/abilities. I know everybody would prefer an official solution from songtan, but meanwhile you may want to try mine:
    (I'm using hex nodes, but the same logic should apply for squares)

    The circle shape is pretty straight forward. First, revise the code for area of effect abilities since we'll use it as a starting point.
    There's a GridManager method to get all nodes within distance, so for regular AOE spells you have:
    List<Node> nodeList=GridManager.GetNodesWithinDistance(node, aoe);
    A circle shape would be an AOE but removing the inner nodes and leaving only the border nodes, we can retrieve that using the same method.
    If for example you want a 3-node-wide circle, then...
    List<Node> nodeList=GridManager.GetNodesWithinDistance(node, 3);
    List<Node> innerList=GridManager.GetNodesWithinDistance(node, 2);
    nodeList will store the full node list.
    innerList will store all nodes except the outermost ones (since we are passing "2" as a second parameter, instead of "3").
    You make a loop for the nodes in nodeList, on each iteration, if this node is also in innerList, then remove it from nodeList. The loop finishes and nodeList ends up only with the outer ones!
    You could also get a thicker circle by increasing the difference in the second parameter between both GetNodesWithinDistance calls.

    The cone shape is much less intuitive but, after puting a lot of thought into it, I found a surprisingly simple formula:
    Again we'll use AOE for reference.
    If for example you want a 5-node-long cone, first you need to know which node will be the tip / ending point of the cone, in other words the FARTHEST node from the unit using the ability, so unit's location plus 5 in a certain direction. Let's call this node endingNode.
    Now you get an AOE of the full length (5 in this case) using endingNode as base. (sounds crazy, I know!)
    Then you get an AOE, also full length, using the caster as base.
    List<Node> endingList=GridManager.GetNodesWithinDistance(endingNode , 5);
    List<Node> sourceList=GridManager.GetNodesWithinDistance(srcUnit.node, 5);
    Then you loop endingList, on each iteration you check that this node is ALSO INCLUDED in sourceList, otherwise you remove it.
    You created two AOE 5-node-wide, 5 nodes away from each other. The nodes where they converge will form a cone shape!
    Plenty of possible customizations for this too, it's up to you to experiment.

    Hope you find this useful, keep up the good work!
     
    Stexe likes this.
  28. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I'm not quite sure how to interpret a circle shape area to be honest. I mean are we talking about nodes that form a perimeter from certain range away? Or a literal circle shape? Or just all nodes within a circle? What @sisko89 suggested is the former. On a hex grid, it will more or less look like a circle. However on square grid, the surrounding nodes are going to end up being a square.

    As for the cone, an easier, and more efficient way would be just get the nodes within range, then just check the angle of the nodes from the source node with respect to the angle of the target node from the source node. You can control the width of the cone by adjusting the cutoff threshold. I hope I'm explaining it adequately.

    Since I'm going to have the function anyway, I'll try to make these into one of the ability type. Expect that in the next update.
     
    Stexe likes this.
  29. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    165
    Hi Song, I have updated to version 3 of the asset, and I have to say for a total rewrite it is still buggy as hell with some of the same old problems. I changed the node size to 1.5 (nothing in the docs says I can't), but now when I move a player unit (humanoid), it oversteps the selected node and wanders off into the distance, on one occasion it even left the grid. This also has the effect of leaving the health bar on a node somewhere behind the toon. Is there somewhere to calibrate node size to movement, or should this be automatic?

    Secondly, once again your dedicated unit editor does not work properly - case in point, I drag in a shoot point, or target point, and it registers but does not show up in the relevant box - However, all info shows up no problem in the default editor in the inspector, making the default editor more reliable than the dedicated window, just like the last version. Also, what does "This T" and "This Obj" mean in the default editor? No tooltip.

    Do we still have a 'speed' option? The units move too fast for the animation - many years ago I sorted this one out with you when I ended up bug hunting etc for you (Unity 4 I believe), but now I don't see an option to adjust the movement speed.

    A lot of the stuff is still the same as the old version, so I'm disappointed that I am once again having to ask these questions and wait for a reply on what I thought was an updated, rewritten, better version. 15 bucks is 15 bucks (almost 20 here in Australia), but I really don't feel anything has changed from version 2, except for the ui. And btw, the folder named "Humanoid Unit" or something like that (I deleted it), did not have a humanoid example at all, which you still do not use in any of your demos. Thanks for your time.
     
  30. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I can understand your comment and I'm very sorry that you feel that way. Not every aspects of the toolkit is overhaul and depend on how you use it, it can indeed feel the same as the old version. But I assure you I've done a lot of work to to justify the upgrade. The old version has got to a point where it's just to difficult to maintain, extend or modify. The current version may works the same on the surface, but the code base is vastly different. It's done out of necessity for me to keep updating it. It's also easier for me (or anyone) to add new feature or do some custom modification. In the process of restructure everything, I've redesigned the stats system to support a new effect and perk system (it's vastly superior to the previous system). These are the two major improvements among other smaller things.

    I feel like I also need to point out the toolkit is released years ago (in 2013 I believe). Surely you understand that it takes work to support the toolkit, like making sure it's compatible with new version of Unity, adding various features or improvements. I don't redo the framework and charge an for an upgrade lightly. This is the one time I'm doing it and I don't see myself doing it again for another year or two at least. Consider all these, I think the pricing of the upgrade is quite fair.

    Regarding various problems you are having:

    I think this has nothing to do with the node size. My guess is you are running animation on the unit and have 'apply root option' turned on in the animator, causing the animation to drive the model out of position.

    I don't quite understand. You don't do any drag and drop for shoot-point or target-point assignment. There's a drop down menu that let you choose the target object.

    I take it you mean the Inspector? I don't mean for anyone to use the Inspector (that's why it's hidden in the first place). Everything you need for a unit should be in the UnitEditor. The rest are runtime variable. They are on display in the Inspector for debugging purpose.

    Yes, it's a private variable in Unit.cs, moveSpeed.
     
    Last edited: Sep 4, 2020
  31. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    165
    Yes you're right, in the unit inspector, it's not drag n drop, but a drop down, and same thing, whichever transform I select, does not show up (except in the default editor), even though, like I said earlier, it does register with the game. This does not occur all the time, but it does occur, and is frustrating when using the 'dedicated' editor, and have to check the default editor to see if it registered, like in the old days.
    That default editor setup is straight out of your earlier versions, and like I said, I find it more reliable than the others, which is a pretty sad statement, considering you say we are not meant to use them.

    I will have to check the root motion you mention, I haven't looked at that, thanks for pointing it out - (why isn't it mentioned in the docs, I have no way of knowing this will cause issues, prior to this I always used legacy animations), and as for the moveSpeed, I will look at changing that to a public variable, so I can use it to suit the unit. I think I remember you telling me the same thing years ago, but I forgot it after all this time :)

    I appreciate what you're saying about the rewrite, and I understand why you did it. I have no problem paying extra for it, but the new asset reads like it's a major do-over for everything, not just bits and pieces. I know how long you have been supporting/updating the asset, I was one of your first customers, hence my statement in the earlier email about bug-hunting for you in Unity 4 - check your gmail for back then - you'll find lots and lots of emails between you and Clem (not my real name, but my gmail pseudonym).

    Anyway, thanks for the quick response, I appreciate it, and please consider some tutorials or extra info about using humanoid/robot/whatever units in your asset, not all of us like moving vehicles around, and I'm sure there are a bunch of users who would appreciate it, seeing as this is still one of the best turn-based assets on the store.

    Thanks again for your time songtan.
    Cheers.
     
  32. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I see what you mean with the editor. I have to say I've no problem with the editor. Which version of unity are you using? I'll see if I can solve this. I suspect it has to do with the nested prefab.

    I'll add a note about the animation root motion in the documentation. I forgot to clarify about that the 'humanoid example' folder. It's just a folder for my own testing. I accidentally uploaded it and it stays there despite the fact that I have deleted it. I really like to include an example humanoid unit. Unfortunately not being a modeler or animator myself, I don't really have a animated model for distribution and honestly, a humanoid unit is really not that different from any other unit in term of animation setup. I'll send you one that uses a 3rd party model anyway.

    By the way, I'll change the move speed to a public variable in the next update.

    Finally, thanks for the feedback.
     
  33. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    165
    I'm using 2019.4.9f1. Glad you see the problem in the editor. No problem re the feedback, always willing to help. I have got my humanoid toons working, and you were right about the root motion, I turned it off, and all is good.

    I do have a couple of questions: I have a melee creep, and even though I set his maximum nodes per turn to 3, if I set his attack distance to 1 (for melee), on his first move after me, the ai moves all the way across the grid to within 1 node of a target, in one turn, and attacks, that's about 9 nodes. I set him up in the unit editor.
    Also, I have no nodes setup for collectibles or obstacles or walls in the grid editor, but every time I start a game, the ai plops 2 or 3 white cubes onto the grid, after the game starts, on the ai half of the grid. I have no idea what they are, they fill each node they are in; any idea what they are?
    Cheers.
     
  34. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I'm not sure if I follow you there, what is this maximum node per turn you are referring to. Is it 'Move Limit' you are referring to? Fyi, it's the amount of move action the unit can do in a single turn. There's 'Move Range' that determine how far a unit can move in a single move action.

    Well do they act like collectibles or obstacles? Do you have a screen shot? Do they look like any of the default sample wall or obstacle object? If none of those apply and you haven't add any obstacle prefab of your own, could they be a random object in the hierarchy of your unit prefab?
     
  35. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    191
    There are free humanoid models that are allowed to be shared that you could include so everyone has access to it easily.


    You might want to have it be a drag and drop option. In models with a TON of object hierarchies the drop down menu sometimes breaks.

    Overall on the asset, there's a lot of quality of life stuff that could be improved, but overall I'd say it works well and is a good starting spot, but definitely not an ending spot. =)
     
    Last edited: Sep 4, 2020
  36. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Personally I prefer the drop-down menu. It's just very cumbersome to drag and drop item from the prefab hierarchy. But I can see it could be a problem if you have a large hierarchy. I'll see if I can add support for both options.

    Btw If you have any other idea about the framework usability, I'm all ears!
     
  37. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    165
    That is without doubt the most ambiguous statement I have ever read, which is what I thought when I saw it in the editor...wtf is the difference? Fyi, they are both set to 3, because they sound like the same thing.(see screenshot).

    I am still testing, I have made no prefabs except for the creeps, and if all options for any of those are "zero" in the editor, why are they appearing on the grid? It's too early for me to fiddle with all that other stuff until I know the basic system works. No one has any abilities, and all obstacles/walls etc are turned off in the grid editor. (See screenshots).
     

    Attached Files:

  38. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    165
    Oh, and here is a screenshot of why drag n drop would be better.....
     

    Attached Files:

  39. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Sorry for my poor explanation and allow me to clarify, if you issue a move command to a unit, that's one 'move' action. Issue another move command again, that's another 'move' action. How many of these command you can issue within a single turn is determined by 'move limit'. 'Move Range' as the name suggested is how far (or many nodes) a unit can move, within a single move command. It's two variables that do very different thing. Now if you set both to 3, the unit will be able to move up to 9 nodes in a single turn (3 actions x 3 nodes). If this is not clear, it works like the 'Attack Limit' and 'Attack Range'. The former being how many time you can do the action, the later being the reach of the action.

    The 'cube' items you see on the grid are the default collectibles. You may have disabled 'Generate Collectible On Start'. But that doesn't stop them from generate on new turn if they are enabled. You need to turn them off by disable the 'Generate In Game' option on CollectibleManager, or just deactivate/delete CollectibleManager all together.

    Yes, following @Stexe comment I'm aware that drop down menu might not be applicable in all cases. Like I've said, I'll fix that.
     
    Stexe likes this.
  40. wheelbarrow

    wheelbarrow

    Joined:
    Sep 12, 2011
    Posts:
    165
    Ok, that clears things up a bit, he moves normally now, thanks for explaining that, and the pop-up issue. Sorry I never looked at the collectible manager, like I said I'm more fixated on making sure the basics work before I get into the other stuff.
     
  41. sisko89

    sisko89

    Joined:
    Mar 8, 2019
    Posts:
    20
    Hi Songtan, I have a question regarding your AI AnalyseAction function:

    Right now I'm working on allowing the AI to use abilities (of all kinds, but for now lets focus on direct damage spells).
    It loops through all possible actions and assigns a score for each one, just like with regular attacks. However, I'm calculating the score based on total damage, while your code for attacks base it on efficiency (the ratio between base damage to damage to a specific unit, correct?).
    Some units are able to use both damage spells and normal attacks, so to make them decide correctly between all options, I need to have everything based either on absolute damage or damage efficiency.
    Updating attacks to work with absolute damage would be easy, but I can't help but wonder why you did it that way. What's the advantage of working with proportional values? Can you think of any reason not to use absolute values?
    You are obviously far more familiar with this than I am, maybe you saw something that I'm missing. And on such complex topic, I rather get it right from the start.

    Thanks a lot!
     
  42. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I suppose by proportional value you mean the damage score is based on damage relative to the target hp?

    Well the advantage of using that is the AI will try to inflict damage where it matter most, in most case anyway, taking out the weakest unit. See if you use direct value of the damage, a unit with x damage will get similar score against a hostile unit with x-hp and another hostile unit with 2x-hp. When you use proportional, in the same scenario, the unit would get a score of 1 against the first unit and a score of 0.5 against second unit. Making it more likely the attack the first unit (the weaker unit).

    Obviously this is just a very generalized logic based on tactics of taking out the weakest unit to rapidly thinning enemies rank. It's doesn't always work and it's not even the right approach in some case but it's something I myself would try to do most of the time. So I figure I'll have the AI do that too.

    Hope this make sense.
     
  43. sisko89

    sisko89

    Joined:
    Mar 8, 2019
    Posts:
    20
    Thank you for the quick reply.

    What you said about prioritizing killing weakeat units makes perfect sense, I shall apply that logic regardless of the method.

    But I don't think the actual code is doing any of that... I'm looking at this:


    Code (CSharp):
    1. if (attackNodeList.Count > 0) {
    2.                     if (unitDamage <= -99) unitDamage = (unit.GetDmgHPMin() + unit.GetDmgHPMax()) * 0.5f;
    3.  
    4.                     for (int n = 0; n < attackNodeList.Count; n++) {
    5.                         AIAction action = new AIAction(walkableList[i], attackNodeList[n].unit);
    6.  
    7.                         Attack attack = new Attack(unit, attackNodeList[n].unit, walkableList[i], false, false);
    8.                         action.score += (0.5f * (attack.damageHPMin + attack.damageHPMax)) / unitDamage * 100 * instance.damageMultiplier;
    9.                         action.score += attack.hitChance * 100f * instance.hitChanceMultiplier;
    10.                         //action.score += attack.critChance * 100f * instance.critChanceMultiplier;
    11.                         action.score += coverScore;



    So... unitDamage = (unit.GetDmgHPMin() + unit.GetDmgHPMax()) * 0.5f;
    Meaning unitDamage stores the average damage this unit can make, right?

    Then, action.score += (0.5f * (attack.damageHPMin + attack.damageHPMax)) / unitDamage * 100 * instance.damageMultiplier;
    From that I understand that 0.5f * (attack.damageHPMin + attack.damageHPMax) is the estimated average damage for that specific attack (after applying damage types and other factors, against a specific target).
    So it divides (estimated damage against specific target) / (unit's base damage) resulting in the efficiency (shown as ratio) of a potential attack, that's what I ment when I said proportional values.

    Am I missunderstanding your code? I don't see any references to potential target's hit points or anything relevant to killing weakest units as you said in your reply... Where should I look for that? Now I'm even more confused lol
     
  44. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Yes, you are absolutely right. I miss-read the code (must be tired late last night). Sorry for the confusion, I apologize for that. Now that I have the idea, I might add that as an option for future update.

    Anyway, looking at the code (again), my reason behind this is to normalized the score for all the factors being considered. They all take value range from 0-1. This way the multipliers are being applied at a even weight. Make sense?
     
  45. sisko89

    sisko89

    Joined:
    Mar 8, 2019
    Posts:
    20
    haha no worries, glad we are on the same page now

    Yes, makes sense now.
    For the original script, your solution is good enough. But now that I'm adding abilities and other stuff I'll definitely prefer absolute values rather than 0-1... to many possibilities, can't be simplified. Thanks for clearing the doubt.

    Details aside, the AI script saved me a lot of work, great stuff!
     
  46. Tarrasque

    Tarrasque

    Joined:
    Jan 5, 2015
    Posts:
    21
    Hi songtan, just saw that there is a new update and haven`t had time to start looking into that yet, but I just wanted to ask if different areas of effect (cone, circle etc.) are included in this update?

    Also, this might have been asked before, but any plan / advice how to make bigger units than one tile? Like a knight with a horse would take two squares or hexes and a giant or dragon could take 4 etc.
     
  47. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    For your first question, yes. There's a new ability type cone which applies the attack/effect in a conical area origin from the unit. Obviously for that I've added a function that return a list of nodes that forms a cone in GridManager.cs, GetNodesInACone(). There's also a function that return a list of nodes that outline an area within range from a node, GetNodesInACircle(), probably not a very fitting name. I've decided against having that function built into existing ability type. Using the existing code as example, you should have no problem using those functions to create new ability of your own.

    For your second question, I'm afraid I don't see that happen the foreseeable future. I really like to do it but the problem is I don't really have a readily available solution that I know, let alone implement it. I'll have to spend some time to do some research on the subject.
     
    Last edited: Sep 16, 2020
  48. pzolla

    pzolla

    Joined:
    Apr 21, 2020
    Posts:
    2
    The cone and circle attacks/effects is something that was on my list as well so thank you for that.

    Similarly, the bigger units is also required in the long run for the game I want to create. I suspect many of us are working off of the same 'playbook or rule sets'. Here is an quick article on how one company decided on hexes vs squares but note the use of the three hexes for huge creatures.

    https://www.realms-beyond.com/combat-system-hex-square/
     
  49. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Thanks for the article. I'll check it out.
     
  50. Stexe

    Stexe

    Joined:
    Feb 2, 2014
    Posts:
    191
    Generally, "bigger units" work as normal sized units except occupy all squares/hexes at once. If something would affect one of the grid spaces then the whole unit is affected. Likewise, generally, a larger unit uses any of the grid spaces it wants for targeting purposes. So they are usually easier to hit but also easier to hit others.

    You also get into issues with units moving or not moving through larger units. Lots of other considerations need to be looked at too. Do they block movement? Have blocking line of sight? Can they twist their shape if they are rectangular or oddly shaped? Etc.

    Some systems have it so when the large unit moves they "collapse" into a smaller size and then "expand" as needed when their movement ends (with some saying that the unit can't move to a location if they couldn't fully expand) -- but for those that allow that you run into a lot of complexities such as how to account for overlapping units and/or pushing units out of the location (D&D 3rd, 3.5, and 4th edition cover some of these ideas).

    I'm a game designer myself and all this info also comes from my years of playing D&D (2nd edition to 5th edition), playing a huge number of tactical grid games, and working on some Card Hunter stuff.

    I don't think I'd have much use for large sized units, but it seems to be a common request. Probably a lot of work though to account for all the edge cases.
     
unityunity