AsherGlick / ResourceCalculator

A Video Game Resource Calculator
https://resourcecalculator.com
GNU General Public License v3.0
56 stars 30 forks source link

Ability to output to CSV #114

Closed im-PJs closed 3 months ago

im-PJs commented 3 months ago

Hi there,

I was wondering if there was a way to output the results into a csv or excel file? Would be really helpful

Thanks, PJs

AsherGlick commented 3 months ago

Folks have asked for some sort of csv input format, but none yet who have asked for a csv output format. I am not sure exactly I know what a csv output file would look like for resource calculator either. It could contain just the final resources, it could contain the entire dependency tree, it could contain the instructions too. What usecases are you thinking of for getting it as an output?

im-PJs commented 3 months ago

Hey thanks for responding so quick!

It's not something super necessary, but I've thought about it a few times so figured i'd mention it. I see the CSV output as a straightforward list, for example:

Item            Quantity
Coal            141 (2 Stacks + 13)
Gold Ingot      954 (14 Stacks + 58)
etc...

This format would: 1) Provide a convenient way for users to save their material list. 2) Potentially lay the groundwork for a feature to allow users to easily re-import lists for adjustments without starting from scratch.

Thanks for considering this feature!

Best, PJs

Edit: Exactly, as you said it could contain all final resources, the entire dependency tree and the instructions too. The user can easily remove what they don't want but the more the better imo

AsherGlick commented 3 months ago

The calculator can re-calculate from input values, not output values. So in order to allow users to re-import their lists we would actually save the input list as a csv, similar to how it is currently saved in the URL. I could see that being a feature alongside the URL based functionality. The output data would then just be deterministically recomputed. That would handle both scenarios you describe.

If I am not understanding your vision please feel free to provide more examples of how the output would uniquely be used.

im-PJs commented 3 months ago

@AsherGlick

In essence, I'm looking for a way to save the output from your website - both the raw material list and the detailed crafting instructions.

Ideally, a simple download button could generate a file (like TXT, CSV, or Excel) that captures all this information. This way, users can save their project plans directly from the website and return to edit/work with them whenever needed without starting from scratch and are able to share with others

instead of creating an import feature, you could just include the URL that the file was downloaded from on top and that way it could easily be opened anytime

This feature would significantly enhance the user experience by making project planning and execution more seamless and user-friendly.

below is an example of the file I would imagine I would receive, I would prefer a CSV file but a simple txt file would work too


Resource Calculator Url: https://resourcecalculator.com/minecraft/#sprucelog=223&crimsonhyphae=321&chest=213&jackolantern=444&oakboat=0&wheat=747&endcrystal=0

Base Ingredients    
Item    Quantity
Crimson Stem    428 (6 Stacks + 44)
Oak Log 551 (8 Stacks + 39)
Coal    14
Pumpkin 444 (6 Stacks + 60)
Spruce Log  223 (3 Stacks + 31)
Wheat   747 (11 Stacks + 43)

Text Instructions [Beta]    
Craft 440 (6 Stacks + 56) Oak Log into 1760 (27 Stacks + 32) Oak Planks 
Treat 14 Coal as 112 (1 Stack + 48) Fuel    
Right click on 444 (6 Stacks + 60) Pumpkin with Sheers to carve it into 444 (6 Stacks + 60) Carved Pumpkin  
Craft 56 Oak Planks into 112 (1 Stack + 48) Stick   
Use a furnace to smelt 111 (1 Stack + 47) Oak Log into 111 (1 Stack + 47) Charcoal using 111 (1 Stack + 47) Fuel    
Craft 111 (1 Stack + 47) Stick and 111 (1 Stack + 47) Charcoal into 444 (6 Stacks + 60) Torch   
Craft 428 (6 Stacks + 44) Crimson Stem into 321 (5 Stacks + 1) Crimson Hyphae   
Craft 1704 (26 Stacks + 40) Oak Planks into 213 (3 Stacks + 21) Chest   
Craft 444 (6 Stacks + 60) Torch and 444 (6 Stacks + 60) Carved Pumpkin into 444 (6 Stacks + 60) Jack o'Lantern
AsherGlick commented 3 months ago

I don't yet see why this would be a useful feature to write when compared with the alternatives of saving and loading input CSVs. The output download format you propose also contains the input data in the form of the URL, meaning that everything else in the output file format is just a cache of what resource calculator would recreate.

Ideally, a simple download button could generate a file (like TXT, CSV, or Excel) that captures all this information. This way, users can save their project plans directly from the website and return to edit/work with them whenever needed without starting from scratch and are able to share with others

The existing URL sharing already allows all of this functionality, I could be convinced that making URL sharing more user friendly is a good idea though.

This feature would significantly enhance the user experience by making project planning and execution more seamless and user-friendly.

Can you provide some user stories / workflow examples of when this would actually be the case? What time or complexity savings would be gained by the user if we implemented this feature?

The only reason I can think of, off the top of my head, why someone would want this is if they were going to take the output of resource calculator and pipe it into a different program. But that is not what you are trying to do, so I am at a loss why just loading the input data and having resource calculator reprocesses it automatically is insufficient.

im-PJs commented 3 months ago

@AsherGlick, sorry if I’m misunderstanding what you’re trying to say… all im looking for a basic save feature. This would just save the results (like the URL, Base Ingredients, and Instructions) right after calculations. It seems like a fundamental feature for user convenience. I’m not suggesting changes to importing, merely adding an option for downloading results. I’ve been considering creating a separate site for this functionality. However, I believe adding a save button into resourcecalculator.com would be beneficial for all users

AsherGlick commented 3 months ago

Can you provide some real world examples of when this would be useful? What makes the text output better than the web UI?

im-PJs commented 3 months ago

For example, my use case is for Minecraft builds needing lots of materials, a text file is better than a web UI because you can easily track what you've collected and what's left, make notes, access it anytime without the internet, and are able to share it with other people you’re working on things with all the notes saved. Yes you can copy and paste it currently but it doesn’t come out as nice as it could if it was built into the site

AsherGlick commented 3 months ago

That seems to be able to be achieved by altering the divs to be spans in the instruction items. Right now if you copy data from the instructions it looks like you get newlines everywhere.

Craft 5
Iron Ingot
into 1
Minecart
Craft 4
Sand
and 5
Gunpowder
into 1
TNT
Craft 1
Minecart
and 1
TNT
into 1
Minecart with TNT

After changing them to spans they can be copied much more easily. Screenshot from 2024-03-12 18-44-21

Craft 5 Iron Ingot into 1 Minecart
Craft 4 Sand and 5 Gunpowder into 1 TNT
Craft 1 Minecart and 1 TNT into 1 Minecart with TNT

Arguably, they should have always been spans anyways because they actually are inline text elements.

Changing the divs to be spans in the item instructions so you can copy/paste them is a much cleaner change then implementing a second entirely different output format. Is there any reason this would not work for your use case?

im-PJs commented 3 months ago

@AsherGlick

While the copy/paste works for basic needs, I needed something a bit more automated for personal use. So, I created www.resourcecalcdl.co, which allows users to download the list for direct download and management of project plans.

This site is a result of our conversations and fills a specific gap I encountered. Thought it might be of interest to others facing similar issues.

Best, PJs