Search Unity

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

[RELEASED] Datablocks - Revolutionary game data manager

Discussion in 'Assets and Asset Store' started by Bigpete591, Apr 24, 2015.

  1. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    Introducing Datablocks for Unity!



    DATABLOCKS IS NOW OPEN SOURCE
    https://github.com/petesimard/datablocks


    Asset Store | Website | Docs

    For the first time you can now create your game data in the same way you think about it, in a hierarchy! Make a change along any step of the hierarchy and all the children will receive the updated value.

    ItemDatablock example hierarchy:


    In this example, the final item "Magic Plate Armor" is inheriting the values from all its parents. At each step in the chain, a datablock can choose to set its own values, rather than using its parents.

    Building your data in this manner gives you incredible power to change your game down the line as your game evolves. For example, if you wanted to change the sound effect of striking against plate armor, just change the value on the Plate Armor datablock, and all the items that inherit from it will have the new sound effect.

    Key features for developers:
    Built using ScriptableObject as a base - Enables full use of the inspector
    Import and export from Google Sheets
    All platforms supported
    Full source included

    Screenshots



    Asset Store | Website | Docs
     
    Last edited: Jan 22, 2017
    mgear and boysenberry like this.
  2. boysenberry

    boysenberry

    Joined:
    Jul 28, 2014
    Posts:
    365
    This looks super useful. I just picked up Inventory Pro and use NGUI as well. How likely would I be able to use this with either of those?
     
  3. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    The Datablocks system doesn't rely on any specific UI package. The demo scene uses uGUI but any UI system including NGUI will work with it.

    I'm not familiar with Inventory Pro, but I don't think they would be compatible unless it stores the items as ScriptableObjects. If there is demand I can look at adding 3rd party support for it.
     
    Duffer123 and boysenberry like this.
  4. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @ Bigpete591, I've posted on the Asset Store. Really pleased with this product having purchased earlier today - but how do I go about creating list fields in datablocks - especially ones providing (listing fields of) datablocks from different root parents (as per the partial example:- http://unitydatablocks.com/docs/manual/working-with-lists).
    Also, any possibility of some integration and import from, export to Sqlite?
    Finally, can a child have more fields than a parent (so long as it has the same fields as the parent for starters)?
     
    Last edited: May 24, 2015
  5. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    All datablocks of the same class have exactly the same amount of fields behind the scenes. The only thing that changes when using field attributes is which fields the editor will show. A child can display more or less fields than its parent depending on the value of its fields and the attributes of those fields. I hope that answers your question.

    I'll copy paste my answers for the other questions from the Asset Store review:

    - more on how to prevent too many datablocks per scene etc to avoid slowing things down (when huge amounts of data on a grand scale);
    Datablocks are only processed once on game startup. Any references to objects or other heavy things like textures will not be loaded by Unity until directly used in an Instantiate call.

    - perhaps even more integration/compatibility with Playmaker?;
    Since Datablocks use ScriptObject as their base type you should be able to use most of Playmaker's built in functionality. However if there's a specific function you would like to see added please feel free to email me and I'll add it to the next version.

    - import/export and compatibility/integration with SQLITE Kit;
    I have added that to the list for future integrations.

    - more example scripts/code and more extensive scripts/code;
    - in particular more on lists attached to items in a particular item within a particular datablock, how to search lists of datablocks, how to search and move up and do parents/children items in datablocks;

    I've created a new documentation page that goes into greater detail on working with Datablock children and parents in script: http://unitydatablocks.com/docs/manual/datablock-functions

    - more on enum and more examples of how to simplify the datablock data appended and declutter the inspector;
    The http://unitydatablocks.com/docs/manual/field-attributes page shows several attributes for conditionally showing fields. The included ItemDatablock example makes heavy use of these.

    - oh yes, and say you had created numerous weapons within an item datablock, what if you wanted those weapon items to refer to one or several (in a list) of 'effects' which were created in a separate effects datablock?
    Simply add a list of EffectDatablock to your ItemDatablock and you can drag and drop the effects right through the inspector. I have added additional examples for working with lists at http://unitydatablocks.com/docs/manual/working-with-lists
     
    Last edited: May 26, 2015
    Duffer123 and boysenberry like this.
  6. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @ Bigpete, as per edit to post on Asset Store thanks v much for coming back so quickly.

    I posted a suggestion re import/export of lists in CSV there.

    Another thought occurs - what if my base ItemDatablock has hundreds of fields? What happens then to the component screen - does it have a vertical scroll!? Also, what happens when I am tinkering with and creating child datablocks from that with so very many fields? Does that too have a vertical scrollbar if I go well off screen (otherwise)?
     
  7. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    Datablocks use the standard Unity editor window which means a scrollbar will be displayed if the editor extends past the size of your window.
     
    Last edited: May 30, 2015
  8. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @ Bigpete - thanks, reassuring - sorry new to Unity3D and still finding my way...
     
  9. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @ Bigpete,

    - Does export/import deal with all types of fields (inc gameobject reference, enum etc) except for Lists, currently?

    - Also, when I was talking about possible future implementations/development, I think SQLITE support rather than SQLITE Kit (specifically) support makes more sense.

    - Looking at other data handling assets, what would probably come before SQLITE import/export would be JSON import/export (because I am sure you could code that to support all your possible fields) with, ideally, the option to DES or AES encrypt?
     
  10. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    - Does export/import deal with all types of fields (inc gameobject reference, enum etc) except for Lists, currently?
    Correct, all fields except List can be imported and exported. List support is planned for a future release.

    - Also, when I was talking about possible future implementations/development, I think SQLITE support rather than SQLITE Kit (specifically) support makes more sense.
    SQLite support is planned for the next release.

    - Looking at other data handling assets, what would probably come before SQLITE import/export would be JSON import/export (because I am sure you could code that to support all your possible fields) with, ideally, the option to DES or AES encrypt?
    JSON should be fairly easy to add. I'll put it on the list for future development.
     
  11. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @ Bigpete - great to hear.

    Thinking about your product now (having looks at SQLITE extensively) I think something which is more compatible with SimpleSQL rather than SQLITE Kit is more in order - because SimpleSQL is more in keeping with your product with its ORM methods...

    I think JSON will really help with import and export of unusual fields...
     
  12. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Bigpete591 ,

    I think something that's needed as an immediate development is a straightforward way to copy datablocks and from that create new datablocks in runtime...?

    Also, if you go with JSON implementation, it would be great to include support for DES encryption...?
     
  13. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Also, thinking about enum variable types - could you combine this with a list - so you could only select one from a list? what would the code for that be in c#?

    Also, critically, I am really struggling with enums and the like when I come to deal with them outside the Example project it all goes wrong - I dont have create child etc options on the component for the Datablock and it wont show enums etc without the DemoUI.

    Can't you create a universal DatablocksUI which doesn't have the detailed stuff on Money and Loot tables, Mobs etc... That way we won't (I presume, maybe I'm missing something) have to do everything from scratch or come up with wild new names for our scripts and datablocks to step around the Examples naming?
     
    Last edited: Jun 7, 2015
  14. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    If you don't want the example Datablocks to conflict with your own, you can just delete them completely from your project. Or if you'd like for them to stay there, you can rename them. The next release will have namespaces for the examples.

    If there is no specific editor for a Datablock type, the default inspector will be used.
     
  15. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Great - thanks for clarifying. I kinda got their on my own as well in the end.

    Could you outline your development plan for this fantastic asset? What are you aiming to introduce with the next release?

    Are you managing to sell enough copies of Datablocks to further develop this Asset>?
     
    Last edited: Jun 15, 2015
  16. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Bigpete591 ,

    Hoping more people have bought in to this great Asset? Are you planning to develop further?

    With the help section on Lists, would be useful to show how you can find the value of a field attached to a datablock within a list which forms part of another datablock - if you see what I mean?!
     
  17. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    I just purchased and seems like a great asset to speed up development. But I have a quick question. Can you provide two quick examples for custom editors? I've looked through your documentation quickly but did not see any on this part.

    1.) I would like to know if you can easily create something similar to how you handle enums but of a specific Datablock type to be able to select them in a pop up instead of the general object explorer?

    2.) Expanding on the first idea is it possible to have one Datablock type "RarityDatablock" with just a Color property with a few children say "Common", "Uncommon", "Rare". And be able to have a list of "RarityDataBlock" as a property on a Datablock type "BaseItem" and be able to override that color of a RarityDatablock item in the list?
     
  18. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Bigpete591 ,

    [ignore] - thought there was a bug in the Asset but no, just my shoddy scripting - ;)
     
    Last edited: Jul 4, 2015
  19. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
    Yeah, Im still having some problems with using a custom class not showing up in the inspector. I have a simple class below:

    using UnityEngine;

    [System.Serializable]
    public class MinMax
    {
    public int Min { get; set; }
    public int Max { get; set; }

    public MinMax()
    {
    Min = 0;
    Max = 0;
    }
    }

    and a datablock as follows:

    public class WeaponDatablock : DestructibleItemDatablock {
    public WeaponType WeaponType;
    public bool TwoHanded;
    public bool Melee;
    public MinMax Range;
    }

    What would be the best and correct way to have that displayed in the inspector?
     
  20. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Also, hoping this great Asset still being developed?
     
  21. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    Just a heads up I'm away for the 4th of July weekend and will get to your questions first thing Monday morning.
     
  22. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Bigpete591 ,
    No worries - enjoy!
    One thing I was wondering as well, in terms of future development, was whether you could add in some more custom attributes to allow for sections of the variables (in the datablock editor) to be folded and unfolded?
     
  23. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    Right now only the fields listed on the New Datablock Type page are supported.

    I added this feature in, and it's quite useful for large Datablock types. Here it is in action:



    You can group fields by adding a DatablockFoldout attribute to the first field you want in the group. All subsequent fields will be included in that group until the next Foldout attribute with a new or empty group name.

    1) Unity doesn't allow for selecting of a type in the inspector. You will need to create an enum listing your valid datablock types.

    2) A datablock can only override the value of its parent. It can't override a datablock of another type. You could have two fields "rarity" (of RarityDatablock type) and "customRarityColor". That will allow you to specify an optional override color.

    JSON support has been added for import and export and will be in the next version.
     
  24. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Bigpete591 ,

    Excellent - that fold in/out attribute is exactly what I was thinking of - and JSON import/export coupled with supporting Playmaker actions would be superb....
     
  25. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Are you still planning on SQLite support? If yes, something more aligned to ORM SImpleSQL might be more applicable...

    In terms of priorities though that foldin/out looks great.
     
  26. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Also, no pressure... ;) but when is the next release likely... ?
     
  27. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    The new version is just waiting Asset Store approval. SQLite support is still in development.
     
  28. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    I've been playing with the new foldout attribute - it makes things massively more accessible when entering data... :)

    Quick questions -

    1) can Datablocks handle 2 dimensional lists? So you can have say a list of required skills and the skill level required for each skill...?

    2) I've been naming the core datablocks xyzdatablockschema (so for example WeaponTypeDatablockSchema) but have noticed that the end assets do not carry that datablock icon (but otherwise seem to work fine) - is that ok?
     
    Last edited: Jul 9, 2015
  29. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    Also, can you post some examples of how Playmaker can interrogate datablocks, search for them and filter and, in particular, pull particular variables from a datablock?
     
  30. E1iTe

    E1iTe

    Joined:
    Aug 7, 2012
    Posts:
    47
  31. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
  32. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Bigpete591 ,

    I am probably missing the obvious, but against say a Race or Class how would I easily save out a 2d array/list ie say a list of required skills and the score requirement for each each, but one skill at a time... (see post 3 above)...?
     
  33. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Bigpete591,

    Still struggling with above 2D lists. It's a total wall for me for further development of rpg using datablocks... . How do I use datablocks to implement (for a race or class say) a list of required statistics and for each statistic a required score or level? (for example, Strength +1, Intelligence +4 etc). . Help.
     
  34. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    I don't think Datablocks are what you need for that problem. I would recommend creating a new type of object called "SkillManager" with a custom editor that lets you assign the Datablocks and the stats you want.
     
  35. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    A shame. . Any chance of 2d list implementation?
     
  36. PiotrW

    PiotrW

    Joined:
    Nov 2, 2014
    Posts:
    20
    They are problems with lists. I got List<float> not overriding parent values. During edit - list/values are empty.

    In game list accessible from code is empty no matter parent list is full of elements. Strange sometimes it is working sometimes not. When I play in Editor list is filled with parent values. In web build list is all the time empty.
     
    Last edited: Sep 11, 2015
  37. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @Bigpete591 ,

    Any further development of this asset planned? Re-packaging under Unity v5.2? Support for other types?
     
    Last edited: Oct 7, 2015
  38. ConjuringTheFuture

    ConjuringTheFuture

    Joined:
    Feb 19, 2014
    Posts:
    19
    I bought this plugin yesterday without deeply reading through this thread or looking into the docs. I was surprised to find it only supported a small number of types with no support at all for custom types.

    So I spent the afternoon editing it to support more types. I ended up removing the reflection and custom field drawing in DatablockEditor.cs and ending up replacing it with SerializedObject and SerializedProperty based drawing. (not to be confused with ScriptableObject, of which datablocks and it's asset files are based) As well as removing the IsValidMemberType() check in Datablock.cs

    The end result being that my copy now:
    1. Support any type that unity can serialize , including custom classes.
    2. Things show up just like the would in a regular monobehavior inspector. (with the extra tick box for overrides)
    3. Better support for undo and redo.
    4. Full support for built in or custom property drawers
    Here is a screen shot of some example tests I was doing.


    On the other hand some things no longer work:
    1. The original author's custom attributes for styling are not used for anything anymore.
    2. Lists are not additive. They just inherit or override. (I might change this)
    3. Import and export seem designed to mostly go one level deep, so any nested data gets chopped.

    @Bigpete591 I'd be happy to share these changes back with you and or, if you are interested, have a discussion about the plugin's architecture.

    To the community at large. It is Bigpete591's plugin, and it is a paid plugin, I don't feel comfortable releasing a modded version so please don't ask. I just wanted to share that I was facing some of the issues that others here mentioned and point people in the directions I used to work around them. I also broke a bunch of things I have no intent on fixing.
     
  39. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    1,215
    @UnicornForest ,

    At the risk of being cheeky, any chance you would consider developing your own Asset independently? Lots of different database Assets out there (and I have purchased many including this one) but one with flexible and practically helpful support for all types, unity types, special and custom types, prefabs, instantiating them, encryption, speed, full spread of Playmaker actions, it's own custom editor... that would be a fine thing...

    My preference would have it based on a nifty combination of scriptableobjects, prefabs and go references...

    I can dream... ;)
     
  40. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    Hi, very nicely done asset, thanks!

    A question: we would like to describe crafting recipes using datablocks. Idea is to datablock that has a list of "ingredient" datablocks + amout of ingredients needed. How do we go about it? Adding list of Dbs is easy part, we are not sure how to proceed with amout value next to ingredient.
     
  41. Rusted_Games

    Rusted_Games

    Joined:
    Aug 29, 2010
    Posts:
    135
    Is this still supported?
     
  42. slimshader

    slimshader

    Joined:
    Jun 11, 2013
    Posts:
    187
    seems it is not :(
     
  43. Rusted_Games

    Rusted_Games

    Joined:
    Aug 29, 2010
    Posts:
    135
    Thanks for the reply, can you tell me if this package contains full source code? Maybe I will buy it if it can save some hours of work and then add my own stuff in it.
     
  44. Greviouss

    Greviouss

    Joined:
    May 27, 2016
    Posts:
    159
    I am gonna start with... I love this asset. Picked this up because i listed it as one of two things that in the asset store that has these specific capabilities. This makes creating and editing things for your game easy. If you can write the smallest amount of code then you can use this and save hours while making all sorts of objects that exist in your game and thier related data fast....

    I dont know why the developer stopped with this asset. its one of a frickin kind epic time saver of pure ingenuous design. Kudos to you Bigpete591 .... With some small tweaks it could be updated and improved, but i think soon it will lose compatibility.

    But as i paid for it... and to anyone listening that has coding skill, yea its a paid asset but if the developer has abandoned us then ..... what? I think if a dev abandons a project then its our job to keep it going, and not fair that they can lock it in a failing state so they can occasionally screw over someone who buys it after its broken... is it? No, this asset doesnt screw anyone over as it works in unity 5 at the time of this writing but some others on the asset store do, and theres no accounting for future releases of unity. I have some coding skill and can fix things that dont work right usually... but others are not even as talented with code as that, and look for somthing like this that makes it easy.

    so

    @Bigpete591 , i have to ask... do you care to release a community managed version we can fix in lieu of your interest to do so? The work @UnicornForest did seems promising on its own, and that was posted by him 8 months ago with no reply...
     
    Rusted_Games likes this.
  45. Greviouss

    Greviouss

    Joined:
    May 27, 2016
    Posts:
    159
    by the way, a great addition for development would be either a playmaker action that interacts with your datablock structure and parses it directly into playmaker hashtables or arraylist,... or possibly a datablocks proxy that allows playmaker to see and manipulate all datablocks variables and data. Then you could use this to build the data, and work with it directly in playmaker with ease. If anyone has the talent to do this, please contact me...
     
  46. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    Unfortunately the sales of Datablocks weren't what I were hoping for and I haven't been able to devote the time needed to maintain it. It's a great tool that can benefit many developers so I've decided to open source it and allow the community full access with the permissive MIT license.

    https://github.com/petesimard/datablocks
     
    TeagansDad, one_one and slimshader like this.
  47. Rusted_Games

    Rusted_Games

    Joined:
    Aug 29, 2010
    Posts:
    135
    I bought this tool last year knowing the forum was kind of abandoned, It's a shame having its potential but in the other hand I applause @Bigpete591 for making it public so other members might contribute their mods to it. Perhaps this is a good opportunity to merge @UnicornForest work.
    Wish you good luck in your future or current projects ;)
     
    slimshader likes this.
  48. Bigpete591

    Bigpete591

    Joined:
    May 7, 2013
    Posts:
    60
    To anyone who purchased this asset before it was open-sourced, shoot me a PM with your invoice number & Paypal address and I'll refund you. Sorry I wasn't able to give you the support you deserved. I work as a freelancer and the dismal sales made it really hard to devote time to it.

    I'm hoping now it can be improved and used by many more developers. I can't image trying to make a data heavy game like an RPG without it!

    @UnicornForest If you want to submit a pull request I will take a look at your modifications and see if I can merge them with the existing code.
     
    Last edited: Jan 23, 2017
  49. castor76

    castor76

    Joined:
    Dec 5, 2011
    Posts:
    2,517
    I wonder if importing json or csv can be done in runtime? This is so that if modders want to tweak the value of the item stats they can.
     
  50. Xelnath

    Xelnath

    Joined:
    Jan 31, 2015
    Posts:
    402
    BigPete, it's been a great product. I recently improved the scripts to allow exporting of all datablocks to multiple sheets in Google Sheets. Is that a feature you'd like to integrate? If not, totally get it.