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
    It's hard to tell what's wrong. If you don't mind, you can send me the prefab and I can have a look.
     
  2. roch13boy131

    roch13boy131

    Joined:
    Sep 14, 2013
    Posts:
    11
    Ok i just sent an email to you with the Subject as TDTK3.0 Prefab
     
  3. Chesnakov

    Chesnakov

    Joined:
    Aug 14, 2015
    Posts:
    3
    Hi, Song. I compile the demo scene TDTK_FixedPath for mobile android. FPS from 10 to 60, because of what it could be? I tested the phone lg nexus 4
     
  4. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Well, I've tested it on my S4. It maintains at 30 fps and above, only drop below that on several occasions when there's a lot of particle-effects on screen. Thing is tho, those default particle-effects are not exactly optimized for mobile device. And mobile device are not very good at rendering lots of particle-system on screen in my experience. Bottom line is the some of the default graphic assets are not very well suited for mobile, you will have to do some optimization to make sure it runs smoothly on mobile device.
     
  5. roch13boy131

    roch13boy131

    Joined:
    Sep 14, 2013
    Posts:
    11
    Hello SongTan

    Im sorry with all these messages
    Was just wondering if i could ask another one
    I have my UI that i have created into the game, and my tower ui works well but my main problem is when i go to place my tower on the platform when i select the tower i want it doesn't place the tower any tower that is and it doesnt go away

    Also the gecko doesnt dissapear once it dies but i did it in the example scenes you have given (bought the full version) and the gecko does dissapear

    Kind Regards


    EDIT:: I have fixed the problem there was two event Systems

    One problem that has arised up is that when the tower upgrades it doesnt despawn the old one
     
    Last edited: Aug 16, 2015
  6. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I don't quite understand what exactly is the problem. You are having problem when you build a tower? Or you have problem when upgrading a tower? If you are using your own custom UI (with new UI script), I can only guess that the problem is you are not calling the right build/upgrade function. It's hard to know what exactly could be causing the problem without knowing your code. You will have to show me what have you done with the code.

    I take it by gecko your mean your creep? The most probably cause is somehow in your own scene the setup is not correct (missing component, conflicting setting, etc.). That leads to the question of how did you create your new scene? I would strongly recommend that you use the "Tool/TDTK/new scene" button from the top panel so you don't miss anything.

    Also, do you get any error message in the log at any given time? If you do, those are the indication of what is wrong with your scene.
     
  7. roch13boy131

    roch13boy131

    Joined:
    Sep 14, 2013
    Posts:
    11
    Hey Song Tan

    I edited my post if you didnt see
    I have fixed them the only problem now is when i upgrade the tower the old tower doesnt go away while the new tower is just over the top(didnt change any of the code)
     
  8. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    So does this happen with the default tower prefab in the example scene? Do you get any error message in the log?
     
  9. roch13boy131

    roch13boy131

    Joined:
    Sep 14, 2013
    Posts:
    11
    it only happens with my own custom towers
    Nope only happens with my Towers none with yours

    edit: it does happen with your towers aswell
     
    Last edited: Aug 20, 2015
  10. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm pretty sure everything works fine with the default prefab.

    In your email to me you mentioned you use a custom UI. So my guess is the problem comes from your UI, or your UI code. First I would look for any warning/error message in the log when you try to upgrade a tower in runtime. Then I would check your upgrade button callback with the default working one, OnUpgradeButton() in UITowerInfo.cs. to see if anything is missing.
     
  11. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    Hey Song,
    I'm trying to add a dust particle to the tower so that builds, upgrades, and destroy towers will spawn a particle when one of these actions occur. Where is the best place to add an instance command?
     
  12. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Actually you can do that already by default. You can assign a particle-prefab to the tower "Building Effect" and "Built Effect". These will be spawn when the tower start building/upgrading and done building/upgrading. However for destroy effect, it's not shown in the TowerEditor (I'll remedy that in the next update). You will need to use Inspector to access it for now. The variable is named "Dead Effect Obj".
     
  13. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    Thanks a ton Song! Just a note to anyone else who needs this: "Building Effect" and "Built Effect" was added in the TowerEditor update Version after 3.0, now available in Version: 3.0.1 f2 (Jul 13, 2015)
     
  14. Erhan61

    Erhan61

    Joined:
    Sep 9, 2014
    Posts:
    3
    Hi Song,
    Thanks a lot of for this Asset and I'm using TDTK Full version.I'm creating TD game for android.I have a two question!
    1-How can I fixed BuildButtons location on Build Platform ?
    2-How can I add confirm button for build button ?

    Thanks For Your Support!
     

    Attached Files:

    • 1.jpg
      1.jpg
      File size:
      869.9 KB
      Views:
      825
    • 2.jpg
      2.jpg
      File size:
      870.1 KB
      Views:
      781
  15. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Hi there, thanks for using TDTK.

    For 1, make sure the ScaleFactor value on both UI (script component on UIObject) and CanvasScalar on all canvas object (there's two for default UI, OverlayCanvas and MainCanvas).

    For2, I hope you are familiar with Unity UI system and scripting because this will need some modification. Basically you will need to create the confirm button that calls the build function which is called by the build button by default. Then you need to modify the original build button function call so that when it's pressed, it brings up the build button. You can find the build button function call in UITowerButton.cs, OnTowerButton().

    Hope this help.
     
  16. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    I've recently discovered an issue that if I set my scene SpawnEditor to finite, Allow Skip enabled, and Auto Generate enabled. After I complete the set number of waves, the scene does not display the level completed menu.

    Where are the calls/requirements, or any other checks for displaying the level complete UI?
     
  17. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I've done some testing on my end. Have to say I don't have any problem with this. Can I know how many waves do you have in your scene? Does it stuck when all the wave is cleared or before? Do you have the same problem if you use a default scene with default prefab?

    The easy way to check would be looking at the log. There would be log message indicating if a wave has start spawning, finish spawning or cleared. We can know if the problem comes from the UI or the spawn logic.
     
  18. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    I'm using a duplicate of your TDTK_FixedPath demo scene. I've made some changes to the input and camera system, so I cannot play the original TDTK_FixedPath demo scene file for testing. If I install a parallel TDTK project, everything works correctly in your demo scene.

    I have 15 waves in the scene.
    The game plays normally through 15 waves. When the final creep in wave 15 is dead, there is no end state triggered.

    In the logs it clears waves up to 15
    Code (CSharp):
    1. spawning wave15
    2. UnityEngine.Debug:Log(Object)
    3. TDTK.SpawnManager:SpawnWaveFinite() (at Assets/TDTK/Scripts/SpawnManager.cs:245)
    4. TDTK.SpawnManager:_Spawn() (at Assets/TDTK/Scripts/SpawnManager.cs:202)
    5. TDTK.SpawnManager:Spawn() (at Assets/TDTK/Scripts/SpawnManager.cs:187)
    6. TDTK.UIHUD:OnSpawnButton() (at Assets/TDTK/Scripts/UI/UIHUD.cs:97)
    7. UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1)
    8. LookInputModule:Process() (at Assets/Scripts/LookInputModule.cs:307)
    9. UnityEngine.EventSystems.EventSystem:Update()
    10.  
    & wave 15 completes spawning
    Code (CSharp):
    1. wave 15 has done spawning
    2. UnityEngine.Debug:Log(Object)
    3. TDTK.<SpawnSubWave>c__Iterator27:MoveNext() (at Assets/TDTK/Scripts/SpawnManager.cs:307)
    4.  
    I do not receive any cleared wave alerts after level 9.
    If I lose the level, the GameOverMenu displays correctly.
     
  19. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Sound like SpawnManager failed to keep track of the active creep count in the scene, from wave 9 and onward. This prevent the wave to be cleared and so the game never consider itself completed.

    So what change did you made exactly? To which script files. If possible, I would recommend you to replace SpawnManager.cs, Unit.cs and UnitCreep.cs with the default one. That is probably where the problem comes from.
     
  20. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    The only changes that I have made in your scripts were to the camera.main raycasts, to substitute selction for motion controllers.

    As you suggested, I think the problem is that I updated my SpawnManager.cs to Version: 3.0.1 f2 while leaving the other scripts on Version: 3.0. I have updated the Unit.cs and UnitCreep.cs and TDTK.cs to Version: 3.0.1 f2, but get a new error.

    Code (CSharp):
    1. Assets/TDTK/Scripts/Unit.cs(738,77): error CS1061: Type `TDTK.UnitStat' does not contain a definition for `minRange' and no extension method `minRange' of type `TDTK.UnitStat' could be found (are you missing a using directive or an assembly reference?)
    2.  
     
    Last edited: Sep 3, 2015
  21. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    I discovered that I also needed to update TDTK\Scripts\Class\TDTK_Class_UnitStat.cs

    Now everything is working correctly! I appreciate your top level support with this and all of your assets, Song. I have purchased all of your packs on the store, I only wish I could vote 6 stars!

    I'm sure that you receive many requests for new packs, but I would like to request an RTS pack. I think you would build the perfect solution for this type of game, and considering you already have pathfinding, resources, and AI, it appears that you would not be required to rebuild everything for such a pack. I would certainly be a day one buyer for such an item.
     
  22. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Glad that you fixed the issue yourself. And Many thanks for your compliment and custom.

    To be honest, RTS pack is quite challenging to do. Even there are some similarities, path-finding and AI fit for RTS are on entirely new level of complexity compare to the existing stuff that I've done. Not to mention that most system in RTS are inherently more free-form, making it very difficult to structure it down to a a user-friendly framework that allow lots of freedom for customization.

    However I've always been interested in RTS so I may still get to it some day. Maybe after I finish the projects on my hand. We'll see. :)
     
  23. DmitriyG

    DmitriyG

    Joined:
    Sep 8, 2015
    Posts:
    1
    How to save purchased percks and resourse "Part" in all next levels? Android platform.

    Sorry for my English
     
  24. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    If by saving you mean save the perk progress for future game session, I afraid you can't. You can only carry the progress from one scene to another by checking PersistantProgress on PerkManager. For saving you will require some custom code extension. If you are familiar with coding, I imagine it's not too difficult. Please refer Perk definition in TDTK_Class_Perk.cs and how the perk are initiated in PerkManager. What you need to do is just save the purchased on each of the perk instance (using PlayerPref) and load it in PerkManager before the initiation.

    The same goes for the resource, to save it you will need code extension. The relevent code can be found in ResourceManager.cs and TDTK_Class.cs.

    Hope this help.
     
  25. roch13boy131

    roch13boy131

    Joined:
    Sep 14, 2013
    Posts:
    11
    Hello Song Tan

    I was Just wondering my pause screen automatically shows up when i start the game but i dont want that to happen
    I was wondering what i have done wrong in your kit as i have done the same as you

    is it because i have no sliders or what?

    Kind Regards
     
  26. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Have you change anything? Have you got any error message in the log? Does this happen in the default scene in a fresh copy? What is the slider you are referring to?
     
  27. Arany666

    Arany666

    Joined:
    Jun 25, 2015
    Posts:
    11
    HI!
    Is there a way to modify the animation scripts to have, for example multiple idle animations in random way!

    Thank you.
     
  28. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    It's certainly possible, however it's not easy using mecanim. One way to do it would be create an animation controller which have several state for each animation type. Each state uses a different animation so you can randomly choose one to play.

    Alternative you can use scripting to change the animation clip of a particular animation state in runtime whenever the state is triggered. However I'm not sure how efficient this is going to be. You can see the code for yourself, the code to swap the animation clip of a particular animation state is in Awake() (starting line 54), where the user assigned clip is used to replace the default clip. So basically you will need to run that section of code (with a bit modification where you select a random clip), every time you want to go into a new animation state.

    Hope this help.
     
  29. g0tNoodles

    g0tNoodles

    Joined:
    Nov 28, 2010
    Posts:
    193
    Hello.

    I have been using this asset for some time and it does everything very nicely. However, I have recently found that any enemy with a speed value of 6+ and the game speed of 3x the damage is not updating. If the enemy speed is 5 or less, I can have the game run at 3x just fine. If I have it run at 3x speed and then put it to 1x when the wave is still running and an enemy hasn't reached then end point, the damage gets updated and displays correctly - I can then put it back up to 3x and the damage stops updating again. If I have the speed at 1x for the whole run I can put the enemy speed value up to 12 and the damage updates fine.

    Obviously, I could just put the enemy speeds down or not have a speed multiplier but that isn't a great option.

    I am still using version 2.2.3 (as far as I know - I can't update the package as I have messed about with the scripts too much!).

    Let me know if you need anything.

    Thanks.
     
  30. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Version2.2.3 eh? That's old! Good thing I still keep a copy of it on my

    My guess of the problem is at super sped up speed. The step position of the creep and the shootObject becomes too big that the existing logic is not fail safe enough to detect if the shootObject has hit. What you can do is add this two lines of code in ProjectilRoutine() and MissileRoutine() in ShootObject.cs, both in the while loop, just before the yield statment:
    Code (csharp):
    1. currentDist=Vector3.Distance(thisT.position, targetPos);
    2. if(currentDist<Mathf.Max(1, 0.25f*Time.timeScale) && !hit) Hit();
    This would double check the shootObject and target distance after the shootObject is moved. Also it scales the trigger distance with time scale.

    Please try this, hopefully it will fixed the issue.
     
  31. rockinreject

    rockinreject

    Joined:
    Nov 13, 2014
    Posts:
    1
    Just curious if its possible to use curved lines as the enemy route!

    Thanks in advance,
    Kieran.
     
  32. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    It's possible. The path is formed by a series of waypoints. You just need to add enough waypoints and arrange them so that it's curved. However you probably need to have alternate way to visualize the path as the original path effect may not look very good with a curve path.
     
  33. g0tNoodles

    g0tNoodles

    Joined:
    Nov 28, 2010
    Posts:
    193
    It certainly is lucky and thanks for the speedy reply Sir =]

    I have added the code you suggested but it still doesn't appear to be working for me. What should I declare "currentDist" as? I have tried float but when running the game, it still doesn't update.

    This is using an enemy speed of 8 and a game speed of 2 or 3 - it doesn't matter. However, using a speed of 1.5 allows the game to update the damage...
     
  34. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    You shouldn't have to declare currentDist. It has been declared in earlier in the function. I have noticed I might have made a slight mistake in the code. It should have been:
    Code (csharp):
    1. currentDist=Vector3.Distance(thisT.position, targetPos);
    2. if(currentDist<0.25f*Mathf.Max(1, Time.timeScale) && !hit) Hit();
    But it shouldn't matter really. The way I see it, there's no way it doesnt work with the added code unless something else is wrong. Thing is I'm not even sure if your code is same as mine at this point. You can send your ShootObject.cs to me so I can verify it.

    Something else you can try is increase the value 0.25, if the scale of the game you are using is larger than the default prefab. It depends on your prefab creep size. Just try keep upping the value until it looks like the projectile hit the target before it reaches it. If it doesnt work by then, surely something is wrong with the code.
     
  35. g0tNoodles

    g0tNoodles

    Joined:
    Nov 28, 2010
    Posts:
    193
    Hey Song. Again, thanks for putting the time in to help.

    It seems that increasing the scale value has done the trick.
     
  36. roch13boy131

    roch13boy131

    Joined:
    Sep 14, 2013
    Posts:
    11
    Hey Song Tan

    I was just wondering how could i make the Health bars be under my custom UI at the moment the Health bars are above the pause button and fast forward button for me how do i make it so its underneath it
     
  37. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    If you are using the default UI, try change the value or "Sort Order" on both OverlayCanvas and MainCanvas in UIObject. Make sure OverlayCanvas has higher sort order then MainCanvas.
     
  38. mahdijj

    mahdijj

    Joined:
    Sep 24, 2015
    Posts:
    31
    hi
    i want purchase this

    this source is good for making a complete android app?it is easy or hard?
    making an app for android by this with in app purchases is easy or hard?
     
  39. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Let me start by saying there's no magic solution to making app. With the right tool it can be relatively easy but you will still need to put some effort into it.

    I would say this toolkit is relatively easy to use provided you know the basic about Unity. It covers almost everything you need to make self-contained tower defense level, as in level 1, level 2 and so on. But a series of levels doesn't make it a complete game/app. You will still need to build your own menu, progress tracking (if there's any) and so on.

    It goes without saying that TDTK doesn't contain in app purchase. That's another component in itself. There are other 3rd party package that would do that. I can't really comment on how easy it's going to be. That would depend on the complexity of your system.

    Hope this help.
     
  40. Epilol

    Epilol

    Joined:
    Jul 21, 2015
    Posts:
    85
    Hi Song,
    I wanted to know if there is any way to avoid creeps overlapping each others while moving.
    Is this somehow already implemented in your code? In the description it says it uses A* (for example for the open path scene), does it cover this?

    I saw also in the code there is a commented mesh navigation part because it's a pro only feature (which isn't anymore), I don't know if this can help.

    Thanks a lot
     
    Last edited: Sep 29, 2015
  41. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    There are certainly ways to prevent the creep from overlapping. However it won't be straight-forward. The default A* algorithm used doesn't cover these. It's actually relatively easy to stop creep from overlapping. What you need to do is simply add a collider and do some collision avoidance. The problem here is when avoiding collision, faster creep wouldn't necessary be able to overtake slower creep in a effective manner. That would require very sophisticated system.

    So if that's not an issue. You can simply add Rigidbody to the creep. That should be able to prevent them from overlapping with each other.
     
  42. Epilol

    Epilol

    Joined:
    Jul 21, 2015
    Posts:
    85
    First of all thanks for the answer.
    I'm afraid this is a bit of an issue. Do you know if adding nav mesh and nav agents would help this?
     
  43. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm not sure to be honest. Navmesh only helps in collision avoidance. It doesn't always works well in all situation from what I observed. This being one of them. It might help in preventing the faster unit just pass right through slower unit in front, but I'm not sure an active overtaking maneuver might happen. It might be the faster unit just end up getting stuck being the slower unit if the speed difference is not sufficient.

    It's worth a try but you are looking at overhauling the whole movement system.
     
  44. Epilol

    Epilol

    Joined:
    Jul 21, 2015
    Posts:
    85
    Last edited: Sep 30, 2015
  45. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for sharing. :)
     
  46. roch13boy131

    roch13boy131

    Joined:
    Sep 14, 2013
    Posts:
    11
    Hey song

    I asked a question a while back about the ui and make the Health bars underneath the custom pause menu and such but you said sort order that would only work if it was both on overlay screen space while my overlay is on that and cant change while my main canvas is changes to camera overlay

    is there any other solotions without having to change the canvas render mode
     
  47. roch13boy131

    roch13boy131

    Joined:
    Sep 14, 2013
    Posts:
    11
    Also Song

    In my game i am trying to make a tower have a shield break and pierce of 1 so that when it hits the enemies that have a shield the shield will no longer exist but the problem is is that the enemies shield doesnt go away it goes all the way up im confused as to what is happening please help
     
  48. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Hi Song,

    I would like to make the creeps move on a curved path in 3D space, on a spline or something similar. I`m not necessary interested to incorporate a platform as a way-point on the spline. If that`s possible. even better, but it`s not a must have requirement. I`m interested to move the creeps on all 3D axes, not only on a flat plane. Something like Simple Waypoint System will do the job I think. Maybe it`s easier to integrate Simple Waypoint System than building a new one. It`ll be great to be able to move the creeps on the Y axis, too.
    Thanks in advance for your help.
     
  49. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Sorry for not responding earlier. I must have missed the email notification somehow. I believe the issue has been sorted through our email exchange (I have received and responded to emails regarding the same issue)? If not, please let me know.
     
  50. Mark_T

    Mark_T

    Joined:
    Apr 25, 2011
    Posts:
    303
    Yep, it`s all good. Looking forward for the final solution. Cheers!