Search Unity

TowerDefense ToolKit 4

Discussion in 'Assets and Asset Store' started by Song_Tan, Apr 18, 2012.

  1. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I've finally find time to make some tutorial videos. It's a 3 part series covering most aspect of the framework. Unfortunately I didnt manage to cover everything. Still, check it out if you like to find out more or learn about TDTK.

    Part1, Part2, Part3

    Please pardon the audio cut off at the start of some of the videos as well as some choppy language and explaination. :)
     
  2. mdevlin

    mdevlin

    Joined:
    May 28, 2012
    Posts:
    8
    I just wanted to say, this is an outstanding kit! I'm just having a little trouble with the slow effect. I have set up an AoE tower which works fine, but the slow effect doesn't seem to work. Any help would be appreciated! Thanks!
     
  3. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Just checked, there's a silly mistake in the code on my end. Terribly sorry for that.

    To fix the issue, please replace line-382 in Unit.cs from

    Code (csharp):
    1. CheckSlowEffect();
    to

    Code (csharp):
    1. StartCoroutine(CheckSlowEffect());
     
  4. DigiLusionist

    DigiLusionist

    Joined:
    Apr 30, 2007
    Posts:
    213
    I'm thinking of creating a content pack of Towers for Tower Defense games.

    This is a work-in-progress machine gun tower (level 3):

    http://s1074.photobucket.com/albums/w414/RogerCotton/?action=view&current=TD_MachineGunTower_-1.mp4

    [click link to see animation]

    I understand that the number of onscreen effects and instances of towers and targets is a factor in how fast the game plays (fps), but is there a recommended poly count range per tower should I shoot for? I am assuming the towers would be used in a game using Tower Defense Toolkit.

    Also, is there anything I shouldn't animate the towers doing that would be programmed instead?
     
    Last edited: May 29, 2012
  5. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Nice tower, great work.

    Indeed there are no magic number that for having a high fps. And it's very difficult to judge for desktop machine since each one can be very different. I would benchmak against iOS device. So the main indicating factor for graphic is drawcall. The best way to optimise this would be to utilise unity dynamic batching. Dynamic batching batched together meshes with similar material with the requirement that these mesh have less than 300 vertices. So if the model is meant to be compatible with iOS device, I would advise you to keep it under 300 vertices for each mesh and have as few mesh per tower as possible.

    As for tower bone arrangement and animation, the framework doesn quite support animation for tower yet. But I'll be adding support for building and shooting animation in the next update. The requirement being the turret and the tower has be a seperate mesh for aiming, also the building and shooting animation should be parented to root and turret. As in unity, the animation component which run build animation should be on root tower object and the animation component which run shoot animation should be on turret object.

    Hope this make sense.
     
  6. DigiLusionist

    DigiLusionist

    Joined:
    Apr 30, 2007
    Posts:
    213
    Yes, Songtan. Your explanation really helps! I appreciate it.
     
  7. mdevlin

    mdevlin

    Joined:
    May 28, 2012
    Posts:
    8
    Works great! Thanks again for such an amazing tool!
     
  8. mdevlin

    mdevlin

    Joined:
    May 28, 2012
    Posts:
    8
    Actually now I have another problem, the slow is lasting forever even when the duration is only set to one second. Thanks for any help!
     
  9. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    @Mdevlin, I'll revise the code again and let you know. Sorry again.
     
  10. mdevlin

    mdevlin

    Joined:
    May 28, 2012
    Posts:
    8
    Its honestly no problem! Thanks for being so active and helpful, its really awesome support!
     
  11. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Quick announcement that TDTK v2.0.3 has been released. This update is relatively small compare to previous. And it's mostly focus on PC and desktop. The most notable being manual targeting and custom cursor. The webdemo has been updated to reflect the changes.

    The full list of change are as follow:
    • added build and shoot animation support for towers
    • added manual targeting for selected towers
    • added CursorManager, support custom cursor for mouse
    • fix bug for creep pathing
    • fix bug where slow effect doesn’t apply to creep
    • fix bug for UI.cs where level complete/failed message doesn't displayed properly

    The update has been upload to Unity AssetStore and is now live.

    Thanks for all the users support and feedback.

    *please make sure you are downloading the v2.0.3h (which I've just uploaded 2 minutes ago, so it's not there yet) which include a hot fix for a slow effect bug where the unit are slowed forever.
     
  12. simon8029

    simon8029

    Joined:
    Sep 25, 2010
    Posts:
    1
    Just bought this awesome ToolKit for couple of days, it's great!

    I watched all the tutorial videos(Part1, Part2, Part3)and try to make my own scenes by save the demoScene as a new scene. Then I stuck in the middle of some problems need your help to get me out:
    1. There is no update button and sell button shows up when I used demo1 or demo3, and I don't know how to make them work.
    2. How to make game pause? It seems that pause button of demo1 demo3 doesn't work, and demo2 doesn't have pause button.
    3. How to hide the cursor in iOS?

    Thank you very much.
     
  13. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for purchasing the kit! :)

    Now to answer your question.

    1. It's very likely due to your screen resolution. The UI are intended for screen resolution of 960x640. Please set your resolution and do let me know if that solve the issue. I'll check again and do an update if possible. I admit there are some dodgy coding when it comes to UI position element in the UI. Sorry about that.

    2. The pause button in demo1 demo3 are for aesthetic purpose only. I intended to leave that to the user to configure as there are many way to do a pause menu and I feel that doing that would have stray far from what that is intended as a game mechanic focus framework. Anyway, If you wish to do a simple pause, simply replace line 275 in UI.cs from

    Code (csharp):
    1. Debug.Log("Pause");
    to

    Code (csharp):
    1. if(Time.timeScale==0) Time.timeScale=1;
    2. else if(Time.timeScale>0) Time.timeScale=0;
    Demo2 uses UI intended for iOS. For the same reason I haven't added in game pause. Technically there is less need of a pause function in iOS as the app would get suspended automatically when the home button is pressed.

    3. To disable the cursor, simply un-check the "enabled" flag of CursorManager.cs. which is attached to gameObject 'UI' in all of the demo scene.

    Hope this helps.
     
  14. BDry7780

    BDry7780

    Joined:
    Jun 10, 2012
    Posts:
    4
    SongTan,

    First I'd like to say that I purchased the tool kit and it's fantastic!

    For my project I'd like my towers to shoot a specific amount of rounds, then trigger a "cooldown" period and a reload animation. I'm not sure if other users would find this useful, but if so, I would love to see this in a future update. Just a suggestion...

    Thank you so much for the effort you've already put into the TDTK and your continued support. It's been a great help!
     
  15. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for the kind word. I'm glad you like the kit.

    I have the exact idea during my planning phase when I start working on TDTK2. I dropped it. I thought that could be a nice after thought after I finish all the vital core features. After all I had a great deal to do at that time (I admit I got a bit lazy). But it's now the perfect time to do that thanks to your reminder. I'll see what I can do about it
     
  16. BDry7780

    BDry7780

    Joined:
    Jun 10, 2012
    Posts:
    4
    Excellent! I look forward to it.
     
  17. BDry7780

    BDry7780

    Joined:
    Jun 10, 2012
    Posts:
    4
    I can confirm the issues that Simon8029 brought up. The upgrade and sell buttons aren't showing up when using the UI script or on Examples 1 and 3. In addition, the upgrade button isn't working on Example 2 or when using the UIios script.

    Thank you
     
  18. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for letting me know, I'll look into it.

    By the way I've added the reload mechanism. However I'm a bit busy recently so the next update may have to wait for a few days. Sorry and thanks for understanding.
     
  19. BDry7780

    BDry7780

    Joined:
    Jun 10, 2012
    Posts:
    4
    No worries. I'm looking forward to it.
     
  20. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Hi songtan,

    i am searching for a pause button that the user can push to do something different inbetween a game and later can play the rest of the level.
    Is there a solution in the pack right now or will come one in an update?

    Will this kit also work with uneven terrain?

    Can i make with this kit something like flowers vs zombies?
     
    Last edited: Jun 16, 2012
  21. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm not entirely sure what you mean by something different. Is it just to stop the game flow while allowing user to build/upgrade or something else. If the you mean the former, then yes you can, time manipulation is a built in feature.

    As for if it works with uneven terrain, it's very much depend on how you want it. In most case the answer would be yes. The building of tower are platform base, represent by unity primitive plane. They are just there for the mechanic and can be make invisible.

    At the moment, you cant make plants vs zombies with this. Most of the element is there but one of the mechanic which involve creep attacking towers are not supported atm. However I'm working on that.
     
  22. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    With something different i only mean that the player can make a call or go to toilet ;)
    So i just mean a pause button.
     
  23. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Oh, in that case, I cant imagine it's a problem at all. It can be done as easily as adding two lines of code. The button code is already there. This has been explained before in previous post. The code are:

     
  24. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Sorry songtan,

    i know about the time scale lines but i thought there will be some kind of gui inside your asset connected already with this function that i missed.
     
  25. hk1973

    hk1973

    Joined:
    Oct 14, 2008
    Posts:
    28
    Looks amazing!! Any game out there which is built using this engine?
     
  26. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Unfortunately no. At least not that I know of. TDTK2 has only been out for 2 months, so I'll be amazed if I see a title or two made already using this.

    I myself is using it to develope a TD game. It's for a contract work and due to NDA I cant shed more lights on it. I'll be more than happy to showcase it when it's done, if I can get the permission.
     
  27. hk1973

    hk1973

    Joined:
    Oct 14, 2008
    Posts:
    28
    I have purchased your product but have not started using it yet. I am wondering if there is a BOMB function which is a consumable that damages all enemies.. like a nuclear bomb?
     
  28. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Unfortunately there's no such feature. However it's not hard to implement it given the established code base. Please pm me with the details for what you need, I'll see if I can do anything about it. No guarantee there, hope you understand.
     
  29. mdevlin

    mdevlin

    Joined:
    May 28, 2012
    Posts:
    8
    Hey I have another question. I have one platform with two paths on it. The paths both have three waypoints, and they share two of them. They share the platform and the finish point. The problem is when I attach a pathindicator to both paths, I get an error. Thanks for any help!
     
  30. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Can you be more specific about the error you are having? Perhaps show me the error message on the debug log. Not much I can do without knowing what's what. :)

    But sounds like you are using a setup very similar to one used in ExampleScene2. I'll be very surprise if there's something wrong with the code. Perhaps you can refer to the setting of ExampleScene2?
     
  31. mdevlin

    mdevlin

    Joined:
    May 28, 2012
    Posts:
    8
    Sure thing, the error is:
    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[UnityEngine.Vector3].get_Item (Int32 index)
    PathIndicator+<EmitRoutine>c__Iterator12.MoveNext () (at Assets/Scripts/TowerDefense/PathIndicator.cs:74)

    And I have 2 path objects each with path indicators on them. They share the same build plane as a waypoint. Okay, Ill check scene 2! Thanks!
     
  32. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Very strange. I've checked my code against the error you have. The error type cant be happening on line74. That can only mean that you are using a different PathIndicator script from mine.

    Also I've try several possible combination in attempt to replicate any error you are experiencing. My conclusion that it's fairly error proof. I didn't manage to create any PathIndicator related error. So perhaps you should try replace the file you are using with the one I have. I've pm it to you.
     
  33. mdevlin

    mdevlin

    Joined:
    May 28, 2012
    Posts:
    8
    Thanks, sorry it appears I accidently added an enter or two in the code. I've looked at the example scene 2 and I still cannot figure out what is going wrong.
    The error is:
    ArgumentOutOfRangeException: Argument is out of range.
    Parameter name: index
    System.Collections.Generic.List`1[UnityEngine.Vector3].get_Item (Int32 index)
    PathIndicator+<EmitRoutine>c__Iterator12.MoveNext () (at Assets/Scripts/TowerDefense/PathIndicator.cs:73)

    I have some obstacles on the platform, like props with colliders to make the game more fancy. The pathfinding and building works fine with the obstacles so I dont think its that. Also, I made the buildmanager, gamemanager, and the platform prefabs. Would that mess it up? Thanks again for all your help, I truly appreciate it!
     
  34. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    PathIndicator is a standalone component. The only dependency, an optional one, is the linking with waypoint with Platform component attached. So as far as the code concern the only reason it could have error is that you have somehow modified the code accidentally. From what I understand from the line of error, you have at least add or delete a good 6-7 lines of code.

    I've revised the code so I'm pretty sure about this. Can you please try the code I sent to you and see if the same error keeps on happening.
     
  35. mdevlin

    mdevlin

    Joined:
    May 28, 2012
    Posts:
    8
    Thank you very much for everything! Looking at the revised code you sent me I was able to figure out what was going wrong. When I was coding a saving system for the game, I messed with the platforms by accident. I was able to find what went wrong and fix it. Thanks again for the outstanding support :)
     
  36. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    That is by no mean the revised code. In fact, it's the original code, unaltered since v2.0. :)

    anyway, glad to help!
     
  37. mixvio

    mixvio

    Joined:
    Jun 25, 2012
    Posts:
    17
    I came across a bug with the pie menu (at least, it could be in the other menu types as well but I'm only using the pie) where clicking a tile and then cancelling (or clicking anywhere else) would prevent you from interacting with the tile beneath the pie menu overlay.

    I fixed it by adding a line to 531 in UI.cs, but here is the segment:

    if(GUI.Button(scatteredRectList[currentBuildList.Length], "Cancel")){
    buildMenu=false;
    BuildManager.ClearBuildPoint();
    scatteredRectList = new Rect[0];
    }
     
  38. mixvio

    mixvio

    Joined:
    Jun 25, 2012
    Posts:
    17
    I encountered a similar problem when clicking a tower immediately after building it (IE, if you want to upgrade it right away); it was unselectable until you picked another tile.

    This is line 516 to 523:

    GUIContent guiContent=new GUIContent(tower.icon, ID.ToString());
    if(GUI.Button(scatteredRectList[num], guiContent)){
    //if building was successful, break the loop can close the panel
    if (BuildButtonPressed(tower))
    {
    scatteredRectList = new Rect[0];
    return;
    }
     
  39. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for letting me know! and fixing it too! :)

    I'll look into it. Terribly sorry for the error.
     
  40. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Just a quick announcement that version 2.0.4 is now live on AssetStore. Following are the changes in a nutshell:

    • added ammo count and reload mechanism to turret and directionAOE towers.
    • added range preview for towers in building phase.
    • added tower preview for PointNBuild build mode, for both UI.cs and UIiOS.cs.
    • added modifier for creep's move animation to match the movement speed.
    • added pause menu for UI.cs. Can be triggered by button pressed or 'escape' key.
    • tower can now be pre-placed in the scene.
    • small addition to SpawnEditor, time required for each wave to finish spawn is now shown beside wave duration.
    • fix bug where modified prefab value using editor is not saved upon unity Editor quit.​

    I hope I have covers all the feature requests. Hopefully I didnt miss out any. As usual, please let me know if there's any problem with the new version and any feedback are welcomed
     
  41. 3Duaun

    3Duaun

    Joined:
    Dec 29, 2009
    Posts:
    600
    @Songtan what a great set of fixes features you've brought us in 2.0.4 thank you! If you want a GREAT Tower Defense "shell" to begin work with, THIS IS THE TOOLSET! get it on the asset store now if you already havent!
     
  42. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for the kind word, just doing what's required. :)

    The editor bug in particularly is a nasty one. I didnt notice about it at all until I'm now using the framework myself. My apologies if that has cause any problem/confusion so far.
     
  43. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Hi Song,


    Currently I'm using the upgrade feature for tower, where I have a differnt tower look when upgrade the tower, and my problem is when I click on upgrade my tower will disapear instead of showing the upgrade one?


    here is what I do:

    1- I export my tower with it's build animation as fbx file (it's a canon tower with one barrel).

    2- I export the second level tower with the same hierarichy and the same build animation as fbx file (it's the same tower but with two barrels).

    3- I create 2 prefabs for every tower fter adding the unitTower component, so prefab1: CanonTowerL1 and prefab2: CanonToweL2.

    4- I open the tower editor and select my first level tower, and in Level 2 I set the TurretObj to be the turret in the CanonTowerL2, and make the BaseObj to be the base in the CanonTowerL2.


    Now once I play the level I acn create the CanonTowerL1 without any problem and it's animation if playing good, however when I select the tower and click on Upgrade tower the turret and base objects will just disapear, so what's happening? I'm I doing anything wrong?

    Note: no error messages apprear when click on upgrade

    Please advise.
     
  44. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    There are a few possibilities for that to happen. Please check the following:

    - Is the level2 prefab get spawned in the scene? Please check this in the tower's heirarchy.
    - Is so, try changing the scale of the transform. There's a possibility they are too small to be seen. This could either be a bug which I need to look into, or you could have set the scale value of the prefab to something too small.
    - Are there animation on the prefab? Some animation may messed up the scale value when they play upon the object being created.
     
    Last edited: Jun 26, 2012
  45. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Hi Songtan,

    Regarding the creation of level 2 tower, my answer is no where I have checked the Hierarchy tab, but found no level 2 tower created, and by the way when I checked tthe first level tower i found that turretObj and baseObj are only hidden.

    So what is happening when we click upgrade? does it hide the first level objects and create the new ones?

    Also the transform of level 2 is big enough to be seen.

    Regarding your second question: yes towers have animation, but the animation played very well, I can't see any problem in animation.

    Please advise.
     
  46. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    by the way song,

    My turretObj and baseObj of level 2 is a child for canonTowerL2, so will this affect anything?

    Also when I check the UpgradeStat() function I found that you only de-activate the existing turretObj and baseObj, then you:
    turretObject=upgradeStat[levelM].turretObject;

    but the new turretObject or new baseObject are not instantiated anywhere?
     
    Last edited: Jun 26, 2012
  47. kbomb

    kbomb

    Joined:
    Jun 26, 2012
    Posts:
    3
    Hey guys ,

    Can you explain how i customize my upgrade tower,
    when I try, the tower disappears.

    Thanks



    Ps: sorry for my english i'm french :)
     
    Last edited: Jun 26, 2012
  48. kbomb

    kbomb

    Joined:
    Jun 26, 2012
    Posts:
    3
    i have the same problem of bravery
     
  49. bravery

    bravery

    Joined:
    Mar 26, 2009
    Posts:
    270
    Hi Song,

    I have a suggestion:

    intead of trying to replace only parts of the towers (turret Base) between two different prefabs, why don't you just call Unbuilding for the frsit tower prefab, and call build for the level 2 tower prefab, that will make things much better, as i believe this should be easier than repleacing parts, where replacing parts can make a problem in the art level, where some people will have some animation that might be breaked, and others can upgrade to totally differnt kind of towers ... etc, so unbuilding current level tower, and rebuild the next level tower will be much better and can cover all cases?
     
  50. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Following a few bug discovered after the release of v2.0.4, I've made a hot-fix and re-upload it to AssetStore.

    Following are the fixes:
    • fix several UI related bug
    • fix issue where next level turret and base doesnt appear correctly when upgrading towers.
    • fix issue for editor where when adding new level for towers, the new stats are linked across level.​

    Sorry for the inconvenience.


    @bravery, your suggestion would mean that every tower level require a new independent component to record the stats. Which could make editing a tower stat a bit tricky. Not to mention you could easily end up with a hand full of prefab for each tower type, regardless of that fact that if visual change is required, and each of them will need more careful setup than say a base or a tower object. It's a feasible idea yes, but at this point, making such change would mean change how the editor and stats works entirely which I dont think is reasonable given that it have its own drawback.