Search Unity

TurnBased-Toolkit (TBTK)

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

  1. Tarrasque

    Tarrasque

    Joined:
    Jan 5, 2015
    Posts:
    21
    Awesome, thanks for the tip! I´ll try to do it like this..
     
  2. OrionDesaul

    OrionDesaul

    Joined:
    Feb 23, 2018
    Posts:
    10
    Hello, how can I change unit stats in runtime?
     
  3. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    You get the reference to the specific unit instance and simply modify the value of the variable (stats) you want to change. Like so:
    Code (CSharp):
    1. public Unit unit;
    2.  
    3. public void Update(){
    4.     if(Input.GetKeyDown(KeyCode.Space)){
    5.         unit.damageMin+=10;
    6.         unit.damageMax+=10;
    7.     }
    8. }
     
  4. Wandersoul

    Wandersoul

    Joined:
    Aug 28, 2013
    Posts:
    35
    Wanted to check a couple things before I jumped in:

    1) Can the engine support alternating activations? (I move a unit, you move a unit, and so on)
    2) Can the engine be used without a grid? (as in tabletop gaming for example)
     
  5. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    1. Yes
    2. No. You will have to use either the square-grid or hex-grid.
     
    Wandersoul likes this.
  6. VFXROB

    VFXROB

    Joined:
    May 4, 2015
    Posts:
    27
    Hi Song!

    What would your thoughts on how you would make a crude faction selection that spawns in game.

    I can see this can get complex quickly with telling what faction is player, and the deployment points,

    (Just need your advice nothing too specific) i can then keep hunting the appropriate information. Thanks again for all your hard work!
     
  7. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm not sure what you meant exactly by 'crude faction selection that spawn in game'. I mean I don't know how it works in detail. Maybe you can clarify?

    However if it's not doing anything drastically different from the default faction, I would just extend/modify the default faction code to do the job. The problem of differentiating various faction in game is an inherent problem anyway regardless of the number of faction you are using
     
  8. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    TBTK v3.0 is now live on AssetStore!

    If you are wondering what's new, here's the big one
    • a new stats-effect-modifier/multiplier system that allow you to create various in game effects. These effects can alter almost any stats on a unit/ability and can be applied via any in game interaction like attack, ability, perk, collectables.
    • more game play customization option
    • better workflow for grid customization
    • better AI
    • cleaner and better optimized code.
    Please note that this is a new package. It's not backward compatible.
     
  9. VFXROB

    VFXROB

    Joined:
    May 4, 2015
    Posts:
    27
    Aw yeah! awesome song! congrats on the release!

    I was just trying to figure out the best way to change factions so picking say an icon would allow me to start with faction A, or Faction B. So change in units/perks.

    I understand without sufficient more knowledge of coding i cant make something this advance, but would like to get your advice on a simpler or more basic solution? (I understand you have just released your new asset, so answering this is extremely low priority!)

    Thanks again for all your work and patience! b
     
    Last edited: Feb 23, 2019
  10. VFXROB

    VFXROB

    Joined:
    May 4, 2015
    Posts:
    27
    Hey Song TBTK v3.0 is awesome!

    A few bugs i hope this helps (I'll just edit here if i find anymore):
    23/02/2019
    * Crash on completion of persistent game. Error below.
    image1.JPG
    *Projectile SFX are working but not assigned (this could be just my project though)
    *When generating obstacles they don't give cover bonuses with the cover system turned on.
    *Seems to be a few problems with the new faction manager.
    faction editor.JPG
    * Each tbsk menu in tools seem to be throwing a few errors each. Mostly with the below.
    GUI Error: You are pushing more GUIClips than you are popping. Make sure they are balanced.
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)
    * Minor encounter with xcom game with a unit in a wall (i'll let you know if i can reproduce it)

    unit in wall.JPG
    * And just randomly has tower defense here
    text.JPG

    24/02/2019
    * Green box causes a crash
    crash picking up object.JPG
     
    Last edited: Feb 24, 2019
  11. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for your feedback. I'll look into it.

    As for your earlier question, I'm afraid there's no way around it other than doing a moderate amount of coding. First you need to add faction identifier for each unit and perk. Then obviously you need a UI for the player to select a faction when the game start. Finally you need to change the runtime code to load only the unit/perk associate with the faction selected. All this is quite straight-forward to be honest but you will need to add a bunch of code in various place. Without sufficient coding knowledge, I imagine this would be quite challenging.
     
  12. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    @VFXROB, I've just uploaded a fix. Hopefully that should fix most of the bugs and errors you are experiencing. I have to say I can't replicate the 'generated obstacle not treated as cover' issue. Are you using the default obstacle or your custom one. If it's the later, have you add a collider to it and assigned appropriate layer to the prefab?
     
  13. VFXROB

    VFXROB

    Joined:
    May 4, 2015
    Posts:
    27
    Thanks Song!
    All those fixes are great, in regards to the obstacles (even the default cover) does seem to have the colliders and layer tag with full/half cover. This isn't an immediate concern for me at the moment i'm just adding in my custom units and testing the abilities. I'll re-address this later in the week and see if i can get it working on my own, i'll report exactly what i did if i can't/can.

    Only other feedback at the moment is assigning the unit.sc to a new model if you don't the shoot projectile empty the game the attack will cause a crash (this may cause some complaints from new buyers)

    Again thanks for all your work. For now I'm just going to modify your kit and worry about changing the code at a later date.

    Again awesome work! I love it! ps updated the bug post above.
     
  14. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks again for the feedback. I'll address those issues asap.
     
  15. VFXROB

    VFXROB

    Joined:
    May 4, 2015
    Posts:
    27
    Hey Song!
    Seems like a few settings from the previous version are missing, like the action cam, and min/max range.

    I'm currently trying to add in a min/max range for units, in the updated version of the tbsk it seems to be missing in the Unit Editor, and doesn't seem to change any values if i try and fix it in the unit inspector.

    Would you mind adding that back in when you have time?

    Also just checking I'm not sure a few things are working correctly,
    I have enabled counter attack, consume AP on attack and move\ in the game controls and in the unit editor giving the standard unit x2 attacks and X2counters. The unit can move and only attack once, no matter what AP i have used and no counters are triggered.

    Here is the video, the first half showing the generated cover system not working and the second half some of the game controls, hope this helps.

     
    Last edited: Feb 24, 2019
  16. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    The setting with Action-Cam has been moved to CameraControl for coding structure reason. Now the CameraControl is an optional component so user can remove it and use their own camera solution if they want.

    There's indeed some bug with minimum attack range and cover system. Weirdly the cover system only bug out on Unity2018.3, which is why I haven't been able to replicate it.

    I notice you have enable the option 'Enable Move After Attack' on GameControl. My apology, that is suppose to be 'End Move After Attack'. So if that have that enabled, your unit can only do one attack even if you have their attack limit set to >1. As for counter attack, I do notice that it trigger in your game on one of the unit (the mage?). However I'm only see you enable counter attack for the knight and unfortunately it didn't get attacked.

    Anyway, I'll get the bug fixed. Expect another update soon.
     
  17. VFXROB

    VFXROB

    Joined:
    May 4, 2015
    Posts:
    27
    Ah thanks Song!

    Thanks for pointing me to the camera controls. Also turning off 'end move after attack' has fixed all the extra and counter attacks so that's now working as intended.

    Found another bug, Projectile SFXs don't seem to be working, also units attack, hit and death sfxs in unit.sc, seems to be not working but movement does.

    Just a note, it also has the missing code you showed me so units with a range of 1 can attack distant targets in overwatch.
    'targetTile=unit.tile;' to line 185 in AIManager.cs

    Thanks again for all your help! BTW Action cam is sick!
    zoom action cam.JPG
    action cam2.JPG
     
    Last edited: Feb 25, 2019
  18. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    There's a bug with the unit attack sfx but the rest are fine as far as I can tell.

    Also the overwatch code are fine as far as I can tell. Do you notice unit attack target beyond their attack-range in overwatch?

    Anyway, another fix is up.
     
  19. VFXROB

    VFXROB

    Joined:
    May 4, 2015
    Posts:
    27
    Ah apologies its not over watch its counter attack, after the first initial counter attack the enemy will then attack a distant second target. Shown in the first bit of the video.

    The Knight is set 2 counter attacks
    red knight.JPG



    Yeah i'm not sure whats going on with projectiles, i downloaded a fresh version to test it and it does indeed seem to be working with the vanilla.
    (Just a note, in the video I had hooked up the audio in the sfx but just downloaded the update and must of removed them)
    I set up the below and tested it on all my catapults and archer units but seem to be getting no sound and no object appearing, their should be a large boulder (I've increased its size encase it was just appearing small and random other objects) Perhaps I've set it up incorrectly?
    Shoot projectile.JPG

    A random question in the latest update i've disabled unitDB in imports, as it wipes my roster, will this effect the updates?
    unit update.JPG

    Thanks again for all your hard work and for putting up with my constant nagging!
     
  20. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    If you don't mind, please send me your project (with your custom prefab and sound file). It's easier for me to find out what is going on. To keep the size manageable, you don't need to include the texture.

    As for the DB importing, yes just disable the item in DB_TBTK if you want to keep your setting. That shouldn't affect anything.
     
  21. VFXROB

    VFXROB

    Joined:
    May 4, 2015
    Posts:
    27
    Thanks Song! sending now.
     
  22. JeBuSBrian

    JeBuSBrian

    Joined:
    Mar 3, 2013
    Posts:
    15
    So, I bought this asset, but I cannot download it. When I look at its page on the asset store, it says it's 0 Bytes. I think your last update might have broken this @songtan
     
  23. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for letting me know. It has been fixed now. Sorry for the inconvenience.
     
  24. anato33

    anato33

    Joined:
    Jun 21, 2018
    Posts:
    6
    Hey, does this toolkit have any event or options to insert cutscenes or dialog set pieces during combat or even in between combat?

    If not, is there a current best practice to implement them in to a TBTK game? Thanks
     
    Last edited: Mar 8, 2019
  25. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    No, I'm afraid not.

    It's hard to say what is the best practice without knowing what exactly do you need. If you ask me this can probably be a standalone component that only require minimal input from TBTK, ie. when to trigger the event. So the most of it would be entirely up to you.
     
  26. anato33

    anato33

    Joined:
    Jun 21, 2018
    Posts:
    6
    All I would need is for when the battle is over, a visual novel style scene plays. It would need the ability to have an audio clip, but no dialog choices need to be made.

    It could even be just a video with the ability to pause or skip ahead.

    --

    Is code included for a FTL style level map similar to your game "Mechcorp"?

    Btw, the persistence demo doesn't seem to be working on your website in the chrome browser.
     
    Last edited: Mar 8, 2019
  27. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    If you want to keep it simple, you could just load in a new scene. Alternatively you can add a UI element that would pop up after the battle is over. Either way it's like I said, an independent component that you can do it however you like. Except to trigger it when battle is over, you call it from the GameOver() function in GameControlcs.

    No. MechCorp is a different project entirely. It uses a heavily modified TBTK for the combat. Everything else is built from scratch.

    Thanks for letting me know. I'll look into it.
     
  28. sisko89

    sisko89

    Joined:
    Mar 8, 2019
    Posts:
    20
    Hello,

    I'm thinking of using this asset for an online pvp game.
    How hard would it be to integrate online multiplayer? Any restrictions I should know about?

    Thanks!
     
  29. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm sorry to say I' know every little about networking and online multiplayer code. Therefore I can't really comment on how hard would it be to add online multiplayer integration. The only thing I can tell you is that I haven't consider about online multiplayer at all when writing the framework.
     
  30. sisko89

    sisko89

    Joined:
    Mar 8, 2019
    Posts:
    20
    Thank you for your answer, Songtan.
    I understand, I'll keep this as an option for now, I'll probably take the risk and go for it anyway lol.
    If anyone else reading this has any information regarding online multiplayer for this asset or for turn based in general, please let me know.
     
    MarStr likes this.
  31. Warsoul

    Warsoul

    Joined:
    Sep 9, 2016
    Posts:
    39
    I need a multiplayer version of this asset too, like many of us.
     
  32. OrionDesaul

    OrionDesaul

    Joined:
    Feb 23, 2018
    Posts:
    10
    Is there a list somewhere that describes the difference between the 45 dollar version and the 60 dollar version?
     
  33. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I don't have a full list I'm afraid.

    Basically the TBTK3 (the $60 version) is a new package for TBTK2 (the $45 version) written from scratch. They share more or less similar workflow but in term of code wise, the new version is much cleaner and better structured, better optimized too in some area. You will find it modify/extending it easier than the old one.

    The most notable difference with the TBTK3 is it uses a different stats system. Special effect like stun or dot no longer tied to the attacking unit or ability. Instead you create effects. These effects modify almost every aspect of a unit or ability in term of stats and they can be attached on a attack or ability. The new system is way more powerful than the old one, allowing more flexibility in customizing your game play.
    The rest are a series of improvement here and there. I can't remember all of them. On top of my head: the AI now uses a score based algorithm where you can adjust the weight of different criteria when the AI determine which move to take. There are new specialized ability type (charge, line-attack). And you can assign multiple obstacle and wall prefab to the GridEditor instead of being locked to one.

    If you are not aware, you can upgrade to the $60 version for $15 if you own the $45 version.
     
  34. ZieraZhong

    ZieraZhong

    Joined:
    Feb 19, 2019
    Posts:
    2
    great work!
    hi, just bought the kit today, so completely new to this, may bother u a lot from now on...
    first one is how can i add animation to my own unit? i drag some clip into animation section in unit editor,but nothing happened. do i have to do my own C# coding ? or is there any detailed manual except the PDF in the package?
     
  35. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for your purchase.

    All the details you need should be there in the PDF. You don't need to do any coding. You are probably just missing the animator object (the game-object that contain the Animator component on the model). You will need to specify that game-object on top of assigning the animation clip.
     
  36. bjornm87

    bjornm87

    Joined:
    Mar 18, 2019
    Posts:
    2
    Hi!
    when i add a object (like wall or obstacle) to the grid, how do i remove it?

    Best regards
     
  37. bjornm87

    bjornm87

    Joined:
    Mar 18, 2019
    Posts:
    2
    Also i get the following errors when trying to publish a fresh project(new project, import TBTK, upgrade and build)
     

    Attached Files:

  38. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Have you try right-click it when you are in edit mode?

    Try change line31 of both UnitDB.cs and CollectibleDB.cs to '#if UNITY_2018_3_OR_NEWER && UNITY_EDITOR '.
     
  39. OrionDesaul

    OrionDesaul

    Joined:
    Feb 23, 2018
    Posts:
    10
    Hello ! I’m using tbtk3 now. I’m working wth humanoid models ,but for some reason the unit won’t rotate towards its target , it will rotate slightly and then stop.
    (The rotations worked fine in previous version)
    Want I want to ensure is that the unit faces its target and then carries out its attack. Is there an easy way to do this?
     
  40. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    TBTK3 is not that different from TBTK2 in term of unit setup so if you have got the unit working in TBTK2 you shouldn't have any problem with TBTK3.

    Have you assigned any turret-pivot? You will probably want to assign the humanoid model in your prefab as the turret-pivot. Alternatively you can assign the prefab itself as the turret-pivot. If you have other object set as the turret-pivot, enabling the 'Rotate Aiming' option will probably help too as it enable the unit itself to rotate too instead of just rotating the turret-pivot-object.

    Finally, make sure your unit (and any turret-pivot) is facing +ve z-axis when the resting (rotation at 0, 0, 0). You can read the documentation for more detail.
     
  41. OrionDesaul

    OrionDesaul

    Joined:
    Feb 23, 2018
    Posts:
    10
    Thank you!! The problem was I had the wrong item selected as turret (the empty) it was causing all kinds of weird behaviors.

    I have two additional questions.
    1) when I select “generate grid on start” it erases my spawn points, is that working as expected?

    2) Attack delay doesn’t seem to have an effect when “has melee Attack” is checked, causing the attack to go off before the animation no matter how long of a delay I set. Is there a work around?
     
  42. uberwiggett

    uberwiggett

    Joined:
    Jun 26, 2015
    Posts:
    105
    Saw a new version and got a little miffed as I had the old one and having issues with it working in modern unity. But then saw you had an upgrade price which is reasonable as it seems you've restructured and made it look a bit more user friendly. Is it still designed more for strategy genre? Or does the new system make it easier to modify it to more rpg or gang warfare style genre (like mordheim or necromunda)? One big issue I had using non tanks was getting the movement and shoot animations to work ok without turrets etc.
     
  43. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    1. It should in most case retain your spawn points. However if the new grid has different size and dimension, the node may not match point to point and thus some spawn-point will be lost. If you want to retain 100% of your spawn point, try to make sure the node on existing grid, match the generated runtime grid point to point.

    2. There's a bug. The attack delay of melee and range has been inverted. It's relatively easy to fix. Open Unit.cs, change line926 to 'return animAttackDelayMelee;' and line931 to 'return animAttackDelayRange;'. That should do it.


    The new version is an upgrade serving more or less the same purpose. It has more customization option in term of designing your game. Animation wise, it's pretty much the same I'm afraid. Not sure what issue you have with the old version working on modern unity What version of TBTK and unity you are using. I've just recently updated the older version to work on latest unity.
     
    uberwiggett likes this.
  44. uberwiggett

    uberwiggett

    Joined:
    Jun 26, 2015
    Posts:
    105
    All good, I hadn't updated since a while ago so it wasn't functioning too well in 2018. I have just upgraded to 3.0 because I saw the XCOM level, which is pretty much the style I was after, but other than a script saying "xcom modifier" I am unsure of what the differences are for it, something about sight ranges etc, is it for when i right click on a unit?

    edit: also after some testing in the latest unity 2018.3.9 I am having some issues. Changing some attributes on Units in the unit menu sometimes randomly crashes unity, when i load back up, even if I have saved the Unit list, my new units are gone and when i go to add them, the prefabs have become corrupted. (only the ones I was editing during the crash).

    Also I have set my enemy ai (zombies) to have no ranged attack, but they continue to attack from the edge of their sight range. I have tried the min max range value to 0-0,0-1, 1-1. All three times they were getting within 6 tiles and attacking successfully. Not sure which value I need to alter to stop them from using ranged.

    video showcasing the ranged attacks
     
    Last edited: Mar 23, 2019
  45. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    The scene-modifier script is a simple hack for the demo scene. You will almost never need this for your own scene. You see I'm using a single set of prefabs for all demo scene. However I need them to have different stats across different scene. So I'm using the script to override their default stats value in each specific scene. In the case of the xcom, all unit's attack/move/sight range has been modified. Remove the script and you will find they all uses their default range value as specified in UnitEditor.

    I suspect the scene-modifier script the reason of your zombie range attack. Have you accidentally left one in your scene?

    I haven't encounter any problem with Unity2018.3 personally. But then I'm don't use Unity2018.3 every often when it comes to TBTK. Do you notice any specific during those crash? Like it crash when you edit certain attribute. Or it only crash under certain condition?
     
    uberwiggett likes this.
  46. uberwiggett

    uberwiggett

    Joined:
    Jun 26, 2015
    Posts:
    105
    ahh of course, silly me. I read the script and it sets the sight etc in it, just didn't put two and two together. my bad.

    As for the crash no it seems like a unity thing, it happens on the Unit editor window, sometimes it's when I drop a prefab or animation into the slot, sometimes it's when I pick an animation from the list, sometimes it's when I tick a box. It's random though, so I can't pinpoint an exact issue, but it has something to do with whatever is going on to change values and save them. I managed to get one of the units to save correctly, then it crashed on the next one, corrupting the file but the previous one was fine. If it happens again I will try and grab the bug report to send across to you.
     
  47. ZieraZhong

    ZieraZhong

    Joined:
    Feb 19, 2019
    Posts:
    2
    Hello songtan.
    I did a lot work on reading the code last week,you've done a really great job! Thing is I'm trying to add some my own stuff in it, such as character is acting not turn by turn, but based on a ATB system, adding some more ability type. Anyway, things go well mostly, but one thing bothers me is that I can't save the my custom parameters in Ability Editor.
    For example, I add a fan-shape ablity type,
    fan
    shape angle could be 60 or 120 degrees. I set a default 60 in Ability script, add additional fan shape angle label in AbilityEditor script, but
    ability is still going in the 60 way
    after I change the value to 120 in editor(or in element of AbilityUDB/FDB), only when I fix the number in Ability script, ability responses correctly.
    Appreciate your help!
    BTW, does the ability have its own script after you create a new one or it's just been added to AbilityUDB/FDB as an element?
     
  48. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Have you add the variable in Clone()? In runtime, you don't use the ability setup in the db. Instead, each ability in the game during runtime is a cloned instance of the one in the DB. So if you haven't add your custom variable in the Clone()function, it will always use the default value.
     
  49. OrionDesaul

    OrionDesaul

    Joined:
    Feb 23, 2018
    Posts:
    10
    Hello, in previous version (tbtk2) I made use of the " onMouseDown" function in gridmanager to do some extra functions in my game, when I upgraded to tbtk3 it seems that this function is no longer in gridmanager and possibly doesn't exist , with another function taking over. What is the function (and which script) it is move/change to? is it possibly called onNode in UIInput?
     
  50. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I took a look at the code of TBTK2. I don't see any onMouseDown() in Gridmanager. Maybe you are using an older version of TBTK2?

    I'm not sure what you want to do but yes you can probably try OnNode() in UIInput.