Search Unity

  1. Unity 2019.1 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,340
    Look for the game-object "UIObject/CanvasMain/UnitOverlay" in the scene. There should be a component UIUnitOverlayManager on it. From there you can set the hostile health bar color by changing the color for HostileHPColor.
     
  2. NeocityEntertainement

    NeocityEntertainement

    Joined:
    Nov 10, 2017
    Posts:
    2
    Hi Songtan !

    Thx for your great asset but I have the same UI problem as Helios23 posted Sep 19, 2017 !

    "After selecting a Unit and viewing their info then closing the info screen, if i select any other unit or even the same unit, and click the question mark button again, the main screen becomes greyed out but no info is displayed. If i scroll around the screen eventually i can find the close button which appears when mouse is over it but otherwise nothing else appears", except the blury effect.

    Could you help us ? I tried to look the code but nothing strange in for me (i'm not very expert in coding).

    Thx a lot.
     
  3. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    Try disable line208 of UIUnitInfoScreen.cs. That should do the trick if I remember correctly.
     
    NeocityEntertainement likes this.
  4. NeocityEntertainement

    NeocityEntertainement

    Joined:
    Nov 10, 2017
    Posts:
    2

    It works very well with this solution.

    Thank you very much.
     
  5. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,051
    c-Row likes this.
  6. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    Nice job!

    I doubt I'll have time to play it. But if you have an extra key, why not? I'll be happy to check it out. :)
     
  7. Binokle

    Binokle

    Joined:
    Jan 4, 2018
    Posts:
    1
    Hello!

    Maybe this question is already asked but can I get a look at the API documentation before buying asset?
    I've noticed from the forum that documentation exists but I can't find the link to it.
    I think the toolkit looks great but I have some doubts about its ability to customization.
     
  8. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    There's a documentation (here's the link btw). However I'm afraid it doesn't contain any info about the code or API. It more like a manual. You will have to dig into the code itself for customization. I can't guarantee it's hassle free process. But with the way code is structured and commented, you should be able to find what you need. If not, I'm more than happy to answer your email.
     
  9. Ttravi

    Ttravi

    Joined:
    Jan 22, 2018
    Posts:
    28
    Hi, do you framework support 2D games?
     
  10. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    In term of game mechanic, you should have nor problem getting it to work as a 2D game. However, it doesn't quite support full sprite-display (for instance, have the sprite to face the correct direction in isometric view). It's all about the camera angle you want to use really.I if you are going for a top-down view, the framework is fine as it's. Otherwise you might have to do a little modification. Hope that answer your question.
     
  11. Ttravi

    Ttravi

    Joined:
    Jan 22, 2018
    Posts:
    28
    Absolutely, thanks man.
     
  12. eajones

    eajones

    Joined:
    Aug 1, 2013
    Posts:
    45
    I was wondering if the TBTK could be used in the development of a board game. Something like the board game "Kingdom Builder". I'm hoping to get a hex map that involves placement of pieces initially based on tile type (wood, desert, etc), but which also allows card-driven options to occur--examples: to build anywhere along a diagonal or straight line from a currently-occupied hex, or to allow a previously-placed piece to "jump" to occupy a hex 2 pieces over. This would not be an attack-driven game, but one where piece placement would have to follow certain rules.


    Can this be done, and if so, is that a coding option currently available with the package, or where can you direct me to find how to do this?


    Thanks!
     
  13. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    I have to say I'm not familiar with "Kingdom Builder". But I can tell you what you need is not supported by default. It can be done but you will probably need a considerable amount of modification. I'm not aware of any other framework that do this But then I don't really pay a lot of attention to other framework.

    Truth is if you are looking to implement a very specific rule set that is unique to a game, you probably have to code it yourself or modify existing framework.
     
  14. MicrobicWalnut

    MicrobicWalnut

    Joined:
    Apr 23, 2017
    Posts:
    2
    Hi songtan,

    First of all, thanks for making this awesome mod! You're obviously very talented and have gone through a huge amount of effort to create this. I have 4 questions and 1 request. To give some context, I am trying to make a turn based MOBA (I know the framework does not currently handle networked multiplayer but I'm going to try and get around this).

    Question 1: How do I spawn groups of units every x number of turns? I have set up the spawn areas and spawn groups, but I can't find any place to specify when to spawn the units.

    Question 2: Can I make two or more factions allies, so they don't attack each other? The reason is I want multiple players on the same team not to be able to attack each other, and more importantly, I want AI controlled minion factions on each team that don't attack allied players.

    Question 3: Can I make it so that movement anywhere up to the unit's max move speed only costs 1 AP, no matter how far? The idea is I want the player to have 1 AP each turn to spend on moving up to their max move distance OR attack, but not both.

    Question 4: Is there a way to make player turns end as soon as they've used up all their actions? It's a bit cumbersome having to press "end turn" every time when there is nothing else I can do with my turn anyway.

    Request:
    I would love the framework to support online multiplayer out of the box without me having to implement it myself. If you ever get around to doing this, I'd be extremely grateful :D
     
    Last edited: Apr 15, 2018
  15. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    Thank you for your kind words. Let me say up front that if something is not supported by default, you can modify the code to do just that. If you want to do something specific but not sure where to start, let me know and I'll point you in the right direction.

    Question1: The spawn area and spawn group are used in procedural generation, when you try to generate a random grid or when a level with random hostile unit and placement starts. To use that info to spawn unit during gameplay, you have to add that function.

    Question2: It's not supported by default but it should be relatively easy to do. You can create a variable to store the factionID of an allied faction on each faction. Then add that to the condition check to determine if a unit can be attacked or not. There is another problem with allied faction though. The game determine the game over state by checking the number of faction remain. So that will have to be taken in account to. Otherwise you will have 2 factions that can't attack each other on the grid and the game over state won't be triggered.

    Question3: Again it's not possible by default due to the way the ap cost is coded. But this can easily be changed.

    Question4: Well, It's possible but it's not really feasible. In certain setting yes. But imagine a design where a unit has multiple abilities that user may or may not want to use depend on the situation, or where faction abilities is used. Then most of the time there will still be possible action available to the player. I would say that most design would end up with this situation where auto end turn wouldn't be used at all. This is why I choose not to implement this. But if you want to do this, it's not too difficult as well.


    Finally, online multiplayer is something I would very much like to support. Unfortunately I don't know much about network coding so doing so it out of the question I'm afraid.
     
    MicrobicWalnut likes this.
  16. MicrobicWalnut

    MicrobicWalnut

    Joined:
    Apr 23, 2017
    Posts:
    2
    Awesome stuff. Thanks for the quick reply! Guess I've got a bit of coding to do haha :)
     
  17. MJacobsen186

    MJacobsen186

    Joined:
    Aug 28, 2015
    Posts:
    21
    Hello @songtan ! I recently bought your turn-based toolkit and I've been experiencing some issues.

    I was exploring the kit's functionality and created a custom unit based off of one of the prefabs provided in the project. Following that I created a new faction ability that would spawn the newly created unit. After creating the faction ability it was automatically added to every faction's ability list. I have a feeling that this is not intended behavior.

    Also, after that ability was added, I was no longer able to add abilities to each faction. Even after making a new faction completely (to test it) I was unable to change the default faction abilities (and the new ability was automatically added to the list for the new faction as well). The drop-down list would appear but no matter what you select it will not be added to the faction's ability list.

    Even after removing the newly created faction ability I was still unable to change the faction ability list in the faction editor window.

    Any help with this would be greatly appreciated!
     
  18. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    Well, I'm afraid any new faction ability you created will be automatically added to all faction. This is the default behavior.

    Have you tried add/remove faction abilities before the new ability? Can you remove existing ability now? If yes, can you add the removed ability back to the list? If you can do this, means everything is working correctly

    Thing is certain ability have the option 'Only Available via Perk' checked. That means they can't be added to the faction right from the start. They can only be added during runtime when player unlock the perk associated to them. Most of the existing faction ability have this option on so I suspect you that's the reason you can't add them. You can take a look at the console. Is there any error/warning message. A warning message should pop up in the console if you try to add an invalid ability to the list.
     
  19. MJacobsen186

    MJacobsen186

    Joined:
    Aug 28, 2015
    Posts:
    21
    Thank you for the quick reply! You are absolutely correct! The abilities I was trying to add as a test were only available through the perk system. I apologize for taking up your time with such a silly question. I read through the documentation first too. It just didn't occur to me while I was actually playing around with it.

    Thanks again!
     
  20. nemesiscy

    nemesiscy

    Joined:
    Aug 6, 2014
    Posts:
    6
    There's an issue where :
    - i created four factions(one player, 3 AI)
    - in the scene i have Player deployment and one AI deployment setup in the grids.
    - when playing, the only AI in the scene will take up the other 2 AI faction's turn, and will have 3 turns to move and attack.

    Just wanna ask did I miss out any settings that caused this issue?
     
  21. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    I'm not sure too be honest. It could be a bug too. I'm currently away from holiday so I can't confirm. Can you let me know what is the turn mode you are using? I'll try to find out as soon as I can when I'm back next week. Sorry for the inconvenience.
     
    Last edited: Jul 10, 2018
  22. nemesiscy

    nemesiscy

    Joined:
    Aug 6, 2014
    Posts:
    6
    Thanks for the quick reply. Im using FactionPerTurn and Move Order : Free.
     
  23. xuan_celestial

    xuan_celestial

    Joined:
    Jul 17, 2018
    Posts:
    2
    Hi Songtan,

    I would like to know how can I implement AI using abilities instead of just normal attack in my game. I saw there is a portion of code commented under AIManager.cs where the AI are using abilities, but they are detecting enemy range using normal attack range, how can I make the AI use abilities?
     
  24. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    I don't remember having anything in the default AI code that use ability. You have probably misunderstood the code.

    To answer your question, it's not going to be easy to have the AI use abilities. There's no one definite answer and there's no short answer either. Basically you need an algorithm for the AI to determine if there's a situation appropriate to use the ability. Since each abilities does different thing, you will need an algorithm for each ability you want the AI to use. On top of that, you want the AI to be able to evaluate the different option available (choose between available abilities and attack).
     
  25. xuan_celestial

    xuan_celestial

    Joined:
    Jul 17, 2018
    Posts:
    2
    Thank you for your fast reply, I will look into deeper and see what I can do for it.
     
  26. banksazero

    banksazero

    Joined:
    May 8, 2015
    Posts:
    65
    Hi there
    I have a ton of questions


    I would like to make a turn-base game than player control 1-10 groups of heroes each group has 1-4 hero and own inventory
    Each hero have individual abilities and player have abilities that independent with other hero
    Game Play
    1.Can I assign each hero have their type, element ?
    2.Each element or type have their weakness and can learn some abilities ?(like water win against fire damage * 2 or melee unit can't attack flying-unit)
    3.How much AI complexity is.Can I set AI when hero LV <"AI-3" chase or when hero hp lower than 50 percents chase or use this abilities or when AI is chased AI call other group to join.
    4.I would like to assign something like add delegate is this possible ? (add check event that will check each hero hp. when a hero attack enemy do this passive ability first ,when enemy in range can active this abilities)
    5.Mixed AP for both movement and abilities( when a group has 2 AP they can move 2 times or attack 2 times or 1 time both attack and move)
    6.If the group has more than 1 hero they can move/AP or attack*heroes/AP
    7.Assign hotkey when press 1 call group 1 and camera move to group 1 press enter for end of turn
    8.How to save game state?
    9.What about quest system
    10.Do you have Crafting system
    11.Is possible to make online game with this asset.
    12.Can I use this asset with dungen or dungeon architect.

    If something not clear please let me know.
    PS. I can code c# but if some of these question require advance skill I can't do that so if some thing is too hard for code please tell me and if possible please recommend me similar system or other asset that can be integrated easy
     
  27. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    I'm not sure what you mean by groups of hero. The framework consider a unit in a particular tile a single unit. You can't stack multiple unit on a single tile to form a group. You can have multiple heros (units) on the grid but they will be consider individual unit. They won't be able to occupy a common tile. Also, there's no inventory system.

    1/2. I don't get exactly what do you mean by type/element. You can assign different abilities to each unit and have them do different type of damage. There's no flying unit. All units can be attacked so long as they are in attack range.
    3. The AI is quite basic if I'm honest. They will try to choose the optimum target for attack and get into cover whenever it's possible but that's about it. They won't use ability (there are just too many different type of ability to cover here). The only way to configure them is to dig into the code.
    4. Not sure if this is a question. If your coding skill is competent enough to do that, sure.
    5. You can do that for attack and move but the abilities are not tied to unit AP by default. But this can be modded.
    6. Again I'm not sure what do you mean by group.
    7. Not supported by default but can be added with relative ease.
    8. Not supported.
    9. Not supported.
    10. No
    11. I can't say because I don't know anything about network coding.
    12. You mean this dungeon architect? I'm not sure to be honest. It might not work flawlessly out of the box but it should.
     
  28. cbehrsin

    cbehrsin

    Joined:
    Dec 15, 2017
    Posts:
    2
    Hi Songtan,

    Firstly, thanks for creating this awesome asset. I just have one quick question, really banging my head against the wall trying to work it out.

    I've basically created a new tile type: ground tile, and I'm planning to add other tile types later on. I did all this in code and it works well so far.

    The thing I can't work out, is where are the tile graphics/prefabs loaded after you click on TBTK->New Scene?

    What I want specifically, is where the Grid Manager gets the Grid Prefab Assignment settings from, so I don't have to keep added prefabs every time I set up a new scene.

    Are you able to help?

    Kind Regards,

    Chris
     
  29. cbehrsin

    cbehrsin

    Joined:
    Dec 15, 2017
    Posts:
    2
    Ah, I've found it. It's in the Grid Prefabs.

    No need to reply to the above :).
     
  30. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    Actually, when you create a new TBTK scene, the system just load the premade prefab (of the whole scene) into a new empty scene. So if you really want to change the tile when you create a new scene, you will have to change those prefabs. They are located in TBTK/Resources/ScenePrefab. Hope this helps.
     
  31. Rob-161

    Rob-161

    Joined:
    Dec 1, 2016
    Posts:
    19
    Anyone been able to successfully add online multiplayer to their game? If so, may I ask what you used? Photon? Gamesparks? Have just started using Gamesparks and have done the basic setups. Now I am finding it a little overwhelming on the best way to proceed with the actual game logic itself. Any suggestions would be helpful.
     
  32. Tezpaps

    Tezpaps

    Joined:
    Dec 15, 2017
    Posts:
    8
    Great work. I just bought this pack and for the life of me i cannot find instructions on how to create a melee only unit. Not hybrid, just melee only. Can you please point me in right direction.
     
  33. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    Melee unit is not that different from from range unit in term of the code. It's just a matter of player perception. So if you want a melee only unit, just use a melee attack animation and a invisible shoot-object (see SO_Effect_Empty for example) for that unit. Hybrid is only there just in case you need a unit that can do two type of attacks depend on range. Hope this gives you some idea.
     
  34. Tezpaps

    Tezpaps

    Joined:
    Dec 15, 2017
    Posts:
    8
    got it thank you...the result of the attack appears about a second before my attack animation completes...can i fix that?
     
  35. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    You can set the delay on the shoot-object you are using so that it sync with your animation.
     
  36. Tezpaps

    Tezpaps

    Joined:
    Dec 15, 2017
    Posts:
    8
    ah in the default editor..thank you ....great support.
     
  37. Tezpaps

    Tezpaps

    Joined:
    Dec 15, 2017
    Posts:
    8
    i created two units and everything is working fine except for the UI Unit info panel on bottom length. It always shows AP as 10. Even after i have moved and attacked. What am i doing wrong?
     
  38. BigGameCompany

    BigGameCompany

    Joined:
    Sep 29, 2016
    Posts:
    13
    Sorry me again... can I base turn order on a units initiative? There’s an option to base it on statistics but which statistics?
     
  39. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    Maybe your setting doesn't use AP for move and attack? You have to check the option in GameControl to use AP for move and attack.

    I believe the stats you are looking for is TurnPriority. You can edit that value for each unit in UnitEditor. However please note that it's only valid when you are using certain turn mode, specifically UnitPerTurn or FactionUnitPerTurn for when MoveOrder is set to StatsBased..
     
  40. Tezpaps

    Tezpaps

    Joined:
    Dec 15, 2017
    Posts:
    8
    Excellent. I will have to go back and give you 5 star review in the asset store. Two more questions...
    1. is there a way for the UI to show turn order, so players can see when units will have their turns?

    2. Hit effect shows even when my arrow miss the target
     
    Last edited: Sep 2, 2018
  41. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    1. I'm afraid the default UI doesn't support that.

    2. Yes. That's how it works currently. If you want to, I can do a simple mod to disable that.
     
  42. BigGameCompany

    BigGameCompany

    Joined:
    Sep 29, 2016
    Posts:
    13
    I was assuming hit effect only shows on a successful attack so my effect was blood. Am I not understanding the correct function? Maybe the mod would be nice.
     
  43. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    What I had in mind is that the shoot-object has to hit something. So the effect will be spawned even if they missed their intended target. Anyway, send me an email so I can send you the mod.
     
  44. pbrowne

    pbrowne

    Joined:
    Aug 27, 2018
    Posts:
    57
    I have a full wall 6 hexes in length. My tank goes behind wall three hexes beyond the edge of the wall. The enemy tank in the area on the right (partly enclosed by obstacles) and goes straight to the entrance of the walled area on the other side of the obstacles, where my tank (yellow) is hiding, and zaps me. How come?

    sneaky_start.png

    sneaky.png
     
    Last edited: Sep 18, 2018
  45. pbrowne

    pbrowne

    Joined:
    Aug 27, 2018
    Posts:
    57
    In my next test, I moved my tank four hexes from the edge of the wall. The enemy tank took four moves to discover me. The closer he came, despite me hiding behind wall, the more, it seemed, he could sense where I was.

    sneaky 2.png

    Also, the enemy won't actively seek out the their enemy. It's not until I get within LOS distance that they come after me, even though I'm behind a wall. Is there a setting I can make to have the AI more active in search and destroy?
     
  46. songtan

    songtan

    Joined:
    Apr 9, 2011
    Posts:
    2,340
    Are you using fog-of-war? If you are not, the AI can 'see' the whole map just like you do. You can't hide.

    Check the mode your AI is using on AIManager. If you are using 'Trigger' or 'Passive', they won't actively look for you until they are triggered (by catching your unit within the range of LOS). Set it to 'Aggressive' if you want them to look for you at all time. That said, without fog-of-war, the AI will just go straight to your unit instead of searching for them.
     
  47. pbrowne

    pbrowne

    Joined:
    Aug 27, 2018
    Posts:
    57
    Thanks Songtan!
     
  48. pbrowne

    pbrowne

    Joined:
    Aug 27, 2018
    Posts:
    57
    I now have a scene with one Mech (bipedal robot thing) for two factions. The Mech comes from the Mech Constructor: Humanoid Robots kit in the Unity Store.

    I have setup the animations (idle, walk etc) as per the video at https://drive.google.com/file/d/0B96I1M7jPjqGbkhYN21reGZsT1U/view

    Problem:

    1. The mech walks towards the indicated hex, but keeps walking then stops several hex later, or

    2. The mech walks towards the indicated hex, but then quickly traverses laterally, then walks, then traverses laterally again to some spot.



    The anims used are from the Mech Constructor set, but I have also tried a simple humanoid walk from the Unity Standard Assets package.

    mech_1.png

    mech_2.png
     
    Last edited: Sep 19, 2018
  49. pbrowne

    pbrowne

    Joined:
    Aug 27, 2018
    Posts:
    57
    Actually I’m hoping for a capture system like this as well. I will be having different building types on the game (airfields, reactors, spawn and repair bases etc) that can be captured to earn points, limit the enemies’ strengths and ultimately win the level.
     
  50. pbrowne

    pbrowne

    Joined:
    Aug 27, 2018
    Posts:
    57
    Trying not to spam here :| When a unit dies, it currently disappears from the grid. I have a death anim that I want to get played, but the unit is removed before the anim gets to play. Is there a setting somewhere to fix this?

    Also, is it possible to leave the dead units in place showing the wrecked/dead states in the death anim?