Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[List Column Type] Support of Arrays? #5

Open
SeleDreams opened this issue Aug 28, 2020 · 7 comments
Open

[List Column Type] Support of Arrays? #5

SeleDreams opened this issue Aug 28, 2020 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@SeleDreams
Copy link

Hi, I really like your tool and found it very useful for my game, it works nicely for the database of characters and stuff. The lack of array support however makes it hard to manage stuff such as the database of enemy parties that contains data of all the battles of the game, since each party would have an array indicating their members, weapons etc
Is it planned to add support for it ?

@thejustinwalsh thejustinwalsh added the help wanted Extra attention is needed label Aug 28, 2020
@thejustinwalsh
Copy link
Owner

To be completely honest, I have no real plans to add support for anything. I thought it would be fun to make this for a game project I was porting over, and then life took over, and that project is sitting there doing nothing. I like working on this though, so if you send me a small example of a CDB database that you would want to support, I can take a crack at it, although my timeline for completion isn't that great.

Also this code is very purpose driven, and not that DRY. Maintenance of this code might be a problem without a refactor.

@SeleDreams
Copy link
Author

To be completely honest, I have no real plans to add support for anything. I thought it would be fun to make this for a game project I was porting over, and then life took over, and that project is sitting there doing nothing. I like working on this though, so if you send me a small example of a CDB database that you would want to support, I can take a crack at it, although my timeline for completion isn't that great.

Also this code is very purpose driven, and not that DRY. Maintenance of this code might be a problem without a refactor.

I see, no pressure, atm I still was able to do what I wanted by using commas instead of an array like this then splitting them when reading the data
image

but basically it would make the job less error-prone to be able to have instead of this an array with the categories character, weapons, level etc

@thejustinwalsh thejustinwalsh added the enhancement New feature or request label Aug 28, 2020
@thejustinwalsh
Copy link
Owner

thejustinwalsh commented Aug 28, 2020

Yeah, it needs some Arrays. The idea behind this plugin is that nothing would be parsed at runtime, so it should keep it nice and fast. That parsing you are doing, is wasting CPU cycles for no good reason (accept for me not using arrays in my project yet). When Defold went open source, I got distracted and spent too much time messing around with it. I'll turn my free-time gaze back to Godot soon.

@SeleDreams
Copy link
Author

At least this parsing is only done one frame when a battle starts so it's not a big deal (it would be bad practice to read data from a database every frame anyway) but yeah arrays help a lot for this stuff

@thejustinwalsh
Copy link
Owner

thejustinwalsh commented Aug 28, 2020

Ok, so it looks like CastleDB supports Lists, but not Arrays. A List can contain any number of columns, so you end up with an Array of JSON blobs, and it could probably be nested farily deep in the tool, like a List of a List of a List. So this feature is really, a List.

@thejustinwalsh thejustinwalsh changed the title Support of arrays ? [List Column Type] Support of Arrays? Aug 28, 2020
@taro8
Copy link

taro8 commented Feb 26, 2021

The support for list/arrays would be incredibly helpful as you can do some really crazy nested list setups that can help populate the game with needed data. Crafting recipes, leveled item lists, possible enemy spawn pools and pretty much anything.
If you look at how bethesda does their leveled lists its pretty much all nested lists that work off each other. That is something what that the list/arrays would allow you to do, they can be very powerful.
I know too little about gd script to write anything sensible.

@zextillion
Copy link

zextillion commented Jun 29, 2022

I've added lists to my fork of this repository.

The way I see it, there are two ways of handling a list. For simplicity, I've only done the first option, but I think the 2nd option might be a cool idea.

  1. The crude way. Take the JSON list that's present in the data and make that a list of dictionaries. All keys and values are JSON strings (unless the value is a number). Nested lists/dictionaries can be accessed through string lookups.

  2. Create a class from that line and parse through the list so you get autocompletion. I expect there's going to be recursion involved for nested lists and dictionaries.

For example: say we have a Sheet called Teams --> the Row is called TeamsRow. A column has the list type, and has the column name FriendlyTeams. This is an inner class under TeamsRow called TeamsRowFriendlyTeamsList.

(I don't know if we need TeamsRow in front, just an example in case there's issues with another class in the project that could be called FriendlyTeamsList.)

TeamsRow therefore has a variable TeamsRowFriendlyTeams that is an instance of the TeamsRowFriendlyTeamsList class.

TeamsRowFriendlyTeamsList has its own members of the various types in CastleDB, including more lists. The nested list can just keep on if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants