Search Unity

  1. Unity 2019.2 is now released.
    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,363
    Right, I remember testing it and it worked. Probably something I added later break it somehow. I'll look into it and get back to you. Please be patient.
     
  2. InsaneGoblin

    InsaneGoblin

    Joined:
    Jun 2, 2013
    Posts:
    239
  3. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,059
    Thanks!
    Any thoughts on why the GUI is interfering with the tiles?
     
  4. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Alright gents, I fixed the bug with teleport. I figure I'll get the issue with button solved before I send over the fix. Thing is, I myself dont have any problem with the buttons, on either Unity3.5 or Unity4. Did you guys modify any of the buttons? To make sure it works, you need to assign the whole UI gameObject under a similar, unique layer. Then, the buttons have to contain a collider component. What I would suggest is check with the example, see if that those in the examples work?

    @InsanceGoblin, I never have any problem with AI freezing. Unless it's a turn logic bug of some sort which I've seen a lot during development phase. For me, either it freeze or go berserk in the first round, or I finish the game without a hitch. I have to say to use the map size which you are using, the performance will take a huge hit to start with. So it could be due to the sheer size of the map that create all sort of problem.
     
  5. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,059
    I haven't touched the GUI at all. I'm using an example. Just added my own units and some props and noticed it was activating the square under it. I keep an unmodified version to check things and it works fine there. I'm updating to 4.3 and will check after that.
     
  6. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,059
    heh. Sometimes the answer is so simple. I simply put a cube on the main camera and blocked off a small area where the icons go. Probably a better solution, but this is a good placeholder.
     
  7. WitchKing

    WitchKing

    Joined:
    Jan 4, 2013
    Posts:
    13
    Hmm, I already had that turned on. For the first turn, all units still start with zero AP, but fill up fine on subsequent turns. What's also weird, is that this only happens on new unit's I've created, even with default settings. If I replace one of these new units with one of the original supplied units though, they start off with full AP, even though both units have all the exact same settings.

    A couple more issues I've had are:

    I've assigned the Build Turret ability, without changing any of it's settings, to one of my new units. In-game the AP are deducted, but no unit is spawned.

    I've added custom icons for the new units, but when the game starts and the player places their units, the info panel still uses the icons of the original tanks. Also had issues with icons for new abilities not displaying at all, just a grey box.

    Thanks!
     
  8. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    @drewradley, that works too I guess. Seems a bit strange with the inconsistency for the original solution.

    @WitchKing, the AP issue seems like a bug to me, I'll look into it. The spawn ability, like the teleport is bugged at the moment. I already have it fixed and I'll upload an update soon. For the icons, you need to manually add the new icon to NGUI atlas before it will show up properly.
     
  9. Geoffc

    Geoffc

    Joined:
    Feb 4, 2013
    Posts:
    16
    Can something like "TNet: Tasharen Networking" be used to assist with the creation of a muftiplayer environment for this kit? I noticed you have added a hot seat multiplayer mode since this discussion first came up but have you looked into any network or LAN playability at this stage?
     
  10. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,059
    It's very strange. I spent a good deal of time trying to figure out why it was happening. On the default toolkit samples it works fine but on the version where I have added units, props and re-sized the grid, it stops working. I am uncertain at what point it stopped working. I can experiment with a fresh install and see if I can figure it out if that will be helpful to you. At least I found an easy and fast solution.
     
  11. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    I cant tell for sure. I'm not familiar with the kit. I think it will be useful in some way. But I still dont have plan to add any cross machine multiplayer. It's one thing to use a in house code which I can maintain myself and another thing to use a 3rd party code. I have no control over that and I wouldnt want my toolkit to be dependent on another package to be fully functional.


    Yes, if you ever find out what is the problem, please let me know. I'll fix it if there's anything I can do about it.
     
  12. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,059
    Well, I figured it out pretty quickly. The NGUI read me in the one that doesn't work says 2.7.0 and the one that works says 2.2.6c. Don't know how I over looked that yesterday.
     
  13. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    hm... I dont think that will make any difference. My guess is the issue has everything to do with the collider and layer. Anyway, I'll look into it.
     
  14. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,059
    All I did was change to a different NGUI and it stopped working properly. Put the older one back in and it starts working fine. Just glad I have an older version to use.
     
  15. Artemyst

    Artemyst

    Joined:
    Nov 14, 2013
    Posts:
    10
    Songtan,
    First of all thank you so much for your kit. It is allowing me (noob with coding) to go much further than I thought I could ever go into unity.
    I just ran into a small bug that is a bit upsetting.
    When in Ability Editor, I add an effect in "effect target" to a new ability and it doesn't show in-game. However it works fine with premade abilities :(
     
  16. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Thanks for bring this up, just in time for me before I submit a fix. However I didnt manage to replicate the bug. It could be due to other setting such as require target select flag, effect type, target type and so on. Can you please send me a screen shot of your ability setting in the editor so I know what are the exact setting you are using? Thanks.
     
  17. Artemyst

    Artemyst

    Joined:
    Nov 14, 2013
    Posts:
    10
    $Block.png

    In the above case, I want a debuff (so it lasts more than one round) and affects all units within range.
    If I put target all units, swamp effect only works on self but not target.

    If I put target all tile, the swamp effects works on target but i run into another problem. It only affects my own units and not opponent.
    Also when i select one of my units affected by the ability, it stills highlight places where i can move and if i click to move the game stops working. I cannot pass turn, etc...

    Another thing i tried, is a direct negative ability, to all units. Again, swamp effect to target is not working. It is the closest to what i want to do but how do i go about making it last a few turns, not forever?

    I am trying to make an aoe ability that would stop all units within range to move for a selected amount of turn.
    Maybe it shouldn't be a debuff but how do i go about making it last a few rounds?

    I hope I am clear, thank you so much for your fast reply even though I understand you are working on other projects.

    P.S: Is their a way to make idle animation start at random time so all units with same animation are not perfectly in sync?
     
    Last edited: Dec 1, 2013
  18. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Hm, very strange. I've give it a go and everything works for me. Target AllUnit puts the debuff on all the unit and neither me or the AI can move. DisableMovement has no effect when targeting AllTile (as intended), but it doesnt break the game for me. Both AI and I can still move and play on just fine. Probably I've fixed the bug while working on some stuff. Are you using the latest version available on AssetStore? At any rate, you can email me so I can pass you my copy to see if that's really the case.

    To do what you need, you need to a Debuff type and target AllUnits (or Hostile if you want to affect hostile only). Direct effect will not persist through round. You have probably noticed this, but EffectTarget will only shows when your ability require a target. In your case, EffectSelf is what you should be using.

    To put a slight delay to idle animation, you need to modified UnitTBAnimation.cs. Grab line167-171 and put them into a coroutine like this:

    Code (csharp):
    1.     IEnumerator DelayIdleAnimation(){
    2.         yield return new WaitForSeconds(Random.Range(0f, 1.5f));
    3.         if(idleAnimation!=null  idleAniClip.Length>0){
    4.             int rand=Random.Range(0, idleAniClip.Length-1);
    5.             idleAnimation.Play(idleAniClip[rand].name);
    6.         }
    7.     }
    and call the coroutine where the original code is, like so: StartCoroutine(DelayIdleAnimation());
     
  19. Artemyst

    Artemyst

    Joined:
    Nov 14, 2013
    Posts:
    10
    thank you so much!
     
  20. Artemyst

    Artemyst

    Joined:
    Nov 14, 2013
    Posts:
    10
    Me again :)
    Found out that dodge chance ability only works for melee attack. Abilities or range attack seems to go through.
    Hope I'm not doing something wrong.
     
  21. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Thanks to you I've found another bug. However it's not about dodge chance tho. Dodge effect work fine for me. All range, melee, and ability does miss when I apply the ability to a particular unit. Mind you ability doesnt use the target dodge change to calculate miss change unless you specify otherwise (by checking "stack with dodge" when enable miss).

    I should explain that positive means increased dodge and negative means otherwise. It take value -1 to 1. With 0.1 mean 10% increment, -0.5 means -50% and so on.
     
  22. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Sorry guys for being a bit slow but it's finally up. v1.0.4f2 is now live on AssetStore. It should have fix all the problems reported post v1.0.4 release. There's also some minor tweak here and there.
     
  23. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    @Songtan - anyway to block movement between two adjacent tiles?
     
  24. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Unfortunately, not possible by default. Unless you do some code modification. What you need to do is to remove the neighbouring tile from the neighbour list in both tile. The variable are hidden in inspector so you cant see it. So the easy way would be to remove [HideInInspector] in line36 of Tile.cs. Then you can edit the neighbours of each tile directly in Inspector. Be warned this is very tedious and error prone. A better way would be to add in the editor functionality to allow you to remove the neighbouring tie of two adjacent tile. But then this could be a lot lot more complicated.
     
  25. yaapelsinko

    yaapelsinko

    Joined:
    Nov 16, 2013
    Posts:
    102
    From what i've read in manual, each scene must have the only TBTK object, right?

    Is it possible to make scene (an real-time adventure map) with several TBTK grids, each activated by its own trigger (like when player reach one)?

    One way is to create separate scenes, one for adventure map, many for battle arenas, and load them when needed.
    What if i want to integrate battle arenas right into adventure map?
     
  26. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Sorry for the slow respond.

    You cant have multiple TBTK grid (or arena as you put it) in one single scene. The code simply doesnt work that way. It assumes you have only one grid in the scene. You will have to modify a lot of code to support multiple grid in a single scene. But you can certainly do it the other way round like you put it. So you have a adventure map, then load into each battle scene when you need them. That is how it's designed to work anyway.
     
  27. yung

    yung

    Joined:
    Nov 22, 2010
    Posts:
    274
    Hiya Songtan,

    Any chance of having height worked into your turn based toolkit?
     
  28. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    I afraid not. Do you need specific mechanic tied to the height difference? If no, you can manually adjust the height of each individual tile. It's a bit tedious but it's certainly manageble given the limited grid dimension. I dont think the kit can support anything beyond 50x50.
     
  29. MatthiasDeo

    MatthiasDeo

    Joined:
    Mar 16, 2013
    Posts:
    10
    Just wondering if this would work for something like a fallout 1 style movement and combat system. If not how much tweaking would the code need to get it there?
     
  30. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    It's a bit embarassing to say that I've never play Fallout1 2 so I'm not familiar with the movement and combat system in details. From what I gather in the youtube video that I can find, I think TBTK should have no problem replicating that, or at least get close. That is in term of the general turn-based and movement rules. As far as the details like damage/hit/ciritcal/etc.. calculation goes, I dont think they are identical in anyway. TBTK is fairly simplistic in that regard. It's hard to say but I suppose if you are profficient enough with coding, changing the existing system wouldnt be too difficult. But I should also say that doesnt mean it's a quick job.

    Sorry for the generic answer, I hope I didnt confuse you.
     
  31. MatthiasDeo

    MatthiasDeo

    Joined:
    Mar 16, 2013
    Posts:
    10
    Thanks for the response, I've had a bit more of a look at your toolkit and seems like it would handle the combat elements pretty much spot on. It seems to me that the hardest part would be setting it up to work in a large seamless scene and implementing the non-combat rpg elements.
     
  32. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Well, I dont see how you can rework it to run with free-form rpg elements and seamless combat/non-combat transition. It's not designed for that in the first place. Imho, It would be much easier and efficient if you start fresh and build a turn and grid system with that in mind.
     
  33. drewradley

    drewradley

    Joined:
    Sep 22, 2010
    Posts:
    3,059
    I don't have seamless transitions from combat to non-combat and back since I load a different scene but I have managed to add free-form RPG elements by combining this kit with one of the RPG-kits in the store and writing a simple script to pass information back and forth at the start of each screen. I can actually have two combat systems in my game sharing the same information about what abilities they have and what hit chance they have. It's not perfect - and I haven't even started to share inventory yet and am imagining an uphill battle - but it can be done, more-or-less. It's just quite a bit of work. Still much less work than writing everything you have done with the TBTK though.
     
  34. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    Anyone else having issues with adding their own Select/Cursor/Hostile indicators? I even tried to copy the current ones, rename them and then add the renamed back as prefabs but once I start the game the Y Position keeps going to 99999 for the indicatorCursor prefab.
     
  35. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    The indicators will always be positioned at (0, 9999, 0) to avoid being seen in the scene when they are not in used. When you actually select a unit, or have targetable hostile, etc., the indicator will be then be positioned accordingly. Have you tried play the scene and check if the indicator works?
     
  36. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    Sorry it was late, yes I did try running a scene and that's where my issue is. If I select non (so it uses defaults) it works fine, but if I use a copy of the default renamed to something else as a prefab I see nothing.
     
  37. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Fyi, the default indicator, without the adjustment dosnt goes with the grid setting of the example scene. When the script loads the default prefabs (if the slots is left empty), it will auto adjust the setting on the ParticleSystem so that everything looks fine. But if you assign a custom prefab, the script assume you want to keep your setting and thus will use it as it's. You can drag the prefab into the scene and see for yourself. So if you wants to use a custom indicator, you will need to configure it so it work right out off the box with your grid setting.
     
  38. toto2003

    toto2003

    Joined:
    Sep 22, 2010
    Posts:
    501
    hello songtan
    does this kit take in account the height like in final fantasy tactics?

    regards
     
  39. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Unfortunately no, sorry to dissapoint.
     
  40. yung

    yung

    Joined:
    Nov 22, 2010
    Posts:
    274
    Hi songtan,

    regarding the same question, is there any plans to look into taking the height into consideration?
    Would it be hard to implement it ourselves?
     
  41. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    I have to say I dont really have any plan at this point to add height difference to the grid. Even if I do, it will most likely just for aesthetic sake.

    As for how hard is it to implement it, it's difficult to say. It very much depends on what do you want out of it and how profficient you are at coding. If It's just for looks, then it's pretty easy. But if the height difference is going to affect the gameplay mechanic, obvioulsy things will be much more complicated.Let me know your idea, perhaps I can give you some hint how to go about it.
     
  42. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    In regards to height would it be difficult to have a mechanic that has a value you can set like [.5], and a unit has a vertical or jump distance like [2] and able to attack up to [3]. So as far as movement it can travel between tiles of any difference of [2] or below. and as far as attacking it can be next to a tile (or what ever it's melee/range/hybrid distance is) and attack anywhere up to [3] above or below. Then the level can be made with height differences of [.5] increments. Is that difficult? I'd probably assume so.

    Also: Do you know off hand of where you keep the order of units? i'm hoping to take that list and be able to show attacking order by a button. Great work on the progress you made in your game from your blog! I wish the weapon fields made it to TBTK :( i'll try my hand at doing that my self this weekend. My goal is to be able to equip a weapon for main hand and off hand, which could change the units basic attack type from a distance of 2 to maybe 3 or equip a ranged weapon... we'll see how it goes because I would also like to have the weapons have buff/debuffs also...
     
  43. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    I wouldnt say for sure until I really dig into the code. I imagine I'll run into one or two path-finding issue and that could be very difficult to solve. Also I think if I'm going down that route, I'll have to do tons to tweaks to many details. Animation support, range calculation across high/low ground, aoe with height difference, etc. Otherwise it wouldn't make much sense. So forgive me for saying that I'm not keen to get into this at the moment. The good news is, I'm working on a wall system on top of the obstacle system. It should be ready for the next update pretty soon.

    For unit order, depends on what turn mode you are using. If you are using FactionBased turn mode (the first three), first you will need to get the faction in question. You can get the faction by calling UnitControl.GetFaction(int factionID) with factionID being the ID assign to the faction. You can then acess the faction allUnitList. The list contains all the unit of the faction and should be arranged in their move order. If you are using UnitBased turn mode, you can get the full unit list by acess UnitControl.GetAllUnit(). It will return the list of the all unit in the scene in thier suppose move order.

    The game I showed on my blog does not in any way works with TBTK yet. The plan is to be able to use TBTK for the battle scene as it's, or at least with minimum modification. So hopefully there wont be any change done to TBTK. One way you can do this is to set up unit ability as normal attack, and disable the default attack by setting the attack range to zero. Obviously I havent try this out yet so there might be some complication that I havent thought of.
     
  44. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    If a new update is coming soon anyway quick way to add an ability to push a unit back a certain number of tiles? and maybe add damage type to abilities? Just wishful thinking!
     
  45. yung

    yung

    Joined:
    Nov 22, 2010
    Posts:
    274
    @songtan,

    Basically I am just trying to clone X-Com, but with mechs! So I think the height will at most grant bonuses to hit and would also provide further sight range. It does seems like it will require a lot of work to get it to work.
     
  46. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    @E1iTe, fyi damage type for abilities is already there. I will think about knock-back but it probably wont make it to the next update. So dont count on it.

    @yung, yes and as I've explained. Add in full support for different height is quite tricky. But tile with hit and sight bonus is already supported by default if I remember correctly. What you can do is to manually adjust the height of the grid and modify the hit and sight modifier on the tile accordingly. Very in X-Com with mechs. I'm making one myself. Feel free to show yours.
     
  47. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    OK, thanks no problem. Once last thing can you point me in the right direction for adding adding a new ability effect? I just noticed I can't do the last of my planned abilities because I can't spawn a collectable :( so I'm guessing I will be able to find the code from the grid manager that puts a collectable on the grid and then copy some of the code for spawn target which is a UnitTB type. I've been getting my hand dirty a little expanding on the wonderful tool kit that you created already but was waiting for the updates to slow down because I didn't want to have to diff all my changes back in each time.
     
  48. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Very sorry for the slow respond, somehow your post slipped past me again. Adding a new ability will require some effort. You need to modify the code over quite a number several scripts. First you need to add the new type in UnitAbilityManager.cs, then the editor support to modify the new ability relevant variable, if there's any in the UnitAbilityEditorWindow.cs. Finally depends on how the abilities work, you will need to add the new code in UnitTB.cs and other relevant scripts. In the case of adding a new collectible, you will add to add the functionality in GridManager to register spawn a new collectible on a selected tile, called from UnitTB when a target tile has been selected.

    Btw, the new update should be up in a day or two.
     
  49. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,363
    Merry Christmas to all! The new update is now available on AssetStore. The change logs are as follow:

    addition/change
    • added wall system, now support wall between adjacent tile
    • new wall system is integrated to existing cover and line-of-sight system
    • duration tracking for various ability/collectible effect has been reworked
    • SelfDestruct script has been updated to work in tandem with the new duration tracking
    • added support for manual faction's color assignment
    bug fix
    • fix a few editor bug with grid/unit generation
    • fix some bug with unit-abilities
    • fix bug where abilities duration doesnt work correctly when using turn-mode that isnt round based
    Since it's end of the year, I'm doing a sale for all my packages on AssetStore for the ocassion. Dont miss out!
     
  50. im

    im

    Joined:
    Jan 17, 2013
    Posts:
    1,393
    hey @songtan happy holidays

    thanks for the sale i got your other asset and i really like it...