+12

Databases (3D Arrays ++) (Native)

JasonJonesLASM 3 years ago updated by RandomGameDev 2 years ago 5


3D Arrays are here in the new collection type Databases. These are essentially 3d arrays with more built in functions. Under the hood it uses a dictionary, so it really isn't an exact array, and allows you to do quicker actions closer to how a database or datasheet would work.

It uses all the terminology, columns, rows, depth, cells, from databases. As of this post, there is no documentation within bolt for the descriptions, but I will be adding that in. Look below in the comments for further updates. 

Here is a run down of all the current units available in Collection > Databases

Create Database

  • Create a new database with a preset amount of Columns, Rows, and Depth.

Add Database Column, Row, and Depth

  • Add Columns, Rows, and Depth starting at a specific index.

Remove Database Column, Row, and Depth

  • Remove Columns, Rows, and Depth starting at a specific index.

Get Database Cell

  • Get a cells value at location in the database

Set Database Cell

  • Set a cells value at location in the database

Find Database Cell

  • Gets the first cells location that has a specific value.

Find Database Cells

  • Gets all cells locations that have a specific value.

Contains Database Value

  • Returns true if the value exists in the database.

Clear Database

  • Turns all database values in a database to null.

Split Database At Column, Row, and Depth

  • Splits the database at index. Outputs two separate databases.

Resize Database

  • Shrinks or Grows the database. All new cells values are null.

Pull Database Cells

  • Pulls a set of cells out of the database. The database keeps it's original cell count, but the pulled cells value, is now null. Outputs two seperate databases.

Get Last Database Cell

  • Gets the location and value of the very last cell.



Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):
+1

Thanks a lot again for all the effort and time you put into this addons to make our lives easier and more enjoyable with bold.
You have my respect ;)

Very Cool and right at the same time I was searching for this functionality. Woot! Thank you so much JJ!

+1

Awesome! I'm glad. Feel free to give me feedback or feature requests. This one was a little more into new territory for me. Some stuff someone more versed in actively using them may know what's missing more.

1 feature request so far, coming next week is Fill Database, Column, Row, Depth and From Index. Fills any of those cells with a single value

Hello, Bolt beginner here, so maybe the questions are a bit stupid, sorry if they are.

Is it only possible to input the whole data structure of a database using the Set DB Cell function, or is it possible to prepare the table externally in a text editor (CSV) or spreadsheet app and import it into the project? That would be preferable for large database structures. Once the Set DB Cell is used, is that automatically saved as well, will the change remain after the app is exited and restarted?

Also, is it possible (and if not, is it planned) to name columns and rows and then retrieve data using those names rather than just using row and column number? So, for example if I had one row for each enemy in a scene (who have a Int to identify them) and the first column is named health, then I could use Get DB Cell from column health and row enemy.ID to get their health. It would make the database quite dynamic and flexible for various uses.

Thanks!

I like the tag idea. There is a lot of internal workings going on right now, so what you have now, although similar, will function a little different then it does now. Like databases start at 1, will now be 0. I think your idea is viable though, and would also agree that it would add a lot of ease to getting cells in a different manner. I'll look into adding this.

This is simply a class type, not a utility. So it does not out of the box function with external files or carry any sort of saving over. It only will work within bolts setup when used with Bolt.  No reason you can't do that though yourself if you could figure out reading a CVS file, by iterating and adding cells. I'm honestly not well versed in writing and reading from files, but I'm going to start learning ASAP. I have a couple ideas that could benefit from this.