Search Unity

3D Tower Defense Starter Kit

Discussion in 'Assets and Asset Store' started by Baroni, Mar 30, 2012.

  1. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Thanks John. I read that the project settings on newer assets submitted as "Complete Projects" will be included automatically, but you're right, they aren't. I don't know if I have to use a magic stick for that to happen... I'll try to fix it immediately and resubmit the package. Please send me an email if you would like to have them now.

    Edit: The package has been re-submitted with Unity 3.5.7 and now contains the project settings.
     
    Last edited: Jul 24, 2013
  2. John-Sandrey

    John-Sandrey

    Joined:
    Jul 2, 2012
    Posts:
    119
    I can wait till you get it, was just playing around and thought you went another rout and got rid of the set up.
     
  3. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    The updated version has been accepted.

    Our 30% off sale is still running!
     
  4. LoonyBen

    LoonyBen

    Joined:
    Jul 21, 2013
    Posts:
    21
    The kit looks better than ever. I picked it up again after the update and have one question.
    The desktop and mobile demos. How do you make the resolution on the mobile demo bigger. I don't see any difference between the desktop demo in UIRoot variables in inspector.
     
  5. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Thanks, do you mean the individual panels/widgets? They have a fixed size according to the device's screen, I just adjusted the scale of the panels to make them a liitle bit bigger or smaller.
     
  6. CaffeinConverter

    CaffeinConverter

    Joined:
    Jul 10, 2012
    Posts:
    12
    Hi,

    My short question: Is this toolkit suitable for mobile devices project? (Android, IOS)

    Thx in advance
     
  7. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Hi CaffeinConverter,

    thank you for your question. Yes, our kit is mobile ready and comes with a joystick controller for touch screen devices. If you have a look at our webplayer, you'll see three scenes, one of them being a mobile scene.

    Regards
     
  8. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    I added a showcase section to the first post and included

    Strategizer: Art of Defense by White Titan Games
    and Please Defend Me by PlayMe Game Studios,

    please check them out! :)
     
  9. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Last few days to get our kit at 30% off!
     
  10. praethin

    praethin

    Joined:
    May 30, 2013
    Posts:
    2
    Hi, i'm still wrapping my head around how everything fits together. I'm at the point where i think i need a GUI to progress. Is it possible to implement i different GUI system like NoesisGUI? Is there some sort of abstraction layer between the GUI framework and TD starter kit? Is so where should i start looking?

    The one i'm looking at is http://forum.unity3d.com/threads/192064-NoesisGUI-XAML-based-User-Interface-RELEASED
     
    Last edited: Aug 14, 2013
  11. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Hi praethin,

    it's absolutely possible to implement a different GUI (system), some customers did this with a bit of work. I had a look at NoesisGUI, but I don't own it, nor do I know how it functions, so I can only give you a summary of our NGUI implementation.

    GUILogic.cs could be called an abstraction layer between NGUI and our kit. It just has a few public methods that are being called by the NGUI implementation script, GUIImpl.cs. GUILogic.cs handles all the raycasting from the user's mouse position for selecting/deselecting towers and powerups, instantiates towers on grids and upgrades them, activates powerups, but also has some logic to check if an tower upgrade is possible etc. So in general, it does all the thinking for your GUI. If you want to switch over to a different GUI system, you should implement these methods in your new scripts.

    GUIImpl.cs handles all the NGUI specific aspects of the GUI. It shows or hides the tower buttons, menus, enables the self-control mode for towers and draws a reload bar as well as telling GUILogic to select/deselect or activate a powerup. Additionally, when showing a tooltip or upgrade menu, it fills various NGUI labels with the necessary information from the tower. This script heavily relies on NGUI and wraps its design around the methods of GUILogic.cs. You likely want to replace this script with your own GUI implementation.

    Please let me know if you need further information.

    Regards
     
  12. DevExpert

    DevExpert

    Joined:
    Aug 18, 2013
    Posts:
    13
    Hello Baroni!

    I started with your project. I built it for Android, but I can not launch it, even if I'm building only menu level. When you run the application freezes and after a minute the phone reboots. My device is Huawei u9000 with Android 2.2. (Angry Bots is launched very fast).

    Please tell me, what is wrong? Where to look?
     
  13. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Hi DevExpert,

    thanks for contacting me. I don't have this device, what is the graphics card the u9000 is running, armv6/7? And what graphics architecture did you build the game for, on which Unity version? You could look into the device's logs using adb logcat and see what's going on there, then find out how to solve it.
     
  14. DevExpert

    DevExpert

    Joined:
    Aug 18, 2013
    Posts:
    13
    Currently I see this behavior:
    1) The appplication is started
    2) Logo of the Unity appears and freezes
    3) Music are started (without change background image)
    4) Music are played, after some minutes the phone goes to reboot

    In the project settings, I have not changed anything. I downloaded and ran.

    I use Unity 4.1 free edition.

    Processor (adb shell cat /proc/cpuinfo):

    The logcat has repeated error:

     
  15. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Thanks for the additional information. Unfortunately I don't know what's going on here. Your device supports armv7, so you're good to go with Unity 4.1. Google says that this error could be related to the version of opengl you are building to: Link.

    I've never seen this error before (or with my devices). One thing you could do, would be to build an empty scene with the chosen project settings and add models, music and such one by one until the device can't handle it anymore. Hopefully you'll see what causes the problem. Or, building the mobile scenes to a second device of yours, to find out if it's an device-specific issue.



    We're not available until October 1st. All support inquiries will be answered shortly afterwards.
     
    Last edited: Sep 12, 2013
  16. nbg_yalta

    nbg_yalta

    Joined:
    Oct 3, 2012
    Posts:
    378
    How do I make Upgrade button to appear without deselecting tower?
     
  17. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    What version do you use? In 1.4, the upgrade panel updates every few seconds to show the upgrade button once you have enough money. Your best bet would be to update and take a look at the GUI implementation script.

    Please note that I'm on a trip in the US until Oct 1, our wifi connection and responses will be very limited during this time.
     
  18. SchecterKing

    SchecterKing

    Joined:
    May 8, 2013
    Posts:
    1
    I've got everything else working but this one thing.
    I have a 3D model I imported to use as a prefab for the frost tower in the Tower Manager object located inside of the Desktop level scene. When I try to press play and run then try to use the frost tower it throws this error in GUILogic.cs at line 319:
    NullReferenceException: Object reference not set to an instance of an object
    GUILogic.InstantiateTower (Int32 clickedButton) (at Assets/3D Tower Defense Starter Kit/Scripts/GUI/GUILogic.cs:319)
    GUIImpl.CreateTower (UnityEngine.GameObject button) (at Assets/3D Tower Defense Starter Kit/Scripts/GUI/GUIImpl.cs:299)
    UIEventListener.OnClick ()
    UnityEngine.GameObject:SendMessage(String, SendMessageOptions)
    UIBaseCamera:processTouch(Boolean, Boolean)
    UIBaseCamera:processMouse()
    UIBaseCamera:Update()
     
  19. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    On line 319 in GUILogic.cs, the script tries to access the Upgrade script of your tower when you click on the GUI button for instantiating it. Now the error could occur for two reasons:

    1. Your tower prefab does not have the Upgrade script attached to it
    2. The GUI button count does not match to the index of your tower in the TowerManager script. As a quick reminder, this means that every tower button should be named after the index it should represent in the TowerManager. So button 0 would be index 0 = first tower, button 1 will be index 1 = second tower and so on.

    Please let me know if I can be of any further help.
     
  20. DevExpert

    DevExpert

    Joined:
    Aug 18, 2013
    Posts:
    13
    Hello Baroni!

    As I understand the problem was in the process of working with the buttons in UI and size of memory in my device. I have another question about saving a game.

    I've tried to integraed an Unity Serialization project (whydoidoit.com) in the "Advanced" example, but could not.

    Could you explain how can I do this? (Maybe you could create some examples). Currently the I cannot restore any prefabs. I always get a lot of errors. Maybe you can advise other libraries to save game progress?
     
  21. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Hi there,

    I couldn't get the Unity Serializer from whydoidoit.com working either. It seems that when serializing prefabs (or gameobjects, in general) it re-instantiates them in an active state all the time. After loading a saved game, PoolManager doubled the amount of prefabs and all of them are active, what isn't the expected behavior. Probably the most popular package for saving game states is Easy Save 2. It's $40 and I haven't tried integrating it, so take this with caution.
     
  22. DevExpert

    DevExpert

    Joined:
    Aug 18, 2013
    Posts:
    13
    Thanks! If it does not work, I will try Easy Save 2. By the way, have you had an error when loading some saved objects which contain HOTween?
     
  23. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    I could not even get to that point, because it threw errors like crazy with just an empty scene and some disabled gameobjects. ;)
     
  24. DevExpert

    DevExpert

    Joined:
    Aug 18, 2013
    Posts:
    13
    1) As I see it, when deserializing the object there are no check object is active or not.
    2) Because the object deserializing twice, when the saved data are loaded, in the Pool always there are copies.

    How do you think will there similar problems in Easy Save 2?

    Edit:

    I think it is necessary to handle the deserialization event and store state of object (active or not) in the object itself, and when it is instantiated check and setup.
     
    Last edited: Oct 5, 2013
  25. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Unity Serializer is out of date and suffers from non-existent support in the last 6 months. There are a few positive ratings on the Asset Store, but you'll find bad reviews too which describe bugs and other problems. I know that the author(s) of Easy Save are here for quite a while. They are active on the Unity forums (or their own forum) and they listen to their customers, as the latest update on Easy Save 2 has been submitted one week ago. Even the author of HOTween uses Easy Save (source). I can't give you any details on how to implement it into our kit - or whether it will work, though.
     
  26. DevExpert

    DevExpert

    Joined:
    Aug 18, 2013
    Posts:
    13
    Thank you for your detailed answer. I'll play around with the Pool and then I'll try Easy Save 2. When I'll have any results I'll share it
     
  27. Warlord4

    Warlord4

    Joined:
    Nov 26, 2012
    Posts:
    14
    I have made fully complete NGUI system! But Only Wave_label is working! Helth, money, and something other are not working!
    And everytime this mistake!

    NullReferenceException: Object reference not set to an instance of an object
    GameInfo.Update () (at Assets/3D Tower Defense Starter Kit/Scripts/GUI/GameInfo.cs:64)
    NullReferenceException: Object reference not set to an instance of an object
    Adv_GUIImpl.SetHealthbar () (at Assets/3D Tower Defense Starter Kit/Examples/Advanced/Scripts/Adv_GUIImpl.cs:137)
    Adv_GUIImpl.Update () (at Assets/3D Tower Defense Starter Kit/Examples/Advanced/Scripts/Adv_GUIImpl.cs:114)
     
  28. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Have you assigned your newly created NGUI elements to the scripts referencing them?

    The first NullReference exception tells you that GameInfo.cs can't access the "lbl_alive" UILabel (used for displaying enemy count) and the second exception says that Adv_GUIImpl.cs can't access the health slider component.
     
  29. Warlord4

    Warlord4

    Joined:
    Nov 26, 2012
    Posts:
    14
    Thanks a lot! I have fogot to make wave timer, lb_killed, lb_alive! That was my problem!
     
    Last edited: Oct 7, 2013
  30. DevExpert

    DevExpert

    Joined:
    Aug 18, 2013
    Posts:
    13
    Hello Baroni!

    I tried EasySave2. Its hard to use. Need to save all by hands, each field!

    Now I'm focused on storing of enemies' pool. Could you tell the best way to process the stored data for the WaveManager object? How to configure the launch of a wave with a certain point?
     
  31. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Oh wow I didn't expect that. I thought it does have a "save-all-gameobjects-in-the-scene" method, well...

    Depending on your WaveManager wave mode start option setting, the WaveManager will call new waves in intervals (with coroutines) and iterates through all enemies in the current wave. I don't know whether EasySave2 can actually save coroutine states... it would be much easier if you would only allow game saves between waves, because then you can just save the current wave index (and other variables, depending on wave settings) and load the game at this point.

    This way the user would have to re-play the current wave when he loads a game, kind of impractial I know, but that's the easiest implementation.

    Edit: My suggestion works best for the wave start option "waveCleared", because your game won't contain enemies between waves. E.g. when set to "interval", you would need to save the remaining enemies in the scene and then start the new wave at the current index.
     
    Last edited: Oct 19, 2013
  32. DevExpert

    DevExpert

    Joined:
    Aug 18, 2013
    Posts:
    13
    I decided to go the hard way!

    After restoring the enemy is trying to go all the way, not the rest. Could you tell me how to set the progress of passage on the way in TweenMove?
     
  33. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Sure. You can find out the current position on the path in percentage by using
    Code (csharp):
    1. float progress = tween.fullElapsed / tween.fullDuration;
    look up the "ProgressCalc" method in TweenMove, which already does that for displaying the ProgressMap icon at the correct percentage. If you want to set the enemy to a specific position on the path later (after tween initialization to not throw null reference errors), use
    Code (csharp):
    1. tween.GoTo(tween.fullDuration * progress);
     
  34. Goofy420

    Goofy420

    Joined:
    Apr 27, 2013
    Posts:
    248
    Is there any possibility to get this to compile for Windows Phone and Windows Store?
    Changing the iTween Array to List and Hash to Dictionary removes the errors but I'm not sure of any underlying problems it may cause.
     
  35. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    The latest version doesn't use iTween for anything but drawing path lines in the editor, therefore this shouldn't produce any game errors. If you experience issues on Windows or WP related to HOTween, the author provides a special micro mscorlib on his site: http://www.holoville.com/hotween/download.html
     
  36. DevExpert

    DevExpert

    Joined:
    Aug 18, 2013
    Posts:
    13
    Hello, Baroni!

    Yes, I did the saving the game at any time (with Easy Save)! Now I'll research your other project - SIS. I think it will be as far as cool as this one. :)
     
    Last edited: Oct 29, 2013
  37. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Oh wow, great work with the save game implementation. I'm sure you're a pro with Easy Save (and our kit) by now!

    SIS follows the same principles as this kit, I think you will like it. And it has the word "Simple" in its name, how cool is that :D

    Thank you for using our products!
     
  38. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Hello everyone,

    the next release, version 1.5 is just around the corner. This version concentrates on more mobile-like controls and improvements to the design of powerups. The following is a short summary of new features:

    - New Build Modes: "Grid" (select grid, then choose tower).
    Default Build Mode: "Tower" (choose tower, then place on grid) - mobile/desktop scene
    - Build Mode Grid is similiar to the one found in Kingdom Rush (link) - mobile scene
    - Circular layout of tower buttons - mobile scene
    - Power-up area or target highlighting - desktop scene
    - ...

    Full changelog:

    Fixes Changes:
    • WaveEditor, PowerUpEditor: widget closes if no manager object was found
    • Projectile: fixed collision reposition issue by removing unnecessary call
    • UIJoystick: resizes its collider to avoid clicking GUI elements while dragging
    • Adv_GUIImpl: modified to incorporate changes to GUILogic in this version
    • SV: added static outOfView variable e.g. for floating towers and quick access
    • Project: Disabled meta files, maintained NGUI 2.7.x compatibility
    • Updated Unity4 script files “Unity4_Files.zip” accordingly
    Features:
    • PowerUps, GUIImpl: added expected area/target indicator for selected power-ups. Highlights an area around the mouse or the enemy/tower
    • GUIImpl: new Build Modes. “Tower”: choose a tower, then place it on an available grid. “Grid”: select one grid, then choose tower for this grid
    • CircularLayout: new. Arranges children gameobjects in a circle, used for circular tower button layout in the mobile scene
    • Mobile scene: updated to use Build Mode Grid, circular button layout with hide out of view and double tap to buy style
    • Upgrade Helper: new. Widget for adding a defined amount of upgrade levels automatically to the selected Upgrade script based on initial and increasing values (fixed or percentual) entered within the widget
    • TowerBase: support for shot effects (see cannon tower in the desktop scene) and idle/shot animations (see towers in the advanced example scene)
     
    Last edited: Nov 7, 2013
  39. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Version 1.5 has just gone live on the stores. Happy developing!
     
  40. DevExpert

    DevExpert

    Joined:
    Aug 18, 2013
    Posts:
    13
    Hello Baroni!

    I came up with a new feature :) Could you suggest how to implement the possibility of setting the size of the tower in the four cells?
     
  41. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Hi there,

    could you specify what you mean by "setting the size of the tower in the four cells"? Do you mean that a tower should occupy four grids instead of one?
     
  42. DevExpert

    DevExpert

    Joined:
    Aug 18, 2013
    Posts:
    13
    Yes, that's it!
     
  43. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Well... this won't be that easy. You would have to implement a method that checks for the neighbouring grids. I assume the best way would be to place another grid with a special name between four grids, so you can easily get the four grids around it and check their availability.

    As for the implementation: The method "CheckIfGridIsFree" in GUILogic checks whether a grid is available before the user buys a tower. If you want to place a tower that occupies more than one grid, you could perform an additional check for the name of the grid (your special grid), then check the four neighbouring grids and return true or false based on their availability.

    If the user buys the tower, you should add the special grid and these four grids to the gridScript.GridList list in GUILogic's BuyTower(). Likewise, you should free the special grid and the other four grids again if the user sells the tower, in the SellTower(GameObject tower) method. Make sure that your tower has a special name too, so you can check it here and distinguish it from "normal" towers.

    Lastly, there are a few places in GUIImpl and GUILogic where the selected grid gets highlighted via its renderer component. You will have to adjust these code lines for your special tower too, in order to highlight and hide four grids instead of one. This will require some trial and error with the user interface.
     
  44. XundoneX

    XundoneX

    Joined:
    Nov 17, 2013
    Posts:
    2
    Hi,

    Not sure if this was answered but in the TowerBase script there is a slot for Turret - ballista, dragon and cannon which are currently being used for some of the towers. However I cannot locate these in any of the folders and I was wondering if I did make my own tower how can I set the turret Slot, as far as I can tell I can only place the complete Tower with the rotation script, which causes the inter tower to rotate while its targeting.
     
  45. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Hi XundoneX,

    in your 3d modelling software, the turret needs to be a separate object besides the actual tower. If you import the tower in Unity, you will see that your model contains both objects and you can then assign the turret object to the turret slot in TowerBase. As you mentioned our towers - you can find the models under 3D Tower Defense Starter Kit > Models > Tower in the project panel. Expand "Ballistatower" and you will see that the model actually contains "Ballista" and "Tower".
     
  46. nbg_yalta

    nbg_yalta

    Joined:
    Oct 3, 2012
    Posts:
    378
    Hi, what I want to do is to get enemy count of all the waves. I guess it can be done in the wave manager script, but I cant figure out how exactly? I need it to show hom much enemies killes from the wave's enemies count...
     
  47. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    Hi nbg_yalta,

    you're right, the WaveManager script stores this information in its "options" list. Each option defines one wave and usually holds multiple enemies. You can get the enemy count of all waves by looping over this list, then sum up the enemyCount (again, a list per option). This should result in something like this:

    Code (csharp):
    1. int allEnemies = 0;
    2. for (int i = 0; i < options.Count; i++)
    3. {
    4.    for (int j = 0; j < options[i].enemyCount.Count; j++)
    5.    {
    6.      allEnemies += options[i].enemyCount[j];
    7.    }
    8. }
    If you would like to get the enemy count of the current wave, use the "waveIndex" variable to access the current wave within the options list.
     
  48. XundoneX

    XundoneX

    Joined:
    Nov 17, 2013
    Posts:
    2
    Hi Baroni

    Ty for answering so quickly. Just another question. The object that is assigned to the turret slot (cannon) was removed and i cannot locate it anywhere in the folder. The same can be said for the flame tower > turret slot = Dragon. I can not seem to locate any of these objects in the folder. I know that the actual models contain the parts but how do I go about getting them in the turret slot. For example if i did have a model made of out two parts and i already went through Enemy Setup what process do i have to go through to assign an object to the turret slot. (as it is right now if i remove the object (connon) from one of the current towers turret slots (cannon tower) i don't have the option to assign it back it just gone, Is there a certain way to do it?
     
  49. Baroni

    Baroni

    Joined:
    Aug 20, 2010
    Posts:
    3,263
    I think you do mean the Tower Setup here and are talking about tower prefabs, right? You can't directly assign the turret (of the cannon tower, for example) to the turret slot on the prefab, because its a deeper transform hidden on the prefab. You will have to drag the tower prefab in your scene, locate the turret transform and then drag it into the turret slot on the TowerBase script again. Apply your changes to the prefab by clicking on "Apply" in the top right corner of this prefab instance. Hope this helps!
     
    Last edited: Nov 19, 2013
  50. nbg_yalta

    nbg_yalta

    Joined:
    Oct 3, 2012
    Posts:
    378
    Yes, this is exactly what I need but how can I use it?
    Also here is another question: How can I add pause button with NGUI to work the same way like escape button?
     
    Last edited: Nov 19, 2013