emilyploszaj / emi

A featureful and accessible item and recipe viewer
MIT License
220 stars 46 forks source link

[Feature Request] Tree of Production (here more information) #547

Open AlaronFV opened 1 month ago

AlaronFV commented 1 month ago

Here I'll add more information, to previous request. Here is a link to it (I've added information in comment): https://github.com/emilyploszaj/emi/issues/542

And also I reworked somehow the function that calculate total time from start to reaching requirements. Now it doesn't need to simulate all tree working as production line, it just need data about time for operation for each method (machine), needed input and given output. And it can recursively calculate it by formula (which worked on my tests). The core of my request is still the same. For given resource create the best (or make it by oneself, through favorite recipes) tree of production of different machines, and for given time requirement generate given amount of resource. But to do that the tree need to be configured, specifically how much instances of each machine, within each node of the tree, we need, for the whole system to produce needed amount of resource in given time. And the core thing is to calculate these amounts of instances for nodes of production tree. But the function that calculate time is new. It is not perfect, as there is no customization that was in simulation fucntion (still, can be done), but it give the idea how can it work. So it is in the same repo, here is the link: https://github.com/AlaronFV/Production_Lines/tree/main The file is https://github.com/AlaronFV/Production_Lines/blob/main/New_Time_Calculation_Function

emilyploszaj commented 1 month ago

I still do not understand what you are actually asking EMI to add

TheRealWormbo commented 1 month ago

It feels like this is asking to automatically not only compile a bill of materials, but also consider output rates for individual recipes so you can balance a factory around that information, i.e. how many machines do you need to produce input for another machine at a rate that machine consumes its input. Seems somewhat unlikely to be universally possible, considering many recipes don't actually have processing time information, or the processing time depends on other factors and can be variable.

Simple example: How fast can you process crafting recipes to provide fuel for a furnace to process stone into smooth stone? (Or: How many furnaces can a single source of crafted fuel support?) The answer is: How is EMI supposed to know? You could be running a vanilla crafter at double hopper speed, or an IE Assembler at one item every two seconds, or some other machine at a stack every game tick. The recipe does not hold that information.

AlaronFV commented 1 month ago

Something like that. So if EMI can't know that, then okay, i just thought that processing time for recipe is stored with recipe's input and output, thus i couldn't understand why EMI doesn't have such information. If information of time of processing was stored, and if to use not recursive function but a simulation function from the first issue, then such things as fuel can be implemented, still, even thought such thing can be implemented, as there i've used scipy.optimize.minimize which run simulation several (not too much but still much) times to adjust these amounts of instances of each machine, which can take too much time, so it'll probably won't work on large production trees. But still, as i don't know which information EMI can get from Minecraft, i can't say what is possible or not.

But if to use it manually, then it may work, which i'll try to test on some modpack, by manually creating these trees, (now i am using not scipy.optimize.minimize but pygad to create best list of amounts of instances of machines). Still don't know how to implement fuel and so with new function, but i think it can be done. So if such ideas can be transformed into some mod, maybe not automatically creating best recipes' tree with time and so, but rather building it by oneself (something like Just Enough Calculation or something), just within interface of some minecraft item or in some other way, that would be good. But then one need to measure somehow how much time take each recipe, which can be troublesome, but then again one can create some mod to calculate ticks within some timeframe based on conditions (if inputs -> - amount, outputs -> + amount, or anything like that).

So i think all that can be done, but i don't have much spirit to learn java and write it by myself. So, something like that.