Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

TowerDefense ToolKit 4

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

  1. boostybleep

    boostybleep

    Joined:
    Nov 20, 2013
    Posts:
    13
    Hi Songtan,

    I solved the issue. I had failed to add the box collider to the top level gameobject. Many apologies for taking up your time.
     
  2. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    I see. No worries. Glad that everything is working now.
     
  3. josephsaade

    josephsaade

    Joined:
    Apr 18, 2016
    Posts:
    46
    Hello songtan, we are considering using your toolkit but wanted to clarify a question we had first.
    The toolkit was intended for TD games, how well could it fit the concept of having the player deploy moving troops in addition to the towers?
    The troops would follow the same path of the enemy (meet and fight them on the path).

    Do you think your framework could work with our concept?

    Thank you.
     
  4. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Although that is not supported by default, I don't see how it can't be done. Pretty much all of the ingredients are there. It will take some work to put things together and build the interface to support the new gameplay but yes, this could definitely work.
     
  5. ptblk

    ptblk

    Joined:
    Mar 27, 2015
    Posts:
    57
    Hi song, asset looks cool. What is going to be different in V4, as I see you mention it on the changelog. thanks
     
  6. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    I'm sorry for the confusion but I'm afraid there's not going to be a 4.0 anytime soon, yet. What I meant is the code is in recent update is most likely going to be used as the base code for 4.0. I can't promise when that will happen. But I do tend to do a major version update from time to time, like when unity has been through some big changes, or when I find new and better ways to do things.
     
  7. boostybleep

    boostybleep

    Joined:
    Nov 20, 2013
    Posts:
    13
    Hi Song,

    Im trying to set up a tower building effect. I have set up a hammer model to rotate and look like its hammering on the tower base. The problem is that Building effect Autodestroy isnt working, ie the hammer object doesnt get destroyed. I dont have a built effect as I dont need that.

    Any ideas?
     
  8. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Thanks for pointing that out. I've just checked and indeed there's a bug with the auto destroy, for both the building and built effect. It will take time before the fix makes it to AssetStore. So please send me an email so I can send you the fix in advance. Sorry for the trouble.
     
  9. boostybleep

    boostybleep

    Joined:
    Nov 20, 2013
    Posts:
    13
    Hi Song,

    Thanks for the quick reply and sending the fix.
     
  10. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    No problem at all. :)
     
  11. Ankaman

    Ankaman

    Joined:
    Feb 14, 2014
    Posts:
    37
    Are you planing for a Hero System?
     
  12. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Well I'm afraid Hero System is a very vague term. Can you explain what are the heros and what do they do?
     
  13. Drewski66

    Drewski66

    Joined:
    Feb 12, 2016
    Posts:
    21
    Hi Song, I've encountered an issue after the last update where my Creeps will sometimes spawn dead center of the map, usually 0,0,0, instead of the first waypoint. I get a similar issue with creeps spawning from a SpawnUponDestroyed creep where they will spawn all the way back at the original creeps spawn point, even if it was the center of the map, then move directly to where they should have spawned, ignoring the path the whole time.
     
  14. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    I have to say I didn't manage to replicate what you described, on both default creep and creep that spawned upon destroyed. Looking at the code I didn't notice anything that could have cause this either. Does this happen frequently? Have you done any modification that could have cause this?
     
  15. Drewski66

    Drewski66

    Joined:
    Feb 12, 2016
    Posts:
    21
    The only differences I've made to scripts were for AoE towers to only trigger when a creep is near and for Mines to not be destroyed once triggered, and I've replaced all the scripts with new ones to try and fix it but it still happens. I can't seem to replicate the issues either if I start a whole new project, so it must be something that changed in my current project, I just can't figure it out lol. Any ideas what could maybe cause that? Everything was fine before the last update so my hope is it's something I could easily reverse. Thanks again for the help and awesome kit
     
  16. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    I would compare your UnitCreep.cs against the default UnitCreep.cs to see if anything has been modified. Particularly in the function Init(). Which is where the problem most likely originated from.
     
  17. Drewski66

    Drewski66

    Joined:
    Feb 12, 2016
    Posts:
    21
    I can't find any differences, I even replaced all the scripts with the updated default ones, minus the DB scripts, and it's still doing the same thing.
     
  18. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    If you are sure that the scripts are similar, then there must be something else in the scene that cause that. Have you try running the default scene? Do they have the same problem? Also how frequent does this occur? Is there a way to replicate them reliably?
     
  19. Drewski66

    Drewski66

    Joined:
    Feb 12, 2016
    Posts:
    21
    It occurs every time now. It seemed to work fine with prefabs that have no animation so I've tried disabling the animator and unit animation for my current creeps and no issues come up
     
  20. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Right, in that case I think I know what causes the problem. You must have put the Animator component on the root object of the unit prefab. I've changed the UnitAnimation script a bit to have the Animator transform to reset it's position, in case the death animation shifted it's position. But that was intended for a prefab setup where the Animator object is a child object of the prefab.

    You can now either setup the creep prefab like how it's intended (the model and animator component as child object) or modify the UnitAnimation scripts. If you choose the later one, try disable line75 and 76 of UnitAnimation.cs.
     
  21. Drewski66

    Drewski66

    Joined:
    Feb 12, 2016
    Posts:
    21
    Ah I see, thanks a ton Song, fixed it right up!
     
  22. Chaoslife

    Chaoslife

    Joined:
    Aug 16, 2016
    Posts:
    15
    Hi Song,
    I'm going to make a td game, and i found TDTK that has a mode about block path (The left on the image).
    Can TDTK make a path like the uploaded image and block it ( on the right )?I want to player make tower's movement 0.5 step per moving,sothat make path block like right on the image?

    Thanks,
    Chaos
     

    Attached Files:

    • 12.png
      12.png
      File size:
      20.3 KB
      Views:
      688
  23. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Very sorry for the late respond. The notification system has once again failed to notify me about your post. To answer your question, I'm afraid TDTK cannot support the half step movement shown in the right image. You will need a hexagonal grid for that.
     
  24. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    Hi Song,

    im considering buying your toolkit, but 1st, need to ask if your package worked fine on unity 5.4?

    Also is there a way to implement the waypoint generation on vuforia AR dynamically?

    thanks
     
  25. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Thanks for your interest.

    Yes it should work with unity5.4. I'm not familiar with vuforia and not sure how it works so I can't really answer your question. Sorry for not being able to help.
     
  26. ionside

    ionside

    Joined:
    Apr 7, 2011
    Posts:
    43
    Hey Song Tan,

    I purchased this addon some time ago, finally implementing into my project. :)
    I have a couple of questions regarding use that I couldn't track down in the documentation.
    • How can I go about setting specific creeps to specific paths?
    • How can I spawn creeps in groups, example; 5 bunched up groups of 6 in a wave?
    • What is the use of sub wave, compared to total creep count, and what is the difference of min/max between the two?
    Thanks for a great product,
    Rob
     
  27. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Thanks for your purchase. Let me answer your question point by point

    First, let me explain if this hasn't been made clear to you. In each wave, you can have multiple sub-wave. Each sub-wave will spawn a specific creep prefab to fixed set of setting (include path). The idea is you can have multiple groups of different creeps coming from different direction all within a single wave. With that in mind, here's the answer to your question:
    • You cannot set specific creep to specific path. You set specific path to a subwave of that creep.
    • Create 5 subwaves, with each subwave spawn 6 units with relatively small spawn interval. Then adjust the start delay of each subwave so that the second subwave spawned after a delay after the first is done, and the third after the second is done and so on. When running, you would have a group of 6 units spawned closely to each other, then a small delay, then another group and so on. Make sense? You can refer to the image.
    • I take it you are referring to the procedural wave generation. Total creep count means how many creep are there in a wave, subwave means how many groups of (potentially different) creep are there. The sum of amount of creeps in all subwave will be the total creep count. So min/max for subwave determine how many subwave (different group of creep) there is going to be at any single wave, min/max for total creep determine how many creep will there be in a single wave.
    Hope that all make sense to you.
     
    Proto-G likes this.
  28. ionside

    ionside

    Joined:
    Apr 7, 2011
    Posts:
    43
    Makes perfect sense, thanks for your help with the extra clarification.
     
  29. OP3NGL

    OP3NGL

    Joined:
    Dec 10, 2013
    Posts:
    267
    hi song, thanks for the answer..
     
  30. JollyManGames

    JollyManGames

    Joined:
    Jul 21, 2014
    Posts:
    10
    Hi Song,
    I would first like to say that I am a huge fan of your products. I am currently using the tower defense toolkit and had a quick question. Is there any way to add the tower defense component to a previous scene I had created? I created a new scene with the toolkit, but I cant get the lighting right, it seems too dark. If I could add the tower defense elements to a previously created scene that would be incredibly helpful. Thanks for your help,
    Scott
     
  31. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Well, I don't understand what exactly is the problem with the scene being too dark. It could have been a light setting thing. You can try open lighting window to make sure both the scene have the similar setting. If you want to get the TDTK component to you scene, you can simply copy all the game-objects in the TD scene and paste it to your scene. If you do that, you may want to delete the Directional-Light object in the TD scene to prevent it messing up the existing lighting.
     
  32. JollyManGames

    JollyManGames

    Joined:
    Jul 21, 2014
    Posts:
    10
    Thanks! I was able to add the tower defense component to my old scene. I have one more quick question. Is there a tutorial on how to change the camera settings. I have fiddled around with the settings and cant seem to change what I want. Thanks again!
     
  33. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    No tutorial I'm afraid. The setting on the CameraControl script are as straight-forward as they can be. If you mouse over each of the variable, the tooltip will pop up explaining what they are for. What exactly are you trying to do anyway?
     
  34. ionside

    ionside

    Joined:
    Apr 7, 2011
    Posts:
    43
    Hi, I have been getting an error in the demos and my own scenes:

    I've been ignoring it up until now but it might be worth investigating. Doesn't seem to effect the scene at all as it plays fine.
     
  35. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    ionside likes this.
  36. ionside

    ionside

    Joined:
    Apr 7, 2011
    Posts:
    43
    I have a couple of non-related questions.
    1. In the documentation for PerkMenu, the example image shows lines connecting the child perks to the parent. Is this something I can turn on in TDTK, or need to add myself?
    2. Is there an option to allow me to have the creeps play an animation before destroy when they reach the end of the path, or again something I should just implement myself? Or, can I prevent them from destroying?

    I don't mind if these things aren't implemented in TDTK, just want to know before attempting to do them myself. I've already caught myself out for adding scripts and then realising there's already a toggle for it in TDTK. :)
     
  37. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    1. The lines are something optional that supported by the ui code. But you will still have to manually setup the physical UI layout for them and assign them to the UI component. You can check the documentation as well as refer to the example scene to find out more.
    2. You can certainly have the creep play death or reach-destination animation. However you can do this on CreepEditor (sorry the documentation is a bit out of date with this). You will have to manually add UnitAnimation.cs to the creep prefab and configure it using Inspector. You can refer to the example creep prefab in 'TDTK/Animation/ExamplePrefabs/Creep'.

    Hope this help. :)
     
    Proto-G and ionside like this.
  38. ionside

    ionside

    Joined:
    Apr 7, 2011
    Posts:
    43
    Awesome!! I somehow didn't notice the persistent perk example in there, and the Unit Animation script is spot on!
     
  39. mapb2005

    mapb2005

    Joined:
    Aug 31, 2016
    Posts:
    4
    Hey Song,

    First of all amazing work on the Kit!!
    I'm sure you've been asked this quite a few times but is there a way to implement a tower that spawns defensive units?

    Thanks :)
     
  40. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Thank you! :)

    I'm sorry to disappoint but I'm afraid there's no way to make a tower that spawn defensive units right now. Not without coding it yourself anyway. I've indeed been asked the question quite a lot of time. And I'm quite tempted to see if I can add that. However that is not going to happen any time soon. I've got quite a lot of stuff to go through before I'll have time for it. Even then, there's no guarantee it will make it to release. It's very tricky to do, which is why it's not there in the first place.
     
  41. yksmai

    yksmai

    Joined:
    Feb 21, 2016
    Posts:
    3
    Hey Song,

    there is a problem after you lost a level. When u click on the restart button and DragNDrop is active, he missing the canvasGroup and you cant build any tower.
    Any solution for this?
     
  42. ionside

    ionside

    Joined:
    Apr 7, 2011
    Posts:
    43
    Regarding UnitAnimation.cs

    Hi, I'm setting up a creep with the unitAnimation.cs script and running into a few issues.

    The creep sometimes plays the spawn animation, but doesn't play the move animation in wave 1 or 2 ... unless, I create a tower to shoot the creeps, then the next ones to spawn (in wave 2) will play their move animation. However, some of them are spawning at world origin rather than the path start.

    I have "Apply Root Motion" turned off. Otherwise all of the spawning creeps spawn from world origin (0,0,0).
    Looking in the Animator window and selecting one of the creeps that aren't playing through their move animation, the node is showing that the animation is being played (looping).

    Update: I've found adding an ObjectPoolManager seems to have fixed the spawning from origin issue, hasn't fixed the first wave's lack of move animation though.
     
    Last edited: Sep 11, 2016
  43. profwar

    profwar

    Joined:
    Sep 1, 2016
    Posts:
    7
    The same occurs to me.
     
  44. TensonHanzo

    TensonHanzo

    Joined:
    Sep 16, 2012
    Posts:
    13
    I tried to play around with the animation assets also and seem to be in the same boat. Testing on a fresh project with current version of TDTK. Added the animated_cube creep to the database and spawn manager without messing with any other settings. The animations out of the box don't appear to be setup correctly in this version or requires additional configurations. I can see that the "run" animation for the cube works via the inspector but won't animate during actual game play (some animations do fire, such as the "destroyed" effect). What is the ideal setup for an animated creep/tower prefab?
     
  45. profwar

    profwar

    Joined:
    Sep 1, 2016
    Posts:
    7
  46. ionside

    ionside

    Joined:
    Apr 7, 2011
    Posts:
    43
    Yes I think it's the one called "TDUnitController" which can be found in Assets/TDTK/Animation. At least, this is the one I've been using.
     
  47. mapb2005

    mapb2005

    Joined:
    Aug 31, 2016
    Posts:
    4
    Hey Song thanks for the response!

    I had two more questions

    1. Since it is much harder to make the structures spawn defensive units, is it possible to simply place defensive units like an ability?
    2. Is there a way to make a structure/tower not attack and only collect resources over time?

    Thanks :D
     
  48. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,990
    Very sorry to you all for the slow responds. The notification system failed me again. :(

    @yksmai, I have to say I've tried it on my end without running into any trouble. Are you using the latest version? What version of unity are you using? Also do you encounter any error message?

    @ionside, @profwar, @TensonHanzo, The animation in the current released version is indeed slightly broken, due to a mistake I've made in the script. But it's very easy to fix, you simply need to move all the code in Start() to Awake() in UnitAnimation.cs. If you are not sure, please send me an email so I can send you the modified file. Very sorry for the trouble. To clarify, the animator controller that you need to use is TDUnitController in Assets/TDTK/Animation. The tutorial is based of older version of TDTK.

    @mapb2005, To answer your question:
    1. The most tricky bit of defensive unit is that they need to have additional behavioural control. Things like which hostile to target, where to move, when to stop, etc.. Then you will need the same thing on the other end for the creeps. Do they stop to engage and how to move towards the target, etc.. Placing them is actually the easier bit.
    2. Absolutely, Set the tower type to 'Resource' in tower editor. There is one example tower (named Resource Tower) that does exactly that.
     
  49. ionside

    ionside

    Joined:
    Apr 7, 2011
    Posts:
    43
    Hey Song, Thanks for that. Unfortunately Moving the code into Awake function hasn't helped. However if I turn off the Object Pool Manager the first two spawned creeps play their move animation, but the ones following don't... turn pool manager back on and it behaves as specified earlier.
     
  50. profwar

    profwar

    Joined:
    Sep 1, 2016
    Posts:
    7
    Hello again, Song. Creeps stop to appear from center of board. But I have no animations yet. Maybe a new tutorial could help us.