Search Unity

TurnBased-Toolkit (TBTK)

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

  1. Gosuneo

    Gosuneo

    Joined:
    Nov 22, 2013
    Posts:
    6
    Can you upgrade your project for Ngui 3+ or provide a HowTo or separate scripts for the current version of Ngui ?
    Do you think you will add a network based multiplayer mode in the future ?

    Thanks.
     
  2. jakieb

    jakieb

    Joined:
    Nov 11, 2013
    Posts:
    11
    I am really interested in this, are there plans for supporting 2D? Would sprites work?
     
    Last edited: Dec 26, 2013
  3. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Sorry for the slow respond guys, I've been away for the past two days.

    @im, Thanks for your kind word. :)

    @Gosuneo, I dont understand if you want to have 2 version of NGUI working in the same project or build a new UI script that works with NGUI3. The former is not possible, you can only have 1 version of NGUI in any project. But you can certainly create scripts that works with NGUI3. But that would require you to upgrade to NGUI3 of course. I'm considering to add support to NGUI3. The problem is I can only have a working example of NGUI with the project. With NGUI3 the package wont be self-contained (there's no free version for NGUI3 so I cant include one in the package). Unfortunately I dont really have plans to add any network multiplayer support. It's no secret that I myself knows nought about network coding. Very sorry to dissapoint.

    @Jakieb, It doesnt support 2D by default and I dont really have plans to that. However it will work just fine with some minor tweak. That involves setting the camera to view from a top-down angle and depends on what sort of 2D you need, you may need to disable the unit rotation to face their target or move direction. This can be done fairly easily. The only tricky bit is if you want to use sprites, then you will need a sprite system. Which you can get from a 3rd party package, or writting your own.
     
  4. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    @Songtan, I'm thinking about using another camera system for the main camera mostly because I need something that does partial transparency of scene objects that are blocking the view of the units... would it break a lot of the system to use is different system or is it an easy replacement?
     
  5. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I'm not sure how you are going to do the transparency so I wouldnt know for sure. As far as I know most of the stuff in game are independent of the camera. Except maybe actionCam. Even then that can be disabled. So I imagine it should be fine if you are planning to just work on the camera.

    If you are referring to actually change the material or the transparency of the object in the game. I'm sure that should be fine as well.
     
  6. Gosuneo

    Gosuneo

    Joined:
    Nov 22, 2013
    Posts:
    6
    @Songtan,
    i tried using ngui3 without success so i now use version 2.xx instead.
    However, if you have some time left, a short video on how to modify the GUI, how to change icons font and update the CustomAtlas without breaking it would be greatly appreciated.
    Do you have any plans about implementing a save / load system ?
     
  7. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I dont think I'm the best person to do a video about using NGUI. Even now I have to resort to trial and error some of the time. :)

    Anyway there's a lot of tutorial video you can watch on the offcial NGUI site - http://www.tasharen.com/?page_id=140. I would recommend you to start with this one - http://www.youtube.com/watch?v=OT0hTxjjkY4. It should show you how to work with the atlas. The video is for NGUI3 but the earlier version is very much the same.

    Sorry again to say, I have no plan to implement save/load system.
     
  8. ssh83

    ssh83

    Joined:
    Dec 29, 2013
    Posts:
    1
    great stuff! I bought this after fiddling with the free version of tower defense. I saw a lot of magic number in the code but overall good foundation so I bought this kit since it suits my needs better.

    What's the future road map for this kit's development? The list on your blog page is all crossed out.

    Can I request more UX polish such as camera control using mouse?

    Also stuff like hovering over a skill to show its range on the map would be really nice. Hotkey system for the abilities. in-game keybinding.

    They sound like chores, but that's why buying a kit is attractive even for developers who can make things on their own. Paying money to save time! I think these kinds of polish will add more value than game-design specific things like AI and unit types (likely to be scrapped). It will also make the kit's demo look even more impressive and attract more buyers.

    Anyways, please keep up the good work!
     
  9. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Glad you like the kit and many thanks for your comment. The next thing I'll probably work on is NGUI3 support. While I'm at it I'll probably do more polish on the details. Such as camera control like you suggested.

    Other than that, I dont see any major addition coming soon to tell you the truth. I'm planning to take a break from this project to work on something else. But I've always been open to suggestion and feedback. So there's no telling I'll put something in it if I get an idea or two. Plus the other thing that I'll be working on have some close tie to this so I'll probably need to revise it and add more stuff as I go. We'll see.
     
  10. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    @Songtan any possibility to get the "knock back tile" code anytime soon? and any chance of having the ability to spawn a collectable added by you? I was able to make changes for adding other types of buffs to the code but having trouble with that one
     
  11. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I'm currently busting my ass on building a NGUI3 compatible UI. The goal, ideally is to try support both old NGUI free and the new NGUI full at the same time. Not sure if that can be done but support for NGUI3 will come. That's the top priority for now. After that, I'll definitely work on the procedural generation of collectible item on the grid (I take it that's what you meant?). The "knock back" is kind of tricky tho as I'm still not entirely sure how best to approach it. So I'll can only promise you one thing for now. We'll see how it goes. If all goes well, it should all be done within a week or two.
     
  12. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    Hey Song, no problem... thanks for the response. And in regards to spawning collectables, it's more along the lines of the same way you can spawn a UnitTB (Turret) not really procedural generation. Thanks again and as all ways amazing work!
     
  13. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Can I ask how exactly would you want to spawn collectible in runtime? Is it like a random drop kind of thing? Are you just asking for a function call to spawn a collectible? Or you need a unit ability that does that?
     
  14. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    A unit ability that spawns a specific collectable, just like the spawn turret ability
     
  15. Lypheus

    Lypheus

    Joined:
    Apr 16, 2010
    Posts:
    664
    song do you support:

    1. multihex sized mobs i.e. a dragon sized mob, with pathfinding?

    2. configurable hex sizes?
     
  16. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    @Lypheus Songs' tool kit does not support multihex mobs but you can configure the hex sizes
     
  17. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    @E1iTe, hm... unit ability that spawn collectible eh? I'm struggle to see why's and how it's going to be useful. A direct ability to a specific unit that do just about all the thing a collectible can do, and more. Anyway, I'll do what I can. Thanks for answering Lypheus question tho. :)

    @Lypheus, it's just like E1iTe saids. Unit that occupied multiple tile is no supported but you sure can configure the tile size and spacing.
     
  18. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    Hey @songtan, I'm working on a weapons system and I'm trying to tie into the list of Damage Types from your DamageTable but I can't find the method to access the list of Damage types from my script. Can you steer me in the right direction?
     
  19. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    The only way to get the whole list is to load from the "DamageArmorListPrefab" component in the Resource folder. However for runtime, you can add this function in DamageTable.cs:

    Code (csharp):
    1.     public static List<DamageType> GetAllDamageType(){
    2.         return dmgTypes;
    3.     }
    That should allow you to get all the damageType via a function call.
     
  20. Player2D

    Player2D

    Joined:
    Feb 2, 2013
    Posts:
    50
    hello @songtan!
    New update?
    what changes?
     
  21. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Here:


     
  22. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    I believe Song will be releasing another update pretty soon that will also include NGUI 3+ compatibility.
     
  23. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    For now I'm focusing on adding support for NGUI3, and possible unity GUI. Other than that, not much is changed. just some small details here and there.
     
  24. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    If anyone is interested, I came up with a rudimentary way of playing an animation for abilities. What it does is to check and see if there is an animation clip on the idle animation object with the same name as the ability. And if there is it will play that animation then go back to idle. I've tested it quite a bit and haven't found any problems so far but use at your own risk! If you do have any problems, let me know and I'll see what I can do. Anyway, around line 1706 of UnitTB.cs (in the AbilityActivated function) add the following code:
    Code (csharp):
    1.  
    2. if(animationTB.idleAniBody  animationTB.idleAniBody.animation[uAB.name])
    3.         {
    4.             animationTB.idleAniBody.animation.CrossFade(uAB.name);
    5.             animationTB.idleAnimation.CrossFadeQueued(animationTB.idleAniClip[0].name);
    6.         }
    7.  
    songtan, if you would rather I not post this, let me know and I'll remove it.
     
  25. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Of course not, thanks for sharing! :)
     
  26. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I am changing the miss chance of the abilities to use the Ranged attack chance of the unit (or trying to anyway).

    Would changing this line do the trick?
    Code (csharp):
    1. float missChance=unitAbility.missChance;
    Also, would I need to use this

    Code (csharp):
    1. float missChance=attRange;
    or

    Code (csharp):
    1. float missChance=1-attRange;
    I think I need to use 1-attRange because it looks like the ability check actually looks to see if you missed and the attack looks to see if you hit. So I think an attRange of .8 would need to be changed to .2 in the miss chance.

    Hope that makes sense!

    Thanks!
     
  27. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    You are on the right track there, but I would suggest you to use.

    Code (csharp):
    1. float missChance=1-GetRangeAttack();
    Using the GetRangeAttack() function will take account of the perk and various condition that might modified the unit's original value.

    However becareful tho, if you just modify that line as it's. you are using the target miss chance instead of the miss chance of unit that use the ability (attacker). To really use the miss chance of the attacker, you will be better off modifying the ability miss chance before it's applied to the target. Note that all the ability used will be cloned and the cloned instance will be applied to the target, you can directly modify the missChance of the cloned instance. Like so:

    Code (csharp):
    1. UnitAbility abilityInstance=unitAbility.Clone()
    2. abilityInstance.missChance=1-GetRangeAttack();
    3. StartCoroutine(targetUnit(abilityInstance));
    The example code may not match the real code exactly but you get the idea. You may need apply this to many area of UnitTB.cs
     
  28. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    I certainly want to use the attacker skill to determine if it hits! When you get a chance, can you show me one place that I would have to change? I can't quite figure out where I need to change to set the miss chance before it's applied to the target. I think it needs to go somewhere around line 1625 where it checks to see if the target type is Hostile, but I'm not sure exactly.

    Thanks again!
     
  29. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    I'm afraid it's not just line1625, there are quite a handful of them. Basically all the line that contain this "ApplyAbilityDelay(unitAbility.Clone())" should be changed. It also depends on your wanted application. You can see for yourself what are each line is conditioned for. Some are for hostile target, some are for friendly target, some are for empty tiles... I'm afraid you will just have to do a search through all of them and apply the change on things you need.
     
  30. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Oh yeah, I realize that. I just needed to know if I was on the right track and was just using that one as the most obvious place to me. I think I get it. Basically that whole line of StartCoroutine(tile.unit.ApplyAbilityDelay(unitAbility.Clone())) is what I will be changing in all the places I want to use the attRange. When I do that, do I still need the float missChance=1-GetRangeAttack(); around line 1766 or can I block it off?

    Sorry if I'm being a bit dense. Some things I get quite easily. Others, not so much.
     
  31. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    No, you can just leave the line you originally modified as it's (float missChance=unitAbility.missChance). Now this line by default is taking the miss chance value from the ability instance. Since we have modified the value of the ability instance before that line of code is executed, it should take whatever value we modified it to.

    It's ok to ask. I understand this bit of the code is not that straight-forward.
     
  32. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,063
    Thanks! I understand now.

    edit: done! Only thing I had to change was to replace "targetUnit" with "tile.unit.ApplyAbilityDelay".
     
    Last edited: Jan 11, 2014
  33. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Hello folks, I'm pleased to annouce that a new TBTK is now live on AssetStore. The main addition are the NGUI3 and Unity default UI support. I'm guessing that it will be very useful to most user. Enjoy! Please visit my website for more details about the update.
     
  34. barjed

    barjed

    Joined:
    May 9, 2013
    Posts:
    70
    Hi Songtan,

    I am building a small turn based in my spare time and was looking at your Asset. I have already bought the Tile Based Map And Nav - https://www.assetstore.unity3d.com/#/content/2392. I wasn't, at that time, aware of your TBTK.

    I am willing to buy TBTK but I was wondering if you could kindly answer some questions that would help me decide whether to stick to TMN and build upon it or swap to TBTK. I am a professional business C# programmer so I am not afraid of scripting but I would rather limit it as much as possible. The way I see it your kit solves a ton of problems but it seems to cater (in terms of game logic) to a very specific kind of TBS game. TMN is more bare bones because it handles only grid generation and navigation but that makes it potentially easier to extend (and integrate important things for me like PlayMaker).

    - is it possible to separate the modules of this kit? For example, let's say I want to use grid generation (tiles, obstacles, navigation) only and add new game and UI logic.

    - you have already mentioned that, while detachment of NGUI is possible, it's very difficult and that worries me. I would rather use DFGUI. How difficult would it be to make a swap?

    - your game logic is tailored to "Advance Wars" style of play, more strategy than RPG. How difficult would it be to create significant changes to the logic: more complex stats, mana based resource system and inventory in particular.

    - does your kit support flying (or water, or anything based on terrain/tile type) units?

    - does the cover system work for obstacles that do not adhere to the shape of a tile? For example, a cylindrical mesh?

    - this was already asked and answered - you do not support PlayMaker. However I am curious if other users tried to integrate your kit with it. Did it work for you guys? Was it difficult?

    - which animation system is supported - is it Legacy or Mecanim?

    Thank you for your time!
     
  35. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Hi Barjed,

    Thanks for your interest. To answer your question:

    Apart from the UI, none of the component are made to be modular. However not all of them are tightly integrated so it's still possible to get rid of some of them, if you are willing to do a little code modification. I suppose gridGeneration is the relatively easier bit of the framework to be separated from the rest.

    That is no longer the case. With the latest update, NGUI is enitrely optional. In fact, the default base framework no longer use NGUI. It has a GUI solution that uses Unity defalt GUI. You only import another package (inlucded by default in TBTK) which contain NGUI component if you wish to use NGUI. So you can start right away with DFGUI if you wish. The only tricky bit remaining would be to understand which function to call from your own GUI. However since you know about C#, I imagine it shouldnt be too difficult to look at the code from the default GUI script and pluck what you need.

    In my opinion, the current stats (damage, hit, critical, defense, etc.) are fairly simplistic compare to most of the established game out there. You can easily modify the existing system. The tricky bit would be the turn-based logic such as which player/unit's turn to move, when a unit has exhaust it's turn, wating for a unit to finish counter-attack, etc.. I'm sure you can see where this comes from, given the framework supports quite a lot fo different rules. As for inventory, there isnt one to begin with.

    Unfortunately no.

    The cover system are tied closely to the tile/grid as such that it's collider based and very much tile dependent. These collider are predefined on the obstacle prefab as well as procedurally adjusted during runtime. The mesh are just there for visual feedback for the user and has no bearing on the gameplay. So long as you setup the collider correctly, you can use whatever mesh you want.

    I'm afraid I have no information on this. I dont know anyone who is actively trying to do so.

    Legacy

    Hope this answer all your questions.
     
  36. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    @Songtan - I think I found a bug in the new system. I'm using the NGUI pro version/scenes and went into build manager and added the correct scenes (instead of basic) then I tried the Mini Campaign from the main menu. After I get into the first battle I placed my units and then went to options and restart. After replacing the units the game starts and a unit is selected but you cannot perform move a unit. The error thrown is: MissingReferenceException: The object of type 'tile' has been destroyed but you are still trying to access it. But besides that GREAT update per usual.

    @Barjed - I also came over for TMN, I feel that this system is A LOT more flexible then the former system hands down. But I do miss some features from the previous: Different tile types like Air/Water/Grass etc that limit movement for certain unit types which adds a lot more strategy. I also redid the game handler in playmaker for TMN but haven't dived fully into it with TBTK because the code was changing often I probably will integrate some playmaker features to my game but most of the things I did for playmaker in TMN are not needed for TBTK because you have the option to change them in the inspector. I do wish the kit also supported Mecanim but @drewradley's fix for playing ability animation is working ok for me. I've also extended the Kit some by adding more stats to another script and it basically updates the UnitTB script from TBTK with some of the values that are needed in UnitTB, so I don't think it would be to hard for you. My only hurdle now is adding the buff/debuffs I added to my inventory/equipment to be recognized by the same system TBTK uses. But Song has been AMAZING with the support so I really think you will be happier with his system over TMN imo
     
  37. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Thanks for the clarification and the feedback about the bug, @E1ite. I'll look into the bug. Please try not to restart the scene in the mean time. :)
     
  38. barjed

    barjed

    Joined:
    May 9, 2013
    Posts:
    70
    Thank you guys for your answers.

    I am convinced. I will buy your asset because it seems like a wonderful tool. Shame about the Playmaker though. I will try to create some PM actions myself. I will share it with you guys as I progress.

    One more question out of curiosity - does the cover system support flanking in the spirit of Xcom? In other words, is the unit in cover always in cover or is the cover ignored when being shot from a flank?

    E1iTe - is your inventory system custom made or did you use some premade asset?

    Thansk!
     
  39. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    @barjed The cover system is similar t0 Xcom, and I've developed my own inventory system, and i'm finishing up on the weapon generator portion. I was going to start working on PM after I got the inventory/weapon/armor/consumable portion out the way but if you get PM integration going maybe we can trade some code
     
  40. denijn

    denijn

    Joined:
    Dec 19, 2013
    Posts:
    1
    Hi Songtan,

    Bought your package a few weeks ago and i like it... Now i'm exploring the options of the pack a little. I like the flexibility of the ability editor, big plus for chaining different unit abilities. But at first sight i'm missing the option to assign a passive ability to an unit. There's only directpositive/negative, buff and debuff and as far as i understand you'd have to activate them all ingame? Also it would be great if targettype for the abilities could be set to a specific type(s) of unit(s). That way one could e.g create a turret capable of shooting only planes. Or e.g having a vampire that regens only when he bites living units. Maybe i'm missing some of the options. Any ideas?

    regards,

    Stijn
     
  41. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    I also agree, I wish the ability to have a target type as I wanted an ability to only affect a certain type of unit. I started implementing a way of adding passive effects because of the weapon system I'm creating... it's a long way off from complete. I wish it came standard in the kit
     
  42. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Unfortunately the unit ability are intended for active ability only. There is however a perk system that is intended for passive buff. You can passively modify the certain stats of all unit or a specific unit type. It's not quite the same as having the ability directly on the unit itself but functionally it's the same.

    While you can set the perk target type to certain unit, you cant do that with unit abilities. As great as that sounds, I dont have plans to do that in the near future. In fact I'm planning to take a short break on project after the recent fury of updates. Feel free to modify the code to suite some of your purpose. It's actually way easier to script some specific pre-set condition like the vampire regen ability then to modify the existing system to accomodate all the possibility with such new option. I'll be happy to provide support should you need any.

    Sorry if my respond isnt any help.
     
  43. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    @Song can you give some example code for how to add/remove a perk to a unit through code? I want to see if I can use that to add buffs to my weapons that could be equipped. It may be a little messy but I think it may work out.
     
  44. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Well, for a start perks are not added to the a unit instance. For each unit type, the PerkManager store a list modifier of all the stats (HP, damage, critical, etc.). These modifiers are modified by as the relevant perk get unlocked. When the unit is about to execute an action, it calls the relevant function in PerkManager to retrieve the corresponding modifier, and use that in any subsequent calculation. And that's how the perk modifier comes into play. As far as the unit instance is concern, there's no addition/removal of perk. The code for the retrieval of the perk modifiers are around line2230 of UnitTB.cs.

    As for how the perks are added to the PerkManager. You can refer to static function UnlockPerk in PerkManager. Bascially all the perk you configured in PerkEditorWindow are pre-loaded to Perkmanager. When unlocked in run-time, PerkManager simply check the perk as unlocked and modify the corresponding modifier value.
     
  45. Player2D

    Player2D

    Joined:
    Feb 2, 2013
    Posts:
    50
    Hi songtan
    Please tell me where to edit distance for melee attacks
     
  46. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    In UnitEditorWindow of course, just set the unit AttackMode to melee and you will see the option.
     
  47. Pathlesspath

    Pathlesspath

    Joined:
    May 8, 2013
    Posts:
    13
    Now your TBTK can't port to mobile platform ?.
    Maybe if i adapt input for mobile. Recommend or not?
     
  48. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,738
    Fyi, TBTK is mobile compatible from the get go. You dont need to change any of the input. Of course unless you want to. I managet to run the demo scene on my rather old iPhone4 without any problem.
     
  49. Pathlesspath

    Pathlesspath

    Joined:
    May 8, 2013
    Posts:
    13
    Thank you Mr songtan. i love TBTK. Keep moving...
     
  50. BBORNCR

    BBORNCR

    Joined:
    Jul 28, 2013
    Posts:
    16
    I seem to see some bugs using the NGUI Full Hex Scene. The HP/AP indicator always is offset, it always reads "25". Also the floating "Missed" and "Hit" numbers do not appear.

    $Screen Shot 2014-01-16 at 8.46.21 AM.png
     
unityunity