Search Unity

City Builder Starter Kit - Create games like DragonVale, Simpsons Tapped Out, etc

Discussion in 'Assets and Asset Store' started by JohnnyA, Nov 10, 2013.

  1. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    GET IT FROM THE ASSET STORE


    City Builder Starter Kit

    Use the City Builder Starter Kit to create City Building games like DragonVale, Simpsons Tapped Out or even as the basis for more complex games similar to Clash of Clans or Sim City.

    Included is a complete sample game with all, UI, graphics, various buildings, etc. The game is data driven with easily extensible data classes for adding your own unique behaviour.

    New version works with Unity Sprites and UI. NGUI no longer required.

    Enough with the words, check it out:


    And yes everything in that video including all the graphics is in the kit.

    Current Features

    • Isometric Grid
    • Define building shape, name, sprite, description, cost.
    • Define building occupants (like dragons in dragonvale, or even furniture if you prefer).
    • Define custom building actions.
    • Move and Sell Buildings.
    • Stop the game and come back and progress has continued.
    • Use speed ups to build faster.
    • Includes a number of fantasy styled icons, frames, and buttons, plus a sample of the assets from JNA Mobiles - Beautiful Fantasy Building asset.
    • Extensible data and manager classes, add your own behaviour with only a small amount of code.
    • Works on Mobile (tested on iPad 3, IPhone 4S and IPhone 5).
    • Zoom and scroll (forgot to show in video). On mobile it uses pinch to zoom.

    Planned Features

    JNA Mobile is committed to constantly improving our assets. Check out the reviews and praise for our other major asset the 2D Platform Controller:

    "Perfect platformer tool and unparalleled customer service"

    "...the author goes above and beyond the expected support from an asset in his forum thread"

    "Best Plugin I've bought"

    Read for yourself on the asset store: https://www.assetstore.unity3d.com/#/content/7381

    This approach will carry on to the City Builder Starter Kit, here's what is planned for the short term:

    • UI and views for Unitys new GUI.
    • An alternate sample built in 3D.
    • Research to unlock new items and upgrades to existing buildings.
    • Tutorials for adding new buildings and resource types
    • Tutorial for adding custom "sim like" behaviour.
    • ... and ... Whatever you request!



    Pricing

    New release price will be $30 USD although the expectation is that this will increase as the asset grows with a resting price somewhere around $75 USD. Get in early to save!



     
    Last edited: Mar 11, 2016
    epyxplayz likes this.
  2. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Running on an iPhone:

     
  3. c-Row

    c-Row

    Joined:
    Nov 10, 2009
    Posts:
    853
    Looks interesting. :) I am a regular Tapped Out player myself so this has my attention.

    What about decorative/scenery objects or roads?
     
  4. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Decorative objects are just like normal objects except they don't have actions. You might choose to put them in a different UI Panel but the base code is the same.

    A road/path drawer is a good idea. I have the code for that in another project (i.e. automatically selecting the right image to use for a winding river, etc), so I will get that in to the kit in the short term.

    Regards,

    John A
     
  5. huxley

    huxley

    Joined:
    Apr 27, 2009
    Posts:
    334
    This looks like a great start. Is there any logic that controls what you do with the units after they are created, or is the focus simply on creating the buildings?
     
  6. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    The only built-in behaviour is a boost to gathering but the logic can be implemented separately. Whats high on the todo list is to provide examples of how it can be extended. Planned examples:

    - Using occupants to attack something (Evony style where they are sent on mission for a start ... writing a full battle simulator is out of scope)

    - Occupants that can be levelled up (i.e. like Dragons in Dragonvale)

    - Running a sim style game on top of the buildings and having occupants affect the simulation (i.e. lots of troops at home boosts the villages happiness, if they are all out on missions people stop working)

    Timelines are hazy and will probably depend on sales. I'll be more excited to add stuff if I have a lot of users :)

    - John A
     
  7. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Submitted.

    I will be honest, the documentation needs some work HOWEVER my plan for this asset is to have lots of video tutorials on youtube showing you step-by-step how to do all kinds of things ... I'll start uploading these shortly so there should be several done before the asset is approved.
     
    rodi0000 likes this.
  8. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Tutorial 1 - Changing Buildings

    This tutorial goes through the process of updating building images and statistics.

    [video=youtube_share;DyT6I2iX6cg]http://youtu.be/DyT6I2iX6cg​
     
  9. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Submitted an update with more detailed and clearer documentation, hopefully it wont take too long to review this time.

    - John A
     
    Last edited: Nov 18, 2013
  10. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Approved and available.

    PS Is it it just me or is youtube down??
     
    Last edited: Nov 18, 2013
  11. rickcollette

    rickcollette

    Joined:
    Mar 17, 2013
    Posts:
    304
    Hey there - JUST bought this asset; this is exactly what I have been looking for. Awesome :)

    I am looking forward to the attack bit; this will help me build other actions..

    Will there be some kind of visual of a villager running to trees to cut down wood, mining for ore, planting and harvesting food, etc?
     
  12. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Thanks for the purchase and hope you are enjoying so far.

    The attack demo is something I will aim to get done pretty quick. I'm at work at the moment but when I get back I'll put together a loose plan of the next things that I will be adding. If you want to see anything just let me know.

    The animation side of things wont be a top priority until I get the tutorials done and expand the base kit with more core features. HOWEVER if you are stuck on how to do it I'm happy to help with suggestions, ideas, code snippets, etc.

    Regards,

    John A
     
    Last edited: Nov 19, 2013
  13. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    I will buy this next week to support you and have a look later on this asset.
    Do you have an estimated timeframe on when you have the 3D version ready?
     
  14. rickcollette

    rickcollette

    Joined:
    Mar 17, 2013
    Posts:
    304
    Makes sense.

    Would love to see the features planned for the upcoming releases.
     
  15. JimRoot

    JimRoot

    Joined:
    Sep 11, 2013
    Posts:
    77
    Looking forward to see some world map. so the unit production make sense ;)
     
  16. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Yes at the moment those units aren't very exciting. However the occupant idea can be used for more than just units, you could do something like dragonvale where you have things inside that can be levelled up and can generate gold, you could create furniture to make your sims happy, or you could even use it for an upgrade system (build a satellite dish on to your building and it shows on the image and grants you a new ability).

    Some of those things will be in the kit and others I will explain in the tutorials.
     
    Last edited: Nov 19, 2013
  17. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Update 1.1 submitted.

    Contents:

    - Some minor bug fixes.
    - Updates to data model to more easily provide for extension.
    - Sample scene and tutorial showing how you can add your own activity which enables buildings to be upgraded.

    Edit: here's the video:

    [video=youtube_share;QGOTX3afunI]http://youtu.be/QGOTX3afunI​
     
    Last edited: Nov 20, 2013
  18. RandAlThor

    RandAlThor

    Joined:
    Dec 2, 2007
    Posts:
    1,293
    Even i do not have bought this now i have a feature wish.
    I would like to see a demage feature for the buildings maybe with some kind of visualization (a health bar or a damaged version of the building) and deleting of the building.

    Then i am curious once again on what time do you estimate for the 3D version, only round about.
    I mean do you think it will take more like 2 weeks or 2 month i.e. ?
     
  19. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    782
    +1 on the health bar
     
  20. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    A simple health bar is 15 minutes work. A new attribute (exactly the same we added upgrade level in the video above), and a NGUI fill sprite to show it. About to go play basketball but I'll do this when I get home :)

    Damage is the same concept but would require me to hire an artist to draw the damage images. So probably wont happen unless I sell a bunch. I can easily help you implement it though.

    - John A
     
  21. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Code (csharp):
    1.  
    2. /**
    3.  * Store data for a bulding that can be damaged.
    4.  */
    5. [System.Serializable]
    6. public class BuildingWithDamageData : BuildingData {
    7.     virtual public int health {get; set;}
    8. }
    9.  
    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4. /**
    5.  * A building which can be damaged.
    6.  */
    7. public class BuildingWithDamage : Building {
    8.    
    9.     /**
    10.      * Initialise the building with the given type and position.
    11.      */
    12.     override public void Init(BuildingTypeData type, GridPosition pos){
    13.         data = new BuildingWithDamageData();
    14.         ((BuildingWithDamageData)data).health = 100;
    15.         uid = System.Guid.NewGuid ().ToString ();
    16.         Position = pos;
    17.         this.Type = type;
    18.         State = BuildingState.PLACING;
    19.         CurrentActivity = null;
    20.         CompletedActivity = null;
    21.         view = gameObject.GetComponent<BuildingView> ();
    22.         view.Init (this);
    23.         view.SetPosition(data.position);
    24.     }
    25.  
    26.     /**
    27.      * Update health and return new health. Also updates the view if one can be found.
    28.      */
    29.     public virtual int UpdateHealth(int amount) {
    30.         ((BuildingWithDamageData)data).health += amount;
    31.         if (((BuildingWithDamageData)data).health <= 0) {
    32.             // Destroy building, replace the type data so we can change the cost to 0
    33.             Type = new BuildingTypeData();
    34.             Type.cost = 0;
    35.             BuildingManager.GetInstance().SellBuilding(this);
    36.         } else if (((BuildingWithDamageData)data).health >= 100) {
    37.             ((BuildingWithDamageData)data).health = 100;
    38.         }
    39.         UIBuildingHealthView healthView = GetComponent<UIBuildingHealthView>();
    40.         if (healthView != null) healthView.UpdateHealth(((BuildingWithDamageData)data).health);
    41.         // If you have a lot of health updates you might want to skip the saving and just auto save every second or two
    42.         PersistenceManager.GetInstance().Save();
    43.         return ((BuildingWithDamageData)data).health;
    44.     }
    45.  
    46.     /**
    47.      * Get health.
    48.      */
    49.     public virtual int Health {
    50.         get {
    51.             return ((BuildingWithDamageData)data).health;
    52.         }
    53.     }
    54. }
    55.  
    Code (csharp):
    1.  
    2. using UnityEngine;
    3.  
    4. /**
    5.  * View for the health bar. Uses a filled sprite for the health.
    6.  */
    7. public class UIBuildingHealthView : MonoBehaviour
    8. {
    9.     /**
    10.      * Sprite that shows the health;
    11.      */
    12.     public UIFilledSprite sprite;
    13.    
    14.     private BuildingWithDamage building;
    15.    
    16.     void Start ()
    17.     {
    18.         building = GetComponent<BuildingWithDamage>();
    19.     }
    20.    
    21.     /**
    22.      * Update health bar.
    23.      */
    24.     public void UpdateHealth(int health) {
    25.         sprite.fillAmount = (float)health / 100.0f;
    26.     }
    27. }
    28.  
    1. Create a building prefab based on the existing one but replace the Building script with the BuildingWithDamageScript.
    2. Add a filled sprite for the health bar.
    3. Add the view script.
    4. Save the prefab.
    5. Drag the prefab on to BuildingManager.

    Of course you need something to deduct/add health, but that becomes a bit game specific. You could use a right click for testing purposes.

    - - - -

    Note this relies on the 1.1 update which I submitted today. If you really want to test this now send an email to the support email address in the documentation and include your Asset Store order number.
     
    Last edited: Nov 20, 2013
  22. thedreamer

    thedreamer

    Joined:
    May 13, 2013
    Posts:
    226
    Is it possible to control actual unit? like rts if i could control unit... I will buy the asset
     
  23. sicga123

    sicga123

    Joined:
    Jan 26, 2011
    Posts:
    782
    @Johnny A - Thanks for doing the health bar script so quick, much appreciated.
     
  24. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    No, there is no intention to support units which you can control directly. It's a city building kit not an RTS kit :)
     
  25. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Made some progress on sending the troops out to attack, hopefully will submit this weekend.
     
  26. rickcollette

    rickcollette

    Joined:
    Mar 17, 2013
    Posts:
    304
    very very cool.
     
  27. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Hopefully ready for a video soon.
     
  28. bittuz

    bittuz

    Joined:
    Nov 12, 2013
    Posts:
    5
    Hi johnny, is there a way to use your package without NGUI? Or is mandatory?
     
  29. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    The underlying kit works regardless of UI solution, however at the moment the only example view and UI is for NGUI. Given thats the case the Asset Store guys quite reasonably said at this stage that I need to say that NGUI is mandatory in the description.

    High on the agenda is an alternative view which doesn't require other packages (I'll probably do a 3D view first because several people have asked for it). This will include a view but initially wont have a GUI (maybe just a couple of buttons so you can build stuff, just to see how its done). Overtime I expect to add more samples with various views and UI's.

    Integration with UI is pretty easy, there are static instances for manager classes which provide the functionality, for example:

    Code (csharp):
    1.  
    2. // Get a list of building types from the manager
    3. BuildingManager.GetInstance ().GetAllBuildingTypes();
    4. // Create a sawmill
    5. BuildingManager.GetInstance ().CreateBuilding ("SAWMILL");
    6.  
    TLDR - yes there is a way but until I have an example I can't officially say so on the store. If you are a programmer it's probably not much of an issue to jump in now, but if you wait a few weeks there will be better examples and support (the only negative being that the price might have slightly increased by then).

    - John A
     
  30. bittuz

    bittuz

    Joined:
    Nov 12, 2013
    Posts:
    5
    Ok I have purchased it! I hope it will help me! :p
     
  31. rickcollette

    rickcollette

    Joined:
    Mar 17, 2013
    Posts:
    304
    I am really looking forward to the 3d view myself; I have not looked, but I'm kinda wondering if you can mix base 3d and the 2dtk for the UI elements...
     
  32. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    I made some progress towards this, although its probably a week or two away.

    --- EDIT ---

    Almost finished battles now. Its a pretty simple system as it only allows one battle at a time, but the underlying code supports multiple battles, its only the UI that is limited. Only thing left to do is a screen that shows you the results of the battle, and some tweaks to the unit views so you can see who is in battle.

    I've got to go to work now, but hopefully I can finish it soon.

    $Screen Shot 2013-11-25 at 10.42.37 am.png
     
    Last edited: Nov 24, 2013
  33. bittuz

    bittuz

    Joined:
    Nov 12, 2013
    Posts:
    5
    wow, it's exactly what I need! :p
     
  34. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Getting closer on that extension, the underlying system is quite powerful allowing multiple battles with any combination of units, but so far I've only built a UI for allowing one battle at a time. I'll release like this and look at a more powerful UI down the track.

    Note this is a WIP so still has a few visual glitches:

    ]
     
  35. jasonlai2020

    jasonlai2020

    Joined:
    Jul 3, 2012
    Posts:
    8
    Hi,
    I just purchased your city builder starter kit. Would it be possible to animate the building (i.e using spritesheet) using the current 2d view.Or do i need to wait for the 3d view sample.Thanks.
     
  36. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    You could do that by using a UISpriteAnimation instead of a UISprite for the BuildingView.
     
  37. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    About to submit the battle update. Next planned:

    3D View - as discussed

    Sim like behaviour - Not exactly sure what example to use, but the idea will be to have some variables like morale or happiness which are affected by factors like the types of buildings, number of soldiers, etc.
     
  38. GamePowerNetwork

    GamePowerNetwork

    Joined:
    Sep 23, 2012
    Posts:
    257
    Are all the events of this framework exposed? and is there an API so that I can use my own GUI with it? I'm currently using Coherent-UI and would love to use your framework if all the APIs and Events are exposed to the GUI.
     
  39. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    APIs are accessed from the UI using Singleton like pattern:

    ActivityManager.GetInstance().StartActivity(data);

    In the updated I just submitted I've moved the BuildingView to use SendMessage in lieu of method calls or events. Usually I use events but the performance here is unlikely to be an issue (even with a massive city its unlikely you will get more than a few UI calls in a frame) and this is a lot easier for beginners, particularly if they use UnityScript.

    The next update I'll be providing a non NGUI view (3D and then Unity's new 2D).

    All of that said be clear that the UI and the GAME VIEW is currently built with NGUI. So you would need to reimplement all of the user interaction (ui, game view, scrolling, zooming, etc).

    For this reason I'd say it might be better to wait until I build the alternate views.
     
  40. RadarWaves

    RadarWaves

    Joined:
    Nov 30, 2013
    Posts:
    1
  41. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Yes. You can use the free version for testing purposes (http://forum.unity3d.com/threads/124032-NGUI-Free-Edition) if you don't mind the watermarks.

    EDIT: This is OLD NEWS, you can no longer use NGUI 2.x you must use NGUI 3.x for which there is no free version. I do have an older version of CBSK which I can send you via a support request (please include your order number) so you can get started with NGUI 2.x, but do note the old version wont have all features.
     
    Last edited: Jun 17, 2014
  42. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Hey! Realy looking forward to the sim behaviour update :)
    I did not bought the pack yet but i think when my next payment check will arrive i will invest in your pack ;)

    I have two questions even i did not have a look into your pack now:
    1. how easy would it be to add roads? I mean roads that automaticaly recognize whats around them. For example generate crossing roads at the right place if you know what i mean?
    2. how hard would it be to rotate the building from a 4 direction sprite?

    Both for the 2d version
     
  43. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Rotation will be coming very soon. I need that for a game I am working on myself :)

    For roads you would just need to extend the building class to add an additional method that when things are moved you check surrounding tiles to determine which road shape should be used. I'll add this too, but if you were to do it yourself I wouldn't expect its more than few hours work.
     
  44. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Thanks for the Quick reply :) Cant wait for the rotation update ;)

    so, one more question. in your video you have the "supplies" counter on the upper left. How does it work with the storage? can you save unlimited of these resources or do you have a limit based on your "storage" building level?
     
  45. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    The current implementation is unlimited (the storage is more like DragonVale). To limit it you could extend ResourceManager with your own ResourceManager. About the only think you would need to add is one line in the add resources method which did something like this (code is just typed in to editor without consulting API so it might be a bit off):
    Code (csharp):
    1.  
    2. foreach(Building b in BuildingManager.GetInstance().GetAllBuildings()) maxStorage += b.Type.storage;
    3. if (resources > maxStorage) resources = maxStorage;
     
  46. Der_Kevin

    Der_Kevin

    Joined:
    Jan 2, 2013
    Posts:
    517
    Ok, just bought it. pretty cool asset! cant wait to see future updates :)

    so, what i did not realy understand is the difference between the "gather" and "collect" button. could you maybe explain me the system behind it?
     
  47. peanutt

    peanutt

    Joined:
    Nov 3, 2009
    Posts:
    28
    To me the collect button is a time based reward just for having the structure in place. I think up to 50 supplies wood etc etc in the sample. The gather is more your sending out your men to "gather" supplies wood etc etc without actually seeing them do it in this case.
    Of course we just change the graphics, timing , rewards to suit our games.
     
  48. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    Pretty much what he said.

    The collecting resources is based on an AUTOMATIC activity. It is something the building does by itself without user intervention. Consider for example the DragonVale dragon habitats. You don't to tell them to collect gold they just do it. You might use this to, for example, collect money in an ice cream store based on the number of tourists in your park.

    On the other hand the gather activity is not automatic. The user has to start it. It has a fixed end and if the user wants to do it again they have to start it again. This is to some extent the default way to implement a behaviour be it gathering, questing, building or upgrading. The user clicks a button to start something and then it happens.

    EDIT: Please excuse my fumbling explanation its 2am and I've been working for some time.
     
    Last edited: Dec 3, 2013
  49. JohnnyA

    JohnnyA

    Joined:
    Apr 9, 2010
    Posts:
    5,041
    1.2 with the Simple Battle System is approved and available.
     
  50. rickcollette

    rickcollette

    Joined:
    Mar 17, 2013
    Posts:
    304