Search Unity

TurnBased-Toolkit (TBTK)

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

  1. SoftwareWorkshop

    SoftwareWorkshop

    Joined:
    Feb 8, 2013
    Posts:
    43
    Ok, thanks a lot. I will let you know if I manage to integrate those two. But it might take some while as this is still very early work.
     
  2. BusyRobot

    BusyRobot

    Joined:
    Feb 22, 2013
    Posts:
    148
    Few basic questions.

    1) Is this just for 3D games? can it handle 2d visuals?
    2) Does this handle any of the actual turn based server coding? and if not, how would I integrate this with either Photon or Apples GameKit?
     
  3. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    The difference between 2D and 3D is just the asset and the camera angle. The framework works regardless of the asset type you are using so it should work for both 2D and 3D. That said, if you are using animated sprite or the 2D view that you are using are from certain camera angle (isometric for instance), then you will need additional script to get the sprite display correctly.

    Unfortunately not. I can't comment on how to do that since I'm not familiar with both Photon or Apples GameKit. In fact, I know very little about server or network coding.
     
  4. MMccathron

    MMccathron

    Joined:
    Feb 27, 2015
    Posts:
    13
    Great toolkit, just got it and I'm enjoying it, but I've got a two part question: 1) What would be the best way to create a city tile that will serve as a goal the player must capture or defend, and 2) is it possible using this toolkit to set up a limit on the number of turns taken to complete the capture of said city tiles? I have in mind something like Panzer Corps, where you have to capture specific city tiles (occupy them, own them, whatever) in a set number of turns. My main concern is which scripts would be best to edit so I don't mangle something else along the way.
     
  5. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Well you can create a new script to do all the tracking. This will minimize the modification required to the existing scripts. You will need to assign the target tile to the script. Not a big problem unless your grid is generated in runtime. Then you will need to know when a unit has move into the tile. To do this you can add a function call in Unit.cs MoveRoutine() to pass the unit move information whenever a unit has done moving. Finally you can add a function call from GameControl.cs EndTurn() to notify your script instance when a turn has ended. With this you should have all the information required to run the logic. Finally when the tile is captured, simply call GameControl.GameOver() to end the game.

    Hope this help.
     
    ponasoft likes this.
  6. Zombiefied

    Zombiefied

    Joined:
    Nov 16, 2015
    Posts:
    4
    First off this toolkit is great. Bought it a few days ago and it works much better (and looks much cleaner) than trying to build a system from stretch.

    I have a little problem with fog of war sadly; The fog sometimes gets rendered below the standard hexes / the hexes clip through the smoke (using an edited version of the DemoSimple scene). Any idea on how to fix this? The clipping appears to happen only in the upper half of the screen.

    Right now whenever you select an action for an unit it gets executed immediately. Is there any chance you will implement an option to first select actions for all units and have them all executed when the turn is done?

    Thanks in advance.
     
  7. Zombiefied

    Zombiefied

    Joined:
    Nov 16, 2015
    Posts:
    4
    Clipping problem is solved by increasing Render Queue of the HexFog Material.
     
  8. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for using the toolkit and glad to know that the fog-visual the issue is solved. But I'm afraid execute all unit moves when the turn is done is not possible without some serious modification.
     
  9. Zombiefied

    Zombiefied

    Joined:
    Nov 16, 2015
    Posts:
    4
    Alright thats sad to hear. I suppose i could rework the abilities to work like the Overwatch ability as an easy workaround so its not too big of a problem. Thanks anyways.
     
  10. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Do you work on tutorial for the asset since the youtube videos are from 2013 and varies from current asset version?
     
  11. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm afraid not. Despite the old video, the workflow is pretty much the same. The editors might be a bit different but the current version's are more user friendly and intuitive. I expect most people should be able to get things going once they go through the documentation. And should they still struggle, the workflow shown in the video should be suffice to clear things up.
     
    pushingpandas likes this.
  12. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    ah ok thanks. I thought its much different from the video since you mentioned it on youtube. I saw in your video you used a skelleton. Is it still possible to use bipedal models? Can I add footsteps to animation for movement? And does the asset work with 2017.1 unity version?
     
  13. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Hey guys, hope you don't mind but I just want to drop a link to my latest game using a heavily modified version of this great kit:

    https://play.google.com/store/apps/details?id=com.WaveLightGames.StrikeTeamHydra&hl=en

    Songtan: By the way, I managed to integrate Navmesh for the movements and obstacle avoidance. It's not a lot of code changes but a lot of setup in each level. I did it for my new game and went back and added it to my previous game. Still need to test it a bit more and then add it back to my very first game.
     
    pushingpandas likes this.
  14. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    @Devision4, You should be able to use any model or animation you need. However there's no locomotion system in place to make sure the animation play correctly if you are not using a flat terrain. As far as I know, TBTK should work just fine with 2017.1.

    @Rajmahal, congratulation for your release! Looks brilliant as always. I imagine it's not very difficult to change the movement code to use navmesh. Like you said the tricky bit is the labor intense process to setup every level. The lack of the navmesh API and inability to generate navmesh in runtime is the reason why I don't use it.
     
    Rajmahal and pushingpandas like this.
  15. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Thank you. Iam very close to buy it :) Two more questions. In your demo, the Full Feature Game, I recognize that the tanks fires through the walls? Is that a bug? Do you plan to add stances for the units? Like on X-Com Soldier is standing or on its knees. Or view position change. Like move to wall, but face left. I think this is a important feature.
     
  16. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm not sure in what instance the tank fires through wall. The system works like the one in x-com. There are high wall and low wall. High wall will block line-of-sight. If a target is out of sight, then the unit can't attack it. But If the unit is standing behind a high wall, it can still fire through the wall if the adjacent tile is open or have a low wall. If the tanks are fire through a row of solid high wall that should have block all line of sight, then it's a bug. If that's the case, please let me know.

    There's no support for stance animation for the unit atm. That require s a very complex solution tbh, and often highly specific depend on the game design and animation. It's just not very practical in the context of this framework.
     
  17. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Can I add movement sound? Like when tank is moving from field to field?
     
  18. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Yes you can. Just add a UnitAudio script on the unit prefab and you should be able to assign various sound to that unit.
     
  19. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Thank you really impressive toolkit. Does it work with different heights. like 1 tank is on ground, enemy tank is on a box highter then the first tank? Or must everthing be on 1 level?
     
  20. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    It's not really supported but you can do that if you want. If you switch the 'Grid Collider Type' on GridManager to individual and regenerate the grid, you can adjust the position of individual tile, including the height. But you will have to do it manually, tile by tile. Also, other than the visual, this doesn't affect any of the gameplay mechanic at all. Note that by switching the collider type to individual, you are probably limited to a much smaller grid for performance reason. By on my own testing, I wouldn't recommend anything pass 50x50.
     
    pushingpandas likes this.
  21. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
  22. acorrow

    acorrow

    Joined:
    Jan 4, 2015
    Posts:
    32
    So I've been going through this thread to see if I missed any of these questions, and I don't think I have, but it's hard with the Unity forums so I apologize if I'm doubling up here. Just a question on if/when the following will be implemented or if it's currently possible and I'm just missing it:

    1: Ability Animations
    2: Spawning different weapons per Ability. Example would be a humanoid unit pulling out a knife for a melee attack, or pulling out an RPG launcher.
    3: Multiple obstacles per type. Examples would be the "Full Obstacle" being trees, but allowing different similar prefabs for a variety of trees. Same with rocks for the half size obstacle
    4: Generate obstacles automatically in "non walkable" tiles.

    As for potential bugs/oversights:

    5: Obstacles seems to take on the scale of the tile itself. Without looking at the code [I'm trying really hard not to customize this if I don't have to ;) ] I'm guessing you could just set the scale when instantiating them.
    6: Timing of animations. Is there a way to sync up animations from the attacker and the defender using animation events? I know there is an attack delay, but this just seems to delay the entire process. I would like to trigger the Defending units "get hit" animation at a specific time based on an animation event in my attackers "Shoot" animation. Is this possible?

    I know that's a lot to unpack, sorry, but I love this kit and how it ties together in a way that fits my design really well. I want to stay away from customizing it if I can, but I don't mind doing so either. Thanks in advance!
     
  23. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I've answer your question in short: :)

    1. Not supported but it's not too difficult to add
    2. Not supported
    3. *Yes but you have to change the obstacle prefab assigned to GridManager manually.
    4. *No
    5. Yes, they are scale to the tile size. This is intended.
    6. You should be able to sync them up. The purpose of attack delay for the animation (on UnitAnimation component) is not to delay the whole process or the animation. It's there to dictates when the 'fire' or 'hit' event (fire for range and hit for melee unit) takes place. The idea is if your attack animation has a charge up phase (like take aim or lift sword before swing), you set the delay to match. So the shoot-object would get spawned when the animation 'shoots'. And in case of melee attack, the target will play the 'hit' animation in sync with the attacker animation.

    * I will try to address this in future update if I can. However I don't think it will happen in the near future. I would say just customize it if your project can't wait. Sorry for the inconvenience.
     
    acorrow likes this.
  24. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Thanks Songtan. I actually added different stances in my latest game. If a unit ends it's turn next to half cover obstacle, it adopts a kneeling stance.
     
  25. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Also, tbtk works fine in unity 2017
     
  26. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Could you implement it into my kit too? I pay for it.
     
  27. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    It's only a few lines of code added at the end of the units movement. The tricky bit is you have to use the animation state machine and add a blend tree for the idle state. Set 0 to be their normal standing animation and 1 to be the crouch position. Then when the unit stops its move, you just check if any adjacent tiles have half cover obstacles and then play either the 0 state idle or 1 state idle in the blend tree. If you're okay with that setup in your mechanim state machine, send me a PM and I'll email you the code snippet for free.

    I'm kind of busy at the moment though as I'm going through a launch. So maybe in a week would be better.
     
    pushingpandas likes this.
  28. ponasoft

    ponasoft

    Joined:
    Oct 6, 2013
    Posts:
    42
    thanks for the update. i wanted to check changes buy i could not find changes on both asset store and blog.
     
  29. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Sorry for the slow reply. I've been out of office (and will be so for the next few days).

    I take it you are referring to the update on 12th August? Sorry for the confusion but that wasn't really an update (hence the same version number). I've just found out that for some reason the documentation had been missing in the package. That was just me uploading the documentation.
     
  30. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    Can I place any kind of obstacle or does the object need to be a grid size object? I want to make a city with cars on street and cars should be obstacles, is that possible?
     
  31. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Of course you can check the documentation, obstacle and wall prefab. An obstacle prefab can be anything as long as it has a collider and the right layer assigned. Ideally the collider size should matches the grid size. The easiest way to do this would be to use the default collider, disable the mesh and place your custom mesh object (cars or something else) as the child object.
     
  32. pushingpandas

    pushingpandas

    Joined:
    Jan 12, 2013
    Posts:
    1,419
    We want to creat a VR turnbased game with VRTK, do you know anybody who might did it and has experience with it?
     
  33. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Unfortunately I don't really know much about VR or know anyone who is actively involve in any development of VR application. I'm afraid I won't be able to help in this regard.
     
    pushingpandas likes this.
  34. Eddie_Garland

    Eddie_Garland

    Joined:
    Sep 17, 2017
    Posts:
    2
    Hi, I'm about to buy your pack right now but before I have some questions that I hope you could help me with (also bear in mind that I have close to zero knowledge in coding, I used to be the 3D artist and now I'm trying to expand my skills).
    1. I've seen that height gives no modifier whatsoever to the gameplay and to change the height of a tile you must set the grid to individual. Is it possible though to give "stats" to a tile? Like, if I want that specific tile to give a character standing on it a bonus on attack or defense (or whatever), I could use the tile stats to simulate the bonus on height.
    2. Still on the tile "stats" thing, is it possible for me to make a tile cost more to move? I'm thinking on something close to Dungeons and Dragons rules where difficult terrain costs 2 tiles of movement.
    3. Is there some sort of directional AoE attack for melee? I thinking on a dragons breath, it spreads in a cone starting right in front of the dragon.
    4. Any tip on how to integrate destructble terrain (like X-Com) where its possible to tear down a wall and make a new path or destroy a bridge and in the way destroying any path on it?
     
  35. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Hi, sorry to dissapoint but I'm afraid without any modification, none of what you are looking for is available. But if you are willing to do some coding yourself...

    1. That can be added with relative ease if you know some coding.
    2. This is very similar to 1 but it's more complicated since you need to modify the path-finding algorithm.
    3. I imagine this shouldn't be too difficult as well if you know to code.
    4. Without modificaton, you can place neutral static unit as destructible obstacle. However you will probably need additional interface tweak. And obviously they can't be destroyed accidentally like how it's in xcom. To have it working like how it's in xcom, you will likely need some major modification.

    Hope this help.
     
  36. Eddie_Garland

    Eddie_Garland

    Joined:
    Sep 17, 2017
    Posts:
    2
    It helped a lot, thanks! The answers were negative but not even close as bad as I thought they would be (and damn, they weren't kidding when they told you reply as fast as possible)

    Will definitly buy it!
     
  37. FlloriiN91

    FlloriiN91

    Joined:
    Feb 26, 2015
    Posts:
    6
    Hello, a fast question. I want to do a battleship as a hero unit with multiple guns on it. Is there a way to select multiple turret objects and barrel objects or do i need to change the code ? I cannot find anything to help me on this. Or did I miss something? :)
    Thank you.
     
  38. Helios23

    Helios23

    Joined:
    Sep 10, 2017
    Posts:
    1
    Unity 2017.1 Bug?

    Hi Imusing the toolkit and so far so good.

    I think i found a Ui bug though.

    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.

    It seems like the code that draws this screen is not redrawing it properly on future draw calls. whats the fix? See images

    First Click.png
    2nd and Subsequent clicks.png finding the close button.png
     
    TheQuantumWanderer likes this.
  39. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    @FlloriiN91, I'm afraid multiple turret/barrel object is not supported. You will have to do some modification for that.

    @Helios23, I'll check and try to fix it. Unfortunately I'm not sure when I'll be able to do this. I suggest you ignore the issue for the time being. I'll let you know when it's done.
     
  40. Magnitude9

    Magnitude9

    Joined:
    Jul 11, 2017
    Posts:
    11
    Someone asked this two years ago, and your answer was No. I'm just checking to see if the answer is still No, or if support for any of these things has been incorporated since?

    Would it be possible to make different types of terrain (tile) like forest, sand, grass (normal), hill etc. that would limit the movement of a unit, and also elevation for example: ocean, sea for warships, submarines, ground terrain (forest, grass, hill...) for ground units or air (not visible) for helicopters and aircraft. ​
     
  41. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm afraid that it is still not available. Very sorry.
     
  42. Son_Of_Hans

    Son_Of_Hans

    Joined:
    Apr 27, 2015
    Posts:
    3
    I'm having a strange issue related to the DB code, though it may be more of a Unity issue than one from TBTK. Here are the steps to reproduce:
    - Open the Unit Editor and make a change to one of the units
    - Undo the change outside of Unity; in my case, I'm using git, so I would just revert changes to the unit prefab
    - Upon returning to Unity, the UnitDB's link to that prefab becomes null and so the unit is automatically removed from the DB; however, the expected behavior here is that the unit should simply return to its previous state and remain in the DB as if nothing was changed

    I did find a workaround, but I have yet to figure out a proper fix. First, I had to remove the portion of TBTK code that automatically checks for and removes null entries in UnitDB.unitList. This keeps the DB's link to the prefab alive when I view it in the Inspector panel, but for some reason the code still sees a null entry and so the "reverted" unit is not shown in the Unit Editor. The workaround is to trigger a recompile by changing something in the code (any change will do; the change itself is unrelated, it's the recompile that does the trick), which restores the unitList entry and then everything returns to normal. I thought perhaps this was causing some kind of refresh, but I've tried using AssetDatabase.ImportAsset and AssetDatabase.Refresh with no luck (even with their ForceUpdate flags).

    Any assistance with this would be much appreciated.
     
  43. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I have to say I don't have a great deal of experience when it comes to version control like git but I suspect this is Unity issue rather than TBTK's. The way unity recognized individual asset (prefab included) and how they are linked (what component is on what prefab, what value/item has been assigned to what variable of what component, etc.) is through the meta file associated with the asset. I think you may have broken the link of the meta file to the prefab somehow when you 'undo' any changes using git. Hence the prefab is no longer being recognized as what it used to be. Have you revert the change on the meta files too? If you haven't, I would suggest you try that.
     
  44. Son_Of_Hans

    Son_Of_Hans

    Joined:
    Apr 27, 2015
    Posts:
    3
    Hi, thanks for the reply. The meta files do not appear in my list of changes, so I am not aware of anything that can be undone with them. I forgot to mention this earlier, but another workaround that fixes the issue is simply to restart Unity; however, this is obviously not a preferable solution seeing as it may be desirable to make and undo changes frequently in a single setting. But the reason I mention the restart "fix" is that I think it suggests something is going on internally with Unity rather than something that affects individual files.
     
  45. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I think this has something to do with how unity works internally. The issue here is that reverting changes done to a prefab using git somehow broke some of the prefab setting. A recompile (restarting unity does force a compilation) forces unity to repair that. I guess what you can try is to set the inspector to debug mode and see if the 'undoing' changes anything in there that could possibly broke the link. To be honest, I'm not sure if there's anything we can do about this.
     
  46. azureemblem_

    azureemblem_

    Joined:
    Jul 24, 2017
    Posts:
    2
    Hello, first of all thank you for the asset it's making my life so much easier and I'm loving the framework, just a quick question, I'm using humanoid characters for my project and I can't seem to get the animations to play properly, they only use my idle animation and don't transition to move/attack/hit, they always just stay in idle, I changed the animation clips inside of the animation controller for my custom animations, they do the transitions just fine inside of the controller when you click the square or circle box, but they don't transition in real time.

    my question is do I need to modify a script or use a different animator controller to get it to work with humanoid settings?
     
  47. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
  48. azureemblem_

    azureemblem_

    Joined:
    Jul 24, 2017
    Posts:
    2
    Thank you for the video, I set the animations incorrectly and now everything is working like a charm, another quick question, how would one change the height from where shoot object fires? right now it shoots from the feet of my unit
     
  49. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    You create an empty child object within the prefab transform and assign it as the unit's shoot-point. The shoot-object will be fire from where the shoot-point is positioned. You can refer to the example prefab. I suggest you to go through the documentation to understand how it works exactly.
     
  50. quanglinh1502

    quanglinh1502

    Joined:
    Nov 3, 2017
    Posts:
    1
    Sorry man , but i'm newbie so i don't know how to change color of health bar with different faction, i want health bar of other faction will have different color