Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Nominations have been announced for this years Unity Awards. Celebrate the wonderful projects made by your peers this year and get voting! Vote here!
    Dismiss Notice
  6. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  7. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

BG Database (inMemory database | Excel/Google Sheets syncing | CodeGen | Save/Load support)

Discussion in 'Assets and Asset Store' started by BansheeGz, May 3, 2018.

  1. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    mike6502 likes this.
  2. Cosmoraph

    Cosmoraph

    Joined:
    Jan 25, 2017
    Posts:
    44
    Hi, I saw your attractive assets.
    I'll ask you a few questions publicly before I buy your assets.

    1. Does this DB run only on main thread? Can this DB run on sub thread?
    2. Can this DB communicate with multi-threaded function?
    3. How compatible is it with the 2018 version? (Job or ECS)

    P.S. I am not an English speaker. I am sorry for poor English.
     
  3. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Hi, Cosmoraph, thank you for your interest in our asset!

    1) Currently, our DB is not thread-safe (it's supposed to be run on the main thread), but we were thinking about adding multithreading support as an option if there is any demand for this.
    2) DB does not call any code outside (apart from event listeners). A multi-threaded function cannot call DB (cause it's not thread-safe )
    3) We were thinking about new Unity's Jobs and ECS and how we could integrate with them, but we've run out of ideas. Actually, you can easily create Unity's Entities using information from the database without multithreading, and after you created these Entities, there is no much sense in storing them in the database unless you want to be able to save and load them afterwards. But if you want to save them, you could easily create a thread-safe function for this and call it when user want to save the game. So other than this usecase, there is no sense in using database (maybe we were wrong)

    Anyway, if you are interested in using our asset in a multithreaded environment (probably with Jobs/ECS), we could
    1) provide you with free evaluation copy (so you could decide if you want to use it or not)
    2) If you decide you want to use it, we send you a voucher (so you could download our package for free), and a beta version with multithreading support. Later we decide together what needs to be added.

    Please, let me know if you are interested.
     
    Last edited: Aug 2, 2018
  4. Cosmoraph

    Cosmoraph

    Joined:
    Jan 25, 2017
    Posts:
    44
    @BansheeGz,
    Thank you for your reply.
    I bought it right away and am reviewing your performance.
    Before 'multi-threaded evaluation Copy' request, I ask you a few more questions.

    I found out that BGID is essential to access Entity on the code. But I need a way to search by a method other than BGID.
    If the table is set to a unique name, is there any way I can search by name to get the Row I want?
    In addition, I wish I could set up each Row with an ordered number instead of a unique name, and I would like it to be able to search by numbers in this order.
    Is there a way to do these? If not, can you add these features?
     
  5. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Cosmoraph, thank you for purchasing!

    1) In 1.2 version, which went live today several hours ago, there is a method to get entity by name: BGEntity result = meta["entityName"]; Additionally if you use CodeGen you can generate static getters for each entity (if the number of entities <1024)

    2) To search by predicate, use
    Code (CSharp):
    1.  
    2. List<BGEntity> result =  meta.FindEntities(entity => entity.Get<int>("damage")>10);
    3. BGEntity result =  meta.FindEntity(entity => entity.Get<int>("damage")>10);
    4.  
    sorry, we forgot to add it to API page
    Also, note, we used very bad decision to use temporary list in meta.FindEntities method to get rid of Garbage Collection

    EDIT:
    3)We've added Comparison<T> parameter to Find/Iterate methods, so rows could be sorted.
    I've sent you an updated package.
    So, the signatures now are:
    Code (CSharp):
    1. List<BGEntity> FindEntities(Predicate<BGEntity> filter, List<BGEntity> result = null, Comparison<BGEntity> sort = null)
    2. void ForEachEntity(Action<BGEntity> action, Predicate<BGEntity> filter = null,Comparison<BGEntity> sort = null)
    3.  
    Here are some examples:
    1) Without code generation
    Code (CSharp):
    1.  
    2. //find all items with damage>5 and return them in ascensing order
    3. List<BGEntity> items = BGRepo.I["Items"].FindEntities(e => e.Get<int>("damage") > 5, null, (e1, e2) => e1.Get<int>("damage").CompareTo(e2.Get<int>("damage")));
    4.  
    2) The same with code generation:
    Code (CSharp):
    1. List<Items> items = Items.FindEntities(e => e.damage > 5, null, (e1, e2) => e1.damage.CompareTo(e2.damage));
     
    Last edited: Aug 4, 2018
  6. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Cosmoraph, with regard to performance: at the moment we are investigating opportunities to improve it, including the possibility to reduce the cost of field value getter(and partially setter) to single access to an array element (at least with generated code).
    Probably we won't be able to make it any faster than accessing array element by its index (without using C++)
     
  7. Cosmoraph

    Cosmoraph

    Joined:
    Jan 25, 2017
    Posts:
    44
    @BansheeGz,
    I checked 1.2 version over the weekend. I am satisfied with the update. However, 3) is the 1.3 version? I'll check as soon as updates register with the Unity store. Thank you for your quick updates.
     
  8. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Cosmoraph, yes, the sorting delegate parameter (Comparison<T>) is in the 1.2.1Beta now.
    I've sent beta version to you in the private message.
    If you did not receive it, please, write to our support email, we'll send it by email.
    We plan to release 1.2.1 version next week
     
  9. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Version 1.2.1 (with performance upgrade) is live.
     
    Duffer123 likes this.
  10. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    966
    @BansheeGz , With Unity Types, when editing tables, it would be good if you could see a small preview of things like sprites, texture2ds, meshes, gameobjects in the cell? Would this be possible?

    How do you store these in the Table databases? As path names to the assets in the Resource folder path?
     
  11. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Duffer123 likes this.
  12. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    574
    I would be quite interested in seeing what you come up with if you were to move forward with a multithreaded implementation of this. I have been working on an RPG and actually have been thinking of revisiting my data storage setup.

    Even if you don't, I still like what you guys have going on there from what I can see.
     
    Last edited: Sep 24, 2018
  13. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    @MostHated
    could you please email us at support@bansheegz.com ?
    We could provide you with free beta copy for review and we will be very interested to hear your opinion

    I hope it will be ready within 1-2 weeks
     
  14. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    Duffer123 likes this.
  15. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    966
    @BansheeGz ,

    Just installed v1.24. I have Windows 10 and Unity 2018.2.10f1.

    I am still getting the following (non-breaking) yellow warnings:-

    There are inconsistent line endings in the 'Assets/BansheeGz/BGDatabase/Examples/Scripts/Generated/BGGeneratedPlaymaker.cs' script. Some are Mac OS X (UNIX) and some are Windows.
    This might lead to incorrect line numbers in stacktraces and compiler errors. Many text editors can fix this using Convert Line Endings menu commands.

    Lighting data asset ‘LightingData’ is incompatible with the current Unity version. Please use Generate Lighting to rebuild the lighting data. Realtime Global Illumination cannot be used until the lighting data is rebuilt.

    Lighting data asset ‘LightingData’ is incompatible with the current Unity version. Please use Generate Lighting to rebuild the lighting data. Realtime Global Illumination cannot be used until the lighting data is rebuilt.

    Lighting data asset ‘LightingData’ is incompatible with the current Unity version. Please use Generate Lighting to rebuild the lighting data. Realtime Global Illumination cannot be used until the lighting data is rebuilt.
    UnityEditorInternal.InternalEditorUtility:GetGameObjectInstanceIDFromComponent(Int32)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)


    Lighting data asset ‘LightingData’ is incompatible with the current Unity version. Please use Generate Lighting to rebuild the lighting data. Realtime Global Illumination cannot be used until the lighting data is rebuilt.
    UnityEditorInternal.InternalEditorUtility:GetGameObjectInstanceIDFromComponent(Int32)
    UnityEngine.GUIUtility:processEvent(Int32, IntPtr)

    Just thought I better flag it.
     
    BansheeGz likes this.
  16. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    @Duffer123 ,
    Oh, I'm sorry, it slipped my mind, thank you for reminding me.
    we'll have it fixed soon (I'll send you an updated package just in case you are interested)

    Next version (ETA: end of next week) should have new node-based graph editor for building templates

    EDIT: this feature is delayed, unfortunately
     
    Last edited: Oct 11, 2018
    Duffer123 likes this.
  17. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    966
    @BansheeGz ,

    Whaaat? Tell me more about this graph editor...
     
    BansheeGz likes this.
  18. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    @Duffer123 ,

    We want to build a node-based graph tool to query/update database data without need to write code.
    Something like Shader Graph https://unity3d.com/ru/shader-graph , but instead of building shaders we want to query/update data with it.
    And these graphs need to be executable at runtime.
    At the very least, we want to replace our templates with this tool ASAP, cause they are very basic and not very useful at all.
    After the tool is released, any feedback would be greatly appreciated.
     
    Duffer123 likes this.
  19. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    966
    @BansheeGz , will probably require more tutorial vids
     
    BansheeGz likes this.
  20. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    966
    @BansheeGz , How's it going with development of this Asset? Anything next in the pipeline?
     
    BansheeGz likes this.
  21. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    @Duffer123, unfortunately node graph is delayed. We had hard time trying to adopt third party node graph editor and we lost a lot of time. We had to switch to multi threading add-on instead of this feature.
    I updated roadmap here: http://www.bansheegz.com/BGDatabase/
     
    Duffer123 likes this.
  22. Duffer123

    Duffer123

    Joined:
    May 24, 2015
    Posts:
    966
    Ok. Looking forward to it!
     
    BansheeGz likes this.
  23. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    574
    I just got the invite, I will be sure to try it out. I had a question though about this. I have been working on an RPG but was rethinking my DB setup, my game is somewhat split up so that it has a map server, a login server, etc. I wanted to try and incorporate a "state" server which would essentially act as just an in-memory database and the only thing that actually communicates with the DB is the state server and it would only do it periodically as needed.

    The other servers and what not would communicate directly with the state server at all times and the state server would just do something like batch saving every now and then, so that instead of a server having to do queries to a standard db, the info is readily available. I see that this can save and load to google sheets and such, but is it possible to have this act as a state server since it handles the in-memory portion well from what I can see, but then save its data to something a bit more suitable for data storage instead of just google sheets or excel, etc?
     
  24. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    @MostHated ,
    no, unfortunately, BGDatabase is not meant to be run outside of Unity, so it can not be run in any server environment. Even if it did, it would not make much sense, cause we could not compete with traditional databases. It's meant to be an alternative for Unity's scriptable objects, csv/xml files or whatever people are using to store their ingame data. The purpose for multithreading support is to allow to use BGDatabase with new Unity's Entity-Component System. Also GoogleSheets export/import works in Editor only, in Runtime you can update database data on players devices with LiveUpdate plugin, but there is no way to update GoogleSheet data from players devices.
    As far as I understood, you want to make a fast proxy server for better performance and to reduce db servers load. Probably traditional inMemory databases is a good choice for this, maybe some specialized software exist. Unfortunately, BGDatabase is a no-go for this scenario.
     
  25. MostHated

    MostHated

    Joined:
    Nov 29, 2015
    Posts:
    574
    It might still be able to help out with what I am after, or at least make for a good learning experience if nothing else. When I was referring to it being a state server I was meaning that it would still be running as a Unity instance. When I mentioned map server, login server, etc, they are each Unity instances, they are just dedicated to specific tasks, but running in separate binary files so that they could be separated out to run on different physical hardware if need be for expansion and growth, they just run minimal services, such as no physics, no lighting or anything using a customized player loop within the particular Unity instance, so it would still be running within Unity as intended.

    As for saving and loading of data, essentially what I was referring to was it would be great to have an instance of Unity running an in memory db which would be the "state server". My game is an RPG, so say someone logs on, ideally when they log in and select a character, it would tell the state server to load up that particular players data, the way I envision it working is the state server would connect to whatever its "cold" or "inactive" data source happened to be and pulls all the user details for that particular user one time and its then there in memory, as the player plays all interaction is done with the state server only so as not to be making time-consuming database queries throughout the play session if they get a new item or a stat changes, etc, in the event that there are hundreds (or possibly thousands) of players. Periodically the state server would take all recorded changes for all players and save that back to whatever the "inactive" data storage happened to be, which it sounds like in this case is just saved locally, which may not be a bad thing, but ideally in my case it would be nice if the inactive and non in use data was saved outside of Unity so say, I have a website with a user account page that displays a users stats similar to something like WoW Armory, once the user logs off, the in-memory data saves a copy to the inactive (or I guess, cold storage?) so it can be used for other purposes but also backed up / replicated in a more enterprise fashion.

    While I have not looked at it yet, so I can't say if it would still work for what I am after. This is more of an "in an ideal world I would like..." type of thing. I like the idea of the inactive data being housed in a place that can be backed up and replicated using well known and reliable tools. So if BGD was able to grab data from an outside source in some way as needed (when a character logs in) even if it kept its own copy locally that it used as needed for its operation, then was able to periodically save its current state to inactive storage (even if that is locally) then that data that is saved locally within the Unity instance was able to be exported to another storage medium, or something along those lines, that would be awesome.

    Again, I am mostly just throwing out what I think would be useful, lol. So if it has no ability to do anything of the sort, that is ok, I am also making a single player game currently in which I am getting to a point in which I would like to start saving data, so it could very well be useful for that as well. : D I just know I hate the idea of using scriptable objects as an actual database, it just feels so, unobtainable I guess, something like a "black box" in which if something goes wrong you might be out of luck. So anything, even if for peace of mind, ends up being better in my eyes.
     
  26. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    @MostHated , your idea makes sense to me, but BGDatabase cannot be used in this scenario- even if it can be run technically, it was not designed for this.
    I personally don't know any good alternative to cloud database (or some cache server) which is provided as a service and some service on top of it. You'll get
    1) Guaranteed high uptime >99.9%
    2) Auto upscaling
    3) almost zero maintenance cost
    I think all these criteria are very crucial to any server and this is not what BGDatabase can provide.
    You still can use it on players devices as a replacement to scriptable objects, but not as a replacement to a cloud database, for sure - its completely different type of software.
     
  27. Tonyzhai

    Tonyzhai

    Joined:
    Jan 5, 2018
    Posts:
    3
    The tool is very rigorous, but it is too painful to manually create each field, and a method that can quickly create a large number of fields is strongly needed. I am a SLG gamer, and we have an unimaginable number of fields. Manual setup takes a lot of time.
     
  28. Tonyzhai

    Tonyzhai

    Joined:
    Jan 5, 2018
    Posts:
    3
    or you can provide a way for us to build meta from Googlesheets,it must be great! This is the normal workflow of mark hight numerical games.
     
  29. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    @Tonyzhai , we'll add support for the scripts in the next version.
    I've sent you a prototype in private message.
    Please, let me know if something is missing.

    Regarding pulling data from GoogleSheets:
    Unfortunately, information about types of the fields is missing in Google Sheets.
    We could retrieve field names from GoogleSheets, but you still have to fill in fields types.
    If it's more convenient for you, please, let me know, we'll add such option.
     
    Last edited: Nov 23, 2018
  30. Tonyzhai

    Tonyzhai

    Joined:
    Jan 5, 2018
    Posts:
    3
    it's cool. very thanks, and i have another question.
    why not to be able to use "_" as FieldName. I will work with Python, I often use Python pandas for the analysis of the game number data , I usually use format like "STR_heroName" .So I'm in python can easily call and identifying type.
    No matter what, is "_" is commonly used, hope to be able to support.:)
     
  31. BansheeGz

    BansheeGz

    Joined:
    Dec 17, 2016
    Posts:
    59
    @Tonyzhai I've sent you an updated package with support of underscores in private message.