peter-kish / gloot

A universal inventory system for the Godot game engine.
MIT License
658 stars 28 forks source link

Feature Proposal: Support for a tabular data format for protoset? (csv, tsv) etc.? #239

Closed LeeWannacott closed 2 months ago

LeeWannacott commented 2 months ago

I think having the item protoset in a tabular format such as .csv would make it easier to edit than a json file like for example balancing items, or seeing how the stats compare and be easier for non-technical people. I know you have the "Protoset Editor" which is a tabular format, but I think users using something like Excel, Libre etc. would be easier and one less thing to maintain.

Probably still want to store it as json/dict, but be editable as csv :thinking:

TheYellowArchitect commented 2 months ago

I love csv, Godot supports it too (example code below)

var opened_csv_file = FileAccess.open(database_excel_sheet_path, FileAccess.READ)
var csv_row = opened_csv_file.get_line()
print (csv_row)
var current_row_index = 1
while opened_csv_file.eof_reached() == false:
    csv_row = opened_csv_file.get_line()
    if (csv_row.length() == 0):
        break

    var password_raw: String = csv_row.get_slice("|", csv_header_fields.password_index).strip_edges()

That said, I understand why this is made in JSON (different properties for each item). Personally in my use-case, all items have the same fields, so csv fits, but I recognize it doesn't for most users. To have the protoset editor support csv directly is quite a big feature request, so if this isn't planned or implemented, I suggest for your use-case of balancing, to use a JSON to CSV converter (and vice versa ofc)

If csv is supported, might as well suggest also items to be not be serialized from JSON to Dictionary but CSV to a custom gd class generated, with the properties (ID -> int, description -> String, icon_path -> String, and the csv properties for each item)

LeeWannacott commented 2 months ago

To have the protoset editor support csv directly is quite a big feature request

I'm not suggesting that at all, I think he built that because godot 3 didn't support JSON and I think I read he was scrapping it for v3 gloot anyway.

I think I am suggesting being able to have the protoset in CSV or JSON (as I think there are pros and cons of each filetype). I don't know what the implementation details would be...

I suggest for your use-case of balancing, to use a JSON to CSV converter (and vice versa ofc)

Yeah, possibly I read that is a thing. However it might be annoying constantly having to convert between file types.

I potentially should have opened this as a discussion :shrug: