Applied Energistics 2

Applied Energistics 2

156M Downloads

Add support for multipath auto crafting

Simba98 opened this issue ยท 6 comments

commented

Some items may have more than one recipes, which are totally different. By adding support for multipath auto crafting, AE2 may provide a more powerful auto-crafting system.

Describe the feature
AE2 can use more than one patterns for same item.

The feature overview
Let me introduce what is the multipath auto crafting. Iron Ingot have at least three recipes: it can be crafted by a Block of Iron, or nine Iron Nugget, or a Iron ore with a fuel(this is a process).
If I wanted to build an auto Iron processing system and I wanted to save the Storage Cell either, I should set following two Encode Patterns.
Pattern 1: Iron Ore -> Iron Ingot
Pattern 2: Iron Ingot -> Block of Iron (For save the Storage Cell)
After that, I'd like make some patterns for auto crafting other items, like:
Pattern 3: Iron Ingot -> Iron Axe
Because of my iron is Block of Iron, I have to make
Pattern 4: Block of Iron -> Iron Ingot
However, if I had made the Pattern 1 and Pattern 4, only one of them would be used by AE2 system.
Sometimes we have some solution to handle these things.
But sometimes, we can't.
Like IC2, both Rubber Tree Sapling and Rubber Wood can extract Rubber by Extractor.
If AE2 had the multipath auto crafting support, we are able to use both Sapling and Wood to produce rubber.
This feature is also helpful for the Tiny Pile of Iron Dust in IC2, 9 dust for 1* Iron Dust, if we add a pattern for Iron Dust from tiny dust, other pattern won't work (or this pattern won't work).

One possible solution
Add the Encode pattern a new property: priority. The priority can be set by player on a ME Pattern Terminal. Higher priority pattern will be used first, if the material is not enough for request crafting, try to use the maximum number of the material. Then, search the second priority pattern, try to use them to craft remaining request. For instance, if I set priority of Pattern 1 is 0, and priority of Pattern 4 is 5. And I have 120 Iron Ores and 99 Blocks of Irons, when I request 1000 Iron Axe, it will cost 3000 Iron Ingots. Nevertheless, there are only 99 Blocks of Iron for 891 Iron Ingots; thus, AE2 will use 109 Iron Ores for remaining requested Iron Ingots.

Another possible solution
Make a little bit change to craft request GUI. When AE2 find more than one patterns for one item, List all of them at the right of craft request GUI and show the number of material. Player can adjust how many items are crafted in each pattern. For example,
Pattern 5: 1*Rubber Wood -> 1*Rubber,
Pattern 6: 1*Rubber Tree Sapling -> 1*Rubber.
If I try to craft 1000 Rubbers, AE2 shows that I have two patterns for Rubber, so I can adjust that use 900 times Pattern 5 to craft 900 Rubbers and use 100 times Pattern 6 for remaining 100 Rubbers. AE2 will also shows that this setting will cost 900 Rubber Wood and 100 Rubber Tree Saplings.

What if
What if we support both solution in AE2? Amazing!

commented

Though they had this in the past with old AE
This caused the system to jam as it tried to use parts from different recipes to finish the other, making nothing.
They do have this of sorts you just need to make THREE systems, export the time into the other systems and have it auto craft the items with an Export Bus to an interface from the First.

Think the external crafting system was the workaround fix the same but different conflict.

This till happens with some recipes as it seems to wait for something that is already available, canceling and remaking the items fixes it though.

commented

This is simply out of scope currently. Autocrafting itself is already complex enough.
Needing to also account for every possible permutation of different input items would be extremely complex.

On one side in terms of crafting calculation. It basically has to consider every possible path and most likely backtrack to different solutions. Say an alternative path for one item might use the same ingredient needed for a different item in the same crafting job. Which would then not leave enough left for these. While another ingredient for the first item would leave enough ingredients available.

In most cases it might even use pretty precious materials, which a player normally wouldn't use. E.g. it could suddenly decide to use silverwood logs for something (Maybe a somewhat dated example).
Which players then might miss until it would be too late or have not idea how to change it, because each time it will try to take the same path.
Either forcing AE2 to present a selection of dozens or even hundreds of valid paths, so the player can choose whatever they like. Which would pretty much swamp them with too many option. Or constantly ask them to help make AE2 the decision and show every possible alternative and have the user select it. Which would also be pretty annoyingly for most players.

commented

This is simply out of scope currently. Autocrafting itself is already complex enough.
Needing to also account for every possible permutation of different input items would be extremely complex.
On one side in terms of crafting calculation. It basically has to consider every possible path and most likely backtrack to different solutions. Say an alternative path for one item might use the same ingredient needed for a different item in the same crafting job. Which would then not leave enough left for these. While another ingredient for the first item would leave enough ingredients available.
In most cases it might even use pretty precious materials, which a player normally wouldn't use. E.g. it could suddenly decide to use silverwood logs for something (Maybe a somewhat dated example).
Which players then might miss until it would be too late or have not idea how to change it, because each time it will try to take the same path.
Either forcing AE2 to present a selection of dozens or even hundreds of valid paths, so the player can choose whatever they like. Which would pretty much swamp them with too many option. Or constantly ask them to help make AE2 the decision and show every possible alternative and have the user select it. Which would also be pretty annoyingly for most players.

Why Player have to face hundreds of valid paths? All Pattern are written by player themselves. Therefore if a player decide to write two Patterns for one item, they should know and would like use this feature.

Maybe you think I suggest that AE2 should search all possible recipes? I mean, AE2 should be able to use all Patterns which are written and put in by player.

commented

E.g. in case something needs planks for crafting tables, every existing plank or pattern for planks would be an option. So either it has to randomly choose between oak, spruce, birch, jungle, or whatever else of the hundreds of planks in existing might be ingredient to craft them. Should it then remember the pick when encountering something which also requires planks again? Or ask again? It would also not know beforehand that selecting plank X will be enough, so it has to either backtrack and ask for an alternative again. Either to rerun everything. Or use multiple planks and so on.

Also to some degree this is already possible as of now. At least in terms of use X or Y exclusively for the whole request depending on what the player chooses before requesting the actual item.

commented

E.g. in case something needs planks for crafting tables, every existing plank or pattern for planks would be an option. So either it has to randomly choose between oak, spruce, birch, jungle, or whatever else of the hundreds of planks in existing might be ingredient to craft them. Should it then remember the pick when encountering something which also requires planks again? Or ask again? It would also not know beforehand that selecting plank X will be enough, so it has to either backtrack and ask for an alternative again. Either to rerun everything. Or use multiple planks and so on.
Also to some degree this is already possible as of now. At least in terms of use X or Y exclusively for the whole request depending on what the player chooses before requesting the actual item.

What I mean is ask player or provide an option for selecting patterns. If a player don't like ask these questions, they can use the ore dictionary options for a pattern. (We don't need ask use what items for a pattern).
If they wish to be asked, they can turn off ore dictionary option and write two patterns.
Some mods' items also have more than one recipes, player also can write any number of patterns for every recipe which they want to use and to be asked.

commented

E.g. in case something needs planks for crafting tables, every existing plank or pattern for planks would be an option. So either it has to randomly choose between oak, spruce, birch, jungle, or whatever else of the hundreds of planks in existing might be ingredient to craft them. Should it then remember the pick when encountering something which also requires planks again? Or ask again? It would also not know beforehand that selecting plank X will be enough, so it has to either backtrack and ask for an alternative again. Either to rerun everything. Or use multiple planks and so on.
Also to some degree this is already possible as of now. At least in terms of use X or Y exclusively for the whole request depending on what the player chooses before requesting the actual item.

In your example, if a player turn on the ore dictionary option and just put ONE pattern of the recipe of crafting table in their AE2 system, therefore there are no breaking changes I suggested.
E.g Pattern 7 : (Ore Dictionary) planks -> crafting.

If the player turn off the ore dictionary option and put two patterns:
Pattern 8 oak planks -> crafting table
Pattern 9 birch planks -> crafting table
I suggest AE2 ask for options.

But the most useful feature is that:
In IC2 / ICEXP mod, the rubber can be crafted from rubber wood or from rubber tree sapling. We are able to write two patterns I provided before.
Pattern 5: 1*Rubber Wood -> 1*Rubber,
Pattern 6: 1*Rubber Tree Sapling -> 1*Rubber.
And AE2 use two pattern or ask player. This will be useful if we do that.

I'm not a native speaker. I'm sorry if you feel difficult to understand what I said.