-
Notifications
You must be signed in to change notification settings - Fork 802
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
Extract some player attributes to data files #6608
Conversation
@ephphatha The header parsing function allows the columns to be in any order but do we actually need it? |
You can call The column heading order isn't as important in a transposed table like this PR. As a followup to #6530 I was going to effectively lift and shift the arrays to tab-separated files, which would make it more useful (one of the things commonly seen in d2 text files are comment columns which we would want to skip anyway, allowing reordering wasn't particular difficult to achieve once that was implemented). I would be interested in seeing a fixed point equivalent to |
Thanks, I've added a simple As for having floats in data files, I think it's fine to just have ints. Floats introduce a whole other layer of complexity. |
Perhaps we can simplify it further by mandating the field order as well (with validation). There isn't any need to reorder them and mods can add values to the end. What do you think? |
Pushed the code mandating the field order in a separate commit |
Part of the aim of having arbitrary column ordering was to allow mods to group related columns to make files easier to read/modify. I can see the reason for transposing the tables and having a per-class split however I must admit I'm even less keen about having a strict row order. That said it doesn't matter what my preference is, it matters more what modders find easy to use :D |
The mods would have to add code that reads the new values, and it's much simpler to write code that expects the values in the particular order. In the order-independent code I had a map and a variant, it was rather complicated compared to this version. So this might actually be easier for modders, though I'm also not sure. |
Fair enough, I'm happy to go with this approach. It'll conflict with the initial scope of #6530 since you've used a slightly different API for exposing the PlayerData struct but I can rebase that work easy enough. I finished off the class-per-row parsing as an example of how that would be used but it's really not that much different to this approach, just means that the file structure is slightly different and the boilerplate to handle columns shifts to strict row order. Only real hesitation I have is that I would really prefer allowing decimal representations of fixed point numbers instead of the raw 1/64 values. The fixed point parsing turned out to be fairly simple to implement so I've added that to my PR, I can cherry pick it for use here if you'd like. |
Yeah, the fixed point parsing turned out simpler than I thought, sounds good |
What would be the best way to merge the 2 PRs? As I understand:
|
One advantage of having per-class files is that it makes it easier to add a new class -- simply copy the directory of another class and modify the values. If all classes are in the same files, one needs to then figure out which files relate to classes and manually add a row in each |
Files per class sounds fine to me. Regarding merging the PRs the only thing we're "missing" from this PR is the extracted toHit values and starting items, it's easy enough to roll back the scope of the one I had opened and rebase it on what you've done here. |
Done! |
Makes parsing simpler. Additional columns and rows are ignored.
Nice :) |
No description provided.