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
    Just adjust the size of the collider on the tower prefab so they cover the mesh. You will see the bound of the collider as the green line on the SceneView.

     
  2. nubii

    nubii

    Joined:
    Dec 4, 2014
    Posts:
    2
    Thank you very much it works now :)
     
  3. Rajmahal

    Rajmahal

    Joined:
    Apr 20, 2011
    Posts:
    2,101
    Awesome ... love your game kits. Best things I've purchased on the asset store.
     
  4. LandonC

    LandonC

    Joined:
    Dec 20, 2012
    Posts:
    83
    Hi, Im having difficulties creating a tower prefab, i added all the components to the tower prefab and attach to the tower manager. but an error occurs when I press on the button of the tower and I cannot enable the screen to activate the grid, the error says "argument is out of range". what could be the problem?
     
  5. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Can I know the following:

    By attach to the tower manager, you mean add the prefab to TowerEditor?
    What version of TDTK you are using?
    Which button you are pressing? The build button?

    Finally, can you show me the full error message? I need to know from which script it originates from.
     
  6. RobbyMilrr

    RobbyMilrr

    Joined:
    Oct 20, 2013
    Posts:
    5
    Hey guys dumb question, I'm wondering how to add a tower, I create the prefab tower, then go to TowerEditor page and click on the "Add new tower" circle button but I can seem to select my towers, they don't even show up.
     
  7. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Try drag your tower prefab from ProjectTab to the "New Tower Prefab" slot.
     
  8. RobbyMilrr

    RobbyMilrr

    Joined:
    Oct 20, 2013
    Posts:
    5
    Okay got it, thanks a ton mate, really appreciate the quick reply and help!
     
  9. RobbyMilrr

    RobbyMilrr

    Joined:
    Oct 20, 2013
    Posts:
    5
    Also do you have any idea when the tutorial is going to be released? I'm having trouble getting pivot points in the right spots. Also I'm having trouble adding damage my towers can deal to the enemy I added it in the "TowerEditor" panel, but doesn't deal any damage to the enemy units. I tried accessing the older tutorial you had on the website but the video settings are set to private currently. Is there any way I can view the older video even though it is out dated it would still provide good information on how to do certain tasks.

    Kinda new to this but enjoy the learning process. I really appreciate all the help!
     
  10. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'll try to make a new tutorial when I can. Unfortunately it wont be soon as I'm quite busy this month.

    However you have a point that the older tutorial may still be useful. I mean the editor will look completely different but at least not much has changed in term of setting up towers and creep prefab. Therefore I've enabled them again, just for reference.

    If your tower is shooting but not dealing any damage to the target, make sure your hit chance is set to be >0 and your creep dodge chance is significantly less or the shot may never hit.

    Hope this help.
     
  11. tucano

    tucano

    Joined:
    Nov 9, 2011
    Posts:
    30
    Hello, a question regarding the tower editor for the last version (3.0). It is possible to increase the number of possible upgrades path for a tower to 5? or you can add an option to control the number of possible upgrade paths?

    I refer to the option: "Next Level Tower 1" and "Next Level Tower 2" in the Tower editor.

    Thanks!
     
  12. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm afraid as it's, it only support up to 2 towers. You can extend the code to accommodate more if you wish.

    By the way I'm currently away from home and thus doesn't have access to reliable internet connection. I'm hereby apologise in advance for any slow respond. Normal service will be resume by this weekend.
     
  13. LandonC

    LandonC

    Joined:
    Dec 20, 2012
    Posts:
    83
    Hi, thank you for replying! Apparently I've figured out my previous issue after a couple of fiddling. But currently I have another issue I would like to ask advice on.

    I'm facing an issue trying to make my own "powerup" skill to kill the enemies. First thing, I'm not very good at understanding how the enemy health works so basically I've come up with OnTriggerEnter script to try to decrease the health of the enemies, but it didn't workout as I don't really know how to call the Properties component of the enemy clones from my other script.

    Using another method which I am okay with is to directly destroy the gameobject the "powerup" collider collides with, it works, the enemies get destroyed, but the thing is the towers that are attacking the enemy would come out with an error and they wouldn't attack enemies after that.

    the error as follows:
    MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
    Your script should either check if it is null or you should not destroy the object.

    So.. my question is, if possible can you guide me to know what I should do to decrease the health without using the Powerup Script in the template? or can you tell me what I do I need to add to allow the towers to go back to an idle state when the enemy gameobject is null after it is destroyed?
     
  14. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Right, you probably know now that you shouldn't just destroy the unit's gameobject. What you should do instead is to get the unit instance and call the function ApplyDamage() on it. If you are using OnTriggerEnter(), it should goes like this:
    Code (csharp):
    1.  
    2.     public float damageValue=50;
    3.    
    4.      void OnTriggerEnter(Collider collider){
    5.        Unit unit=collider.GetComponent<Unit>();
    6.        if(unit==null) return;
    7.  
    8.       //deal 'damageValue' amount of damage to the unit
    9.        unit.ApplyDamage(damageValue);
    10.      }
    11.  
    If you want to kill the unit, just make sure you set the damageValue to something sufficiently large.

    On the other hand, I'm not quite sure what do you mean by allow the towers to go back to an idle state. Do you mean prevent it from throwing up error after the target is destroyed? If you use the method I stated above, you shouldnt be getting any error.
     
  15. photon

    photon

    Joined:
    Mar 2, 2010
    Posts:
    7
    Hi Songtan or anybody else who can help,

    is there a way animating our creeps with legacy animations? It does not work :-(
    at least not in Unity 5 - TDTK version 3.0) - we have many errors.

    Do you have any tips or proposals?
    We would really appreciate your reply! Cheers!
     
  16. photon

    photon

    Joined:
    Mar 2, 2010
    Posts:
    7
    Dear Song,
    thank you so much for your fast reply!
     
  17. Vagos

    Vagos

    Joined:
    Dec 16, 2014
    Posts:
    3
    Hey Song,
    I am using tdtk v2 and i need my tower to be able to get more than one different upgrade.
    For example, if it is a level 1 tower i need it to be able to get like 4 different upgrades.
    Tucano's question above is for v3 so i guess you made an update in tdtk with a upgrade path feature.
    Is there a way to use this in v2?
     
  18. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Unfortunately multiple upgrades path for towers are not supported in TDTK2. It's quite difficult for me to do that due to the way the code is structured in the first place, and the fact that there are multiple UI solution that needs to work with it, which is the reason I rebuild the whole framework. You can modify the code yourself but honestly, I would suggest you to just upgrade to version3.
     
  19. Vagos

    Vagos

    Joined:
    Dec 16, 2014
    Posts:
    3
    tdtk3 needs unity 4.6 if i'm not wrong and i got some problems with it when i installed it, so i had to downgrade it back to 4.5.
    Is it possible to work with 4.5?
    Also the old tutorials work for tdtk3 or things changed a lot? :p
     
    Last edited: Dec 16, 2014
  20. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    TDTK3 should work on Unity4.5 if not for the GUI. So it wont work right out of the box. You will need to scrap and rebuild the GUI.

    TDTK3 and TDTK2 is pretty similar in many way so if you have gone through the old tutorials, you should be right at home for many of the elements.
     
  21. Vagos

    Vagos

    Joined:
    Dec 16, 2014
    Posts:
    3
    Alrighty Song, thanks a lot for your info! I will try new 4.6 patch (i tried before a while ago to update) or else i will go for gui rebuild :)
     
  22. Monsu

    Monsu

    Joined:
    Dec 20, 2014
    Posts:
    13
    Hi Song,
    Thanks for building the only thing I ever bought from the Asset Store.

    I am developing primarily for iOS/iPad. In your demo project you have created scenes ForMobile. They work straight out of the box for iOS. But now I want to start creating my own levels/scenes. If I use your built in TDTK->New Scene feature, the scene will not work for mobile. Things will be scaled incorrectly and the interface does not work properly. Can you help me get started quickly by either:
    - Tell me what the changes are between your normal scenes and the ones ForMobile
    - Create a new "TDTK->New Scene" template, but "TDTK->New Scene For Mobile"
    - Explain to me how I can "copy and paste" your Mobile Scenes and create a template from those

    Thanks in advance!
     
  23. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks @Monsu. :)

    The only difference between normal and the mobile scene are the scaling of the interface. You can read about this in the pdf documentation, under the section Scaling the UI (pg14). The scale factor for the UI for mobile scenes is set to 2 so that the UI elements dont appear too small on a device with high DPI value.

    You can always duplicate a scene by select them in the ProjectTab and use short key "ctrl+D". By doing this you create a new identical scene. You can then go ahead and modify the new scene while keep a copy of the original.

    Hope this answer all your question.
     
  24. Monsu

    Monsu

    Joined:
    Dec 20, 2014
    Posts:
    13
    Thx,
    Very quick answer. I had missed the PDF-file... Impressive support.
     
  25. Monsu

    Monsu

    Joined:
    Dec 20, 2014
    Posts:
    13
    Hi, No need to say this I guess. But I am really looking forward to the see the ScoreSystem being developed for 3.0. I was starting to design a score system myself, when I came across that the older version of TDTK had a ScoreSystem. Any idea of the time I might have to wait before you have published it?

    Thanks in advance!
     
  26. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Honestly, I dont really have plan for that. From what the feedback (or lack of) I gathered, the score system is not really used by most of the users so I have leave it out when building 3.0. I might add it sometime in the future but for now I really cant say. Feel free to develop your own, I'm happy to help if you are stuck and need a pointer in the right direction. Sorry for the inconvenience.
     
  27. m2012t

    m2012t

    Joined:
    Nov 30, 2014
    Posts:
    2
    Very useful, :)

    I have a question about creepers targeting: is there any way to set a custom hit area, that is not the center of the mesh, on creepers to aim at?

    Would be great if there would be a way to set a custom hit area on enemies, something just like the Shoot point for Towers, but this one to define where the bullet or laser beam hits the enemy.
     
  28. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    You can place a reference transform on the prefab, assign it as the TargetPoint. TargetPoint, when exists, is used as the point where all the shootObject would aim at. It works like the ShootPoint for shooting, but as a target on the other end. It's not exactly an area. But it's something you can use to position the aim point within a unit.
     
  29. Felisae

    Felisae

    Joined:
    Aug 11, 2014
    Posts:
    9
    I've noticed a few issues while toying around with the available scenes and getting used to the toolkit. All of these occur in Unity 4.6.1f1, using TDTK v3.0f2. All have been repeatedly tested to ensure the bug isn't a one-time fluke, with the exception of #5, which I can't seem to trigger reliably.

    1.) It seems that if you take a price reduction perk for a tower, and then repeatedly mouse over a corresponding tower's Purchase or Upgrade button, the price will repeatedly drop until it reaches zero. I noticed this when I saw a discrepancy in the description (25% off of 20 is not 17).
    - Taking the "Energy Tower Cost" or "Projectile Tower Cost" perks will cause cost reduction to be applied each time the mouse runs over a corresponding build button, be it building a tower from scratch or attempting to upgrade the tower. This repeatedly stacked cost reduction will be applied to each tower TYPE individually. This means all MGTower prices will be reduced together, PulseLaserTower prices are reduced together but separately from MGTower prices, BeamLaserTower prices are reduced together but separate from the other two, etc.

    2.) On the note of price reduction errors, it also doesn't seem to be applying discounts properly. As stated above, 25% off of 20 is definitely not 17. However, when checking the discount section of the perk, the discount is set to "0.1", which by tooltip description would be a 10% discount. 10% of $20 is $2, so the price should be reducing itself to $18, not $17. This error however may be related to whatever is going on in the first bug, which is why I tossed it second on the list.

    3.) Perks that unlock towers don't seem to function at all, at least in the example content. Taking the "PulseLaser mk2" perk does not enable the "PulseLaserTower mk2" to be built from any stage of an MGTower or its upgrades (I'm assuming it's supposed to build from a PulseLaserTower, but the options don't change). In the TowerEditor it DOES have an entry for previous lvl tower, which is the "PulseLaserTower". The same also applies to the "CannonTower mk2" perk and the corresponding tower. Despite these perks appearing correct in the menu options themselves, the towers they're supposed to add, aren't.

    4.) If you're running in fastforward mode (x3 speed?) and you open the perk manager, when you close the perk manager again the speed will have returned to x1, despite x3 still being selected. You have to click the button to return to normal speed, and then click it again to get it back to x3. This happens regardless of what "PauseGameInPerkMenu" setting you use.

    5.) Sometimes values seem to change without being interacted with. The cost of towers was reduced to 0 in the TowerEditor itself at some point during testing, but I'm not sure what caused the reset. I spotted it while starting a new test (hitting Play) and suddenly a couple towers cost nothing. From that point on during any test they cost 0, unless I changed it myself to a specific value. They then reset again later, despite my not touching the cost in the TowerEditor. Perk prerequisites were also removed from perks in the PerksEditor at some point, and I'm 100% sure I did not touch those myself. I can't seem to purposely reproduce the bug on demand despite my testing, it seems to be sporadic. There were times I had the Editor screens open as I was running the game, off to the side. Testing this again now doesn't seem to cause the data loss. I would assume it's a more widespread issue not just tied to the two menus given, however those were the two I was interacting with at the time. I apologize, this one I can't pin down the exact cause of.
    _________________________________________________________

    And now a couple questions.

    With the current code, is it possible to have perks apply globally, rather than only per level and then resetting for the next? Perhaps it's an option I missed? Many TD games have a perk system that you place points into from the main menu, and these apply to all maps played once placed, allowing for an overall feeling of progression rather than resetting with every map.

    I think I misinterpreted something somewhere and assumed this would work for 2D design. I assume I was wrong in that? I think I could still emulate it with flat planes or something similar, but before I attempt to start 'tricking' the toolkit, is there any 2D support already that I'm overlooking?
     
    Last edited: Dec 26, 2014
  30. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for telling me about the bugs. I'll look into it and get them fixed asap.

    The perk system are set to be working within a single level only. However with slight modification you can make the progress persists through out all levels. I hope you are familiar with coding. What you need to do is to save the ID of the purchased perk (purchased flag set to true) at the end of each level and upon the next level, set those ID as the purchasedIDList of PerkManager, as soon as Init() is called. You can email me if you need more details.

    There's no support for 2D asset. However you can still use them assume you are using a top down view. Any other camera angle would require some additional system to handle the sprite facing and animation. The problem is here is visualization, the mechanic would still work regardless.
     
  31. Felisae

    Felisae

    Joined:
    Aug 11, 2014
    Posts:
    9
    I have some programming experience, but I'm rather rusty and rough around the edges. With enough toying with it I could probably eventually figure it out, but it would certainly make things faster to contact you. I may do that, thank you for the offer.

    I assume that if the purchased IDs can be carried over in that fashion, the resource used for purchasing the perks probably could as well. And if the resource can be carried over, then it should also be possible to call the Perk screen from somewhere other than just a defense scene, such as an overworld, correct? People wouldn't need to access the perk screen from inside an actual defense scene, as long as the perks are still being called and activated correctly behind the curtain.

    I tried doing it using the Demo version. I locked the camera to be looking straight down, however despite the sprites appearing properly when the turrets are initially placed, as soon as they would attempt to rotate to fire at a target they would lift back to the X/Y position and disappear from view (as they're an object with no Z-depth but being viewed from a Y-down perspective). I haven't attempted it with the full version yet, as I've been too busy digging up and testing those bugs!
     
    Last edited: Dec 27, 2014
  32. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    If you manage to carry the perk system's info (progress, currency, etc) from one scene to another, yes you can simply put a PerkManager and the relevant UI into any other scene (the overworld) and have the player interact with it from there. And of course if you have the progress from the over world carried forth to the actual game scene, you can disable the perk UI in the game scene so the player cant access it in a game scene.

    For the 2D asset, you need to make sure that the sprite face up with x-axis rotation is 0. And you will need to disable the "Aim rotate in x-axis" flag in TowerEditor.
     
  33. Felisae

    Felisae

    Joined:
    Aug 11, 2014
    Posts:
    9
    Tested that right now, it works! And using priority layers I should still be able to get the base/turret effect that we have with the 3D models. When I tried it in the demo a few days ago, as I mentioned above, it didn't really seem to like sprites, but using the full version with the flag you mentioned turned off, everything's working beautifully. Thank you!

    Another question for you. I see there's a prefab for a Flamethrower turret, however it wasn't added to the TowerEditor. I added it to look through the options. I can't seem to find a cone-attack option, does that not attack shape not exist currently? AoE doesn't quite fit the bill for that sort of thing.
     
    Last edited: Dec 27, 2014
  34. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'm afraid cone-attack is not supported atm. It doesnt quite fit in with the rest of the implementation so I'm leaving it out for the time being until I can find a solution I'm happy with.
     
  35. Felisae

    Felisae

    Joined:
    Aug 11, 2014
    Posts:
    9
    That's unfortunate. The design I had in mind includes a couple of towers using that type, as well as a line-attack. Hmm. Maybe I can throw something along those lines together at some point in the future when I know a bit more about the toolkit.
     
    Last edited: Dec 27, 2014
  36. Monsu

    Monsu

    Joined:
    Dec 20, 2014
    Posts:
    13
    Dear Song,
    Thanks for a very good support and Happy New Year everyone! I have toyed around with the system for a while now and it is great. However, I have a few issues (some, are the same as above). I will start with number 3 above.

    3.) Perks that unlock towers don't seem to function at all, at least in the example content....

    I can't get this to work at all. What am I doing wring:
    1. I create a perk with the type "New Tower" linked to the right tower.
    2. For the same tower I check "Disable in Build Manager"
    3. I run the game, any level
    4. In that level, I can build anything but this tower that I have disabled (according to spec)
    5. I go to the Perks Menu from the level and buy the Perk above (according to spec)
    6. I come back to the level and expect to be able to build this new tower, but it is not available (not according to spec)

    I have tried this, over and over, with different towers, with all towers, with single towers, etc. No matter what I do, the tower does not become available for me to build.

    Also, the exact same situation goes for Abilities. If I have a perk that enables an Ability and I click "Disable in AbilityManager" for that ability, I can't ever use the ability. Since after I bought the perk, it won't show up as an option to buy.

    2) Persistent Perk system:
    Another thing I have done is created a "persistent perk system" according to your specification. So I carry over the list of PurchaseIDs between levels. I even store them in the cloud, using Parse, for every user, so they are remembered between game sessions. It however does not work properly. The effects of the perks are not persistent at all. Only the data on which perk is purchased. What do I need to do to make sure the effects of the perks are loaded in each level?

    I have perks of different kinds:
    - ones enabling towers and abilities (those don't work at all to activate, not even within a level, see above)
    - ones giving extra life (they work perfectly when purchased the first time, but they are not persistent when loaded in the next scene)

    The effect of this is of course that the system remembers that the perks have been purchased, so I can't purchase them again in the new levels. But the benefits from them are not given to the user in the other levels.

    3) Audio Manager:
    - The audio manager seems to work great for all sound effects, I configure it once in my main menu and they work for all levels
    - However, the Music feature does not seem to work. I have tried with one song, many songs, with all different options enabled or disabled. But it refuses to play any music. Any idea of why?

    Thanks in advance for a great product/support!
     
  37. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Happy new year!

    Perk that add new tower and new ability doesnt work is a known issue. I'm working on a fix. Hopefully it will be up in AssetStore in a few days time.

    I found some bug too with the Initiation of PerkManager which could explain why the perks doesnt take effect if they are not purchased in runtime. Please email me if you want the solution in advance.

    I'll look into the issue about the music and incoporate it in the next update. Sorry for all the inconveniences.
     
  38. Monsu

    Monsu

    Joined:
    Dec 20, 2014
    Posts:
    13
    No worries,
    No rush, looking forward to the update. In the mean time, I have another issue I can't get my head around. Please forgive me in advance, the reason for me having this issue is probably the lack of experience with Unity and/or animations, rather than anything to do with your TDTK.

    I think instead of trying to answer my specific question, it would be much better if you added a section about "Animated Creeps" to the documentation and either a walk through of a new creep, or just a break down on how the CreepCube_Animated creep is configured, how it works and why. Anyway, here we go:

    Due to my inexperience, I decided to buy a few models and use them as creeps, these rats: https://www.assetstore.unity3d.com/en/#!/content/23353

    What I liked was that they already had animations for Walk, Dead, etc. So I could easily find the different animations needed to get a nice creep. It seemed pretty straight forward. I tried to use CreepCube_Animated as my model and created a prefab based on one of the rats. Then I configured it pretty much the same, with rigid boy, creep animation scripts. Different "Clips" for Spawn, Dead, Move, etc. I also added the CreepAnimatorControllerTemplate. I have uploaded a few screenshots from my rat configuration. You might spot something out of order. Skärmavbild 2014-12-31 kl. 14.21.17.png Skärmavbild 2014-12-31 kl. 14.21.43.png

    But I never got it to work. I noticed that in the downloaded pack of rats, each "animation" such as Walk, Dead, etc, is connected to a different prefab. But I am trying to use one rat prefab that links to these different animations.

    I also noticed that your CreepCube_Animated is one single prefab, and then it has three different animations in the same folder (not directly tied to the animation). I don't know the difference or what to do.

    If you can't help me and/or add a section about animated creeps in the documentation, can you please direct me to some general help/understanding for animated objects in Unity?

    Thanks
     
  39. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I'll be adding a small section of how to setup animation to the documentation in the next update. Looking at your setting, you havent assign the Animator component to the script. In your case, you can simply drag the prefab itself to the slot.

    I'm afraid I'm not the best person to tell your about animation. I'm in the dark most of the time when it comes to animation setting. I only know how to get them to work on a very basic level. And with some trial and error require half of the time. The stuff that I've learn from are just those that you can find from a simple google search. I'll explain in a generic manner so I dont get the details wrong. In a nutshell, Animator component runs the animation based on a preset FSM in AnimatorController. You can control the FSM in the controller via script. Put it together, we have a AnimatorController set to work for a creep, run by the animator component, which drives by the script.

    The example animation clip are simple animation files created in Unity, therefore it look different from yours. Even in imported model, sometime it differs (probably use to the way the animation is setup/organised in the modelling/animating software). You dont need to worry too much about this, an animation file is still an animation file. As long as it's targeted to the right bone, it should work.
     
  40. Felisae

    Felisae

    Joined:
    Aug 11, 2014
    Posts:
    9
    I have a few more questions for you. The first being, out of curiosity, do you have a rough idea of when that next version may be ready? I've been toying with scripts a little bit to see what might be possible, but I didn't want to change too much then have them overwritten by a new TDTK version.

    Secondly, in the TDTK Demo version, when placing towers they would have a transparent/highlighted effect, rather than their usual textures. However, in the full version of toolkit, DragNDrop'd towers have their usual textures, which on smaller grid sizes means you a may not be able to see the cursor, and therefore have to guess what a valid position is. Is it still possible to use the highlight effect in the newest version currently, or is that something that would need to be re-added ourselves? When using DragNDrop, an indication when a position is valid would be useful (such as the turret turning red in an invalid position).

    Third, this may actually be a bug report, as I'm not sure if I'm misinterpreting what I've found or if it's simply not working properly. Part of my design concept is to be able to place towers anywhere in valid space, rather than on a grid. When messing with the Build Manager's Grid Size, I noticed that I couldn't set the grid below a certain value. Curious about that I opened the script and started browsing, and discovered this line and the code that follows:

    Code (csharp):
    1. //check if the position is blocked, by any other obstabcle other than the baseplane itself
    2. Collider[] cols=Physics.OverlapSphere(pos, _gridSize/2*0.9f+footprint*_gridSize, ~maskAll);
    Me being me, I decided to test that. I set the grid size as low as possible (which is 0.25 currently, but I did find how to change that), and changed the placement type to DragNDrop, then began to test. I noticed some significant overlap in terms of collision boxes, despite what I'm assuming is supposed to prevent that. While in PointNBuild I see the cursor change to red, but only when the cursor is actually under a placed turret. As soon as it moves outside the bounding box, it will turn to green, and when another turret is placed (again, in either mode), you end up with something like this:

    The collision boxes are definitely overlapping. From the way it acts currently, I assume that this is checking the mouse position for placement, rather than the size of the turret being placed. That means that if you're working in DragNDrop mode (as I was in the screenshots above), when you try to place towers you can definitely get an overlap. This effect is pronounced if you change the minimum from 0.25 to, say, 0.01 (in order to emulate a more free placement), as the placement of towers can be made much closer.

    Was it intended to only affect the cursor on the grid? At the moment, the only way that I can see to prevent such an overlap is to either make all turret sizes uniform and increase the size of the collision box, or increase the size of the collision box in relation to the size of the turret for each one. The latter has flaws in that if turrets have different sizes, it's difficult to plan ahead and invariably will cause gaps.
     
    Last edited: Jan 6, 2015
  41. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    I will upload another update within a day or two, hopefully. However that is just for bug fixes, there will be no additonal feature or change.

    There are indication for a valid build position, the tile indicator will turn red when the position is not valid. I did disabled the transparency and color indication for the sample tower in the full version. The transparency is disable becuase it needs to alter the material used for the tower. It might mess up certain custom tower. You can add it back yourself if you want. You will find the code to create the sample tower in BuildManager, CreateSampleTower(). And the code to change the material and color for the meshes are in Ultility.cs, SetMatRecursively and SetMatColorRecursively.

    The towers are not meant to overlap. The problem is you are trying to use the toolkit in a way that it's not intended for. There should only be one tower per one tile so the tower should be sized to fit in the tile. The way it works is each tile on the grid is a node/waypoint for the path-finding system. A tile on the grid will only get blocked if the tile is actually been built on. Shriking the tile size will keeping a tower size will simply break the system. So even the overlapping of the tower doesnt happen, the creep would still be able to slip pass between the empty tile between those towers.

    What you need is another system entirely. One that doesnt tie the path-finding graph to the build points. In TDTK current form, you will need to specify a footprint for the tower, and block the effective footprint of the tower when built for that to work.
     
  42. Felisae

    Felisae

    Joined:
    Aug 11, 2014
    Posts:
    9
    Ah ha, so it IS only meant for the cursor! Got it, I was just misinterpreting what the code meant then. And that can work out! Thankfully, my concept only involved designated paths, I wasn't intending on using pathfinding (other than in specific areas that I would likely disable turret placement on for environment reasons, to allow creeps to spread a bit and create a bit of randomness), so I don't need to worry about creeps sneaking through between towers due to the grid size.

    I really do appreciate your input and help, by the way. I realize I'm trying to do a lot that the toolkit wasn't meant to do, and I apologize if I'm annoying you at all. I'll probably stumble across all sorts of odd things, since I'm trying to fit a square peg into a round hole. :p
     
  43. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Dont worry about it. I dont mind at all. I would try things is different way myself if I were you. Feel free to ask me if you want to try anything. There's no need to try to work things out in the blind. :)
     
  44. Felisae

    Felisae

    Joined:
    Aug 11, 2014
    Posts:
    9
    Gonna drive you nuts! I found a few more bugs, and this time it wasn't even by doing things I wasn't supposed to do.

    (link), (link)
    I made a much stronger minion in order to test various configurations of turrets and wave sizes. Stop me here if there's something wrong with that minion, but I think it's pretty standard. Just duplicated Freighter 2 and changed health, shield, and speed. Then I made a wave that spawned them quickly with a long duration.

    (link), (link)
    Bug #1!
    I placed two basic Cannon towers to test the minions. I set them both to First targeting as shown in the first screenshot, but while they start out on first, they soon begin to deviate. I changed the bottom turret to Nearest in order to check, but it continued to target whatever it wished. You can also see in the second screenshot that the top turret, which is still set to First, is now targetting something all the way near the back of the wave for some reason.
    My guess: It seems like towers continue to use Random targeting despite the setting they're given.

    Side comments:
    Towers seem to continue to target the same minion once they've locked on. My initial thought was that Random would actually be random, and Nearest would switch targets to whatever's closest between shots, otherwise what's its purpose? But this may be due to whatever's wrong with the above. And on that note, there's a First targeting (which isn't working at the moment of course), but no Last targeting (shooting the enemy that's closest to the path's first waypoint), which seems like a setting that would be more valuable than Random. First/Nearest/Toughest/Weakest all make sense (if a little lacking in description in the case of the latter two), but I'm confused as to what the practical applications of a Random setting would be in a Tower Defense. I feel like that's a setting that would invariably be skipped during play in favor of the more tactical options.
    (Though having said that, I can already think of, say, a flak-type weapon that just randomly sprays out damage at targets nearby, but that would be a locked targeting setting unique to the tower, not something the user could change.)


    (link)
    Bug #2!
    This one's hard to pin down, I had to run the scenario a few times to get it to show, and then modified a turret to fire a bit faster in order to make the process easier. This is using the same creep as shown above, with a modified Missile tower to fire slightly faster. It's hard to tell from the screenshot, but that minion should be dead. The Missile turret broke through the shields, burned through all its health... and then suddenly the shields refilled to full. There's no way that the minion had enough of a break to refill its shields all the way (that would take 10 seconds). I have my suspicions this explains why some minions (notably the flying drones) seem to miraculously escape my defense throughout my various testing while their comrades are obliterated.
    My guess: Unknown. Original I thought it may be related to the fact that multiple projectiles/damaging events are happening rapidly, as it's more reliably shown with the Missile turret, but it seems it also sometimes happens with multiple turrets firing on something at once. However, after coming across Bug #3, it may be related to the death event somehow?


    (link)
    Bug #3!
    Difficult to see in the screenshot, but I've tested it thoroughly. It seems that when AoE damage is triggered by another creep being nearby, the additional damage is dealt to the original target.
    In this example: Stats from the first two bugs were changed slightly. Damage range of tower is 120-120. AoE radius is set to 1, with a chance to stun. Creep has no shield, HP set to 350. Three shots would kill the creep. One shot is made, creep takes 120 damage and is stunned. Second creep moves within range of first creep. Second shot is made, first creep takes 120 damage, triggers AoE, takes a SECOND 120 damage. Second creep is unaffected, taking no damage.
    Interaction with Bug #2: The creep should have died. It took 360 damage damage, while it has 350 HP and no shield, and yet it's still rolling along waiting for another shot.

    EDIT: Secondary Notes on Bugs #2 and #3: Having tested a bit further, these two seem to be more related than I thought. The creeps not dying (or recovering shields, as in #2) may be related to the error with the AoE, or possibly due to Overkill in AoE. From my testing, the bug with creeps not dying only seems to trigger when they've taken the Bug #3's additional AoE damage to lethal. If they're killed on their own, they die as they should, shields and all.
    Update: Yup, added shields to the Creep and tested again just to make sure. If a creep is killed by the "overkill" AoE affect that comes from being nearby a fellow creep, shields will regenerate as in Bug #2 and the creep won't die until its shields are depleted despite having no health.
     
    Last edited: Jan 7, 2015
  45. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Thanks for pointing that out with the detail description. I'll look into it.

    Fyi, the targeting doesnt happen between every shot. The tower look for a target based on the target priority, once it has got a target, it will lock onto that target until the target is killed or move out of range.
     
  46. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    Alright, there's indeed a bug with the "first" targeting priority. Also you are right about the aoe overkill bug. I've found the cause and fixed them. Hopefully I didnt miss anything. I will upload an update shortly. Please email me if you need the fix urgently.
     
  47. Felisae

    Felisae

    Joined:
    Aug 11, 2014
    Posts:
    9
    No rush here, I'm still just experimenting and seeing what's possible. Looking back on that post though I realize how tired I was last night. I'm glad you could understand it, I screwed up some sentences horribly!

    I'll probably "targeting on every shot" to my list as something to attempt/pester you about later on. They way targeting is running through my head would be like so, if it was calculated per shot:

    First: Cleanup turrets probably near the end of the track, to clean up escaping creeps.
    (Last): Not available (yet?). Good for turrets, particularly with DoT, near the start of the track, for putting a little bit of damage on every creep that spawns and making it easier for other turrets later. Shields make this strategy weaker if damage isn't constantly applied.
    Nearest: Could technically function the same as Last for the purpose of towers near the start of the track. Would make towers with fire-and-forget non-homing projectiles stronger, but currently all attacks track the target, so this doesn't apply(?).
    Toughest: Makes sure that a boss creep can't hide inside a flood of weaker enemies. Good with armor/shield piercing attacks.
    Weakest: Good for AoE turrets, to clear out swarms of small creeps.
    Random: Would spread damage fairly evenly over all targets involved. Also this
    (link)

    With targeting locked on the way it is currently however, priorities (I feel) don't really mean all that much. Sure, when a creep ties or moves out of range, the turret will look at its priorities to pick a new target, but in the mean time how many creeps that it SHOULD have been hitting have passed by? Each targeting priority has its own specific use, but those uses don't mean much when towers have tunnel-vision once they've seen something. It leaves the user feeling like there's a lack of responsiveness in the game, as if their choices don't mean as much as they should. Or at least, that's the feeling I get. During testing I've had quite a few creeps pass through a detailed defense being seemingly ignored, despite having filled the area with towers, just because they were in the right place at the right time.
     
    Last edited: Jan 7, 2015
  48. Song_Tan

    Song_Tan

    Joined:
    Apr 9, 2011
    Posts:
    2,993
    You raised a very good point I guess. I havent thought about it in that way. Perhaps I'm so tunnel vision into the code structure that I have used right from the start that the idea of interchange the sequence has never cross my mind. I'll try and see if I can change things for the better when I got the chance.

    Your thoughts and input on the matter are much appreaciated. :)
     
  49. Felisae

    Felisae

    Joined:
    Aug 11, 2014
    Posts:
    9
    I'm glad it helps!

    I get like that all the time on the projects I do too, totally understandable. I'm really grateful for one of my friends who I throw ideas at. He has wildly different opinions and ideas compared to what I come up with (such as orbiting barrels on towers that fire from their current location as they move), so it makes me stop and think about different ways to go about something. I'm really grateful he's on this project with me, I'd hate to think what chaos this would turn out to be without him!
     
  50. AndyMul

    AndyMul

    Joined:
    Jul 13, 2013
    Posts:
    41
    If I want to display the list of units turn order using uGUI, can I make use of any existing scripts?