Picked up product would be added to the crafting queue

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
Mauslag PIngman
Fast Inserter
Fast Inserter
Posts: 148
Joined: Sun Mar 20, 2016 3:36 pm
Contact:

Picked up product would be added to the crafting queue

Post by Mauslag PIngman »

Let say I build a roboport on my person. If I forget the gears but I have the iron plates it will start making a lot of gears. It would be nice if I could pick up some gears and these would then fill the gear requirement. Since it displays all the ingredients necessary on the lower left, this would be a very convenient and easy way to fill in each product after the crafting of the item has begun.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by ssilk »

Oh, that has discussed several times. The problem here is - in very short words - that this would enable you to cheat.

A bit more info: The crafting queue is calculated before beginning to craft. The needed items are taken out of your inventory. The problem here is, that it is a difference between crafting one and many items. The brutto and netto items can differ, this is due to the fact that you need for example 2 copper to craft one electronic circuit, but "only" 3 to craft 2. This is because you need 1.5 copper per one circuit netto, but because you cannot use 1/2 copper you need to take brutto 2 copper.

If you change this calculation in the middle of the process the calculation is then wrong or in other words: You can cheat here.

Solution till now: I don't know. This is much more complex. :)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Brambor
Fast Inserter
Fast Inserter
Posts: 125
Joined: Thu May 07, 2015 1:52 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by Brambor »

Can you give me the exact problem? I'm a python programe and I would like to solve it. I know I cannot give you a python result but I can give you a solution in real words like a mathematical solution.
Reasons:
  • I like this idea
    I like challenges
    You will not lose anything
    I will inform you about my work if you want
Edit: I could make a python program which will do it as well :)
Btw: I hate cheating :)

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by ssilk »

Brambor wrote:Can you give me the exact problem?
No, cause that would mean, I know all the details... :)

Understanding the problem is one part of programming. :ugeek:
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Brambor
Fast Inserter
Fast Inserter
Posts: 125
Joined: Thu May 07, 2015 1:52 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by Brambor »

Well the problem on my side is that I don't know where to search for and I don't know the programming language it is written in...
C'mon I wana help!

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by ssilk »

Ok, step one: Use the help boards for help instead of suggestion board.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

garath
Fast Inserter
Fast Inserter
Posts: 154
Joined: Wed Apr 13, 2016 2:11 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by garath »

ssilk wrote:Oh, that has discussed several times. The problem here is - in very short words - that this would enable you to cheat.

A bit more info: The crafting queue is calculated before beginning to craft. The needed items are taken out of your inventory. The problem here is, that it is a difference between crafting one and many items. The brutto and netto items can differ, this is due to the fact that you need for example 2 copper to craft one electronic circuit, but "only" 3 to craft 2. This is because you need 1.5 copper per one circuit netto, but because you cannot use 1/2 copper you need to take brutto 2 copper.

If you change this calculation in the middle of the process the calculation is then wrong or in other words: You can cheat here.

Solution till now: I don't know. This is much more complex. :)
Thank you for the explanation. This helps.

Zeblote
Filter Inserter
Filter Inserter
Posts: 973
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: Picked up product would be added to the crafting queue

Post by Zeblote »

ssilk wrote:A bit more info: The crafting queue is calculated before beginning to craft. The needed items are taken out of your inventory. The problem here is, that it is a difference between crafting one and many items. The brutto and netto items can differ, this is due to the fact that you need for example 2 copper to craft one electronic circuit, but "only" 3 to craft 2. This is because you need 1.5 copper per one circuit netto, but because you cannot use 1/2 copper you need to take brutto 2 copper.

If you change this calculation in the middle of the process the calculation is then wrong or in other words: You can cheat here.
This makes no sense. You can just calculate it again, except this time with the new components.

garath
Fast Inserter
Fast Inserter
Posts: 154
Joined: Wed Apr 13, 2016 2:11 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by garath »

Zeblote wrote:
ssilk wrote:A bit more info: The crafting queue is calculated before beginning to craft. The needed items are taken out of your inventory. The problem here is, that it is a difference between crafting one and many items. The brutto and netto items can differ, this is due to the fact that you need for example 2 copper to craft one electronic circuit, but "only" 3 to craft 2. This is because you need 1.5 copper per one circuit netto, but because you cannot use 1/2 copper you need to take brutto 2 copper.

If you change this calculation in the middle of the process the calculation is then wrong or in other words: You can cheat here.
This makes no sense. You can just calculate it again, except this time with the new components.
Consider this: You queue up stacks of ten different items that each require 6-10 assembly steps before reaching the final product. Then, you expect to be able to run around your factory doing other things. If the game had to make adjustments to the assembly queue each time you picked up a new item, the game would likely slow to a crawl. That might be a chain of one hundred or even one thousand items that each have to be checked each time you pick up an item. Plus, you may pick up one item or a stack of items. Don't get me wrong. I would love it if the game adjusted the ingredient list on the fly as I'm running around my base at lightning speed in my Power Armor MKII with six exoskeletons. But I'm not sure any computer short of a quantum computer could actually do that.

Zeblote
Filter Inserter
Filter Inserter
Posts: 973
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: Picked up product would be added to the crafting queue

Post by Zeblote »

garath wrote:
Zeblote wrote:
ssilk wrote:A bit more info: The crafting queue is calculated before beginning to craft. The needed items are taken out of your inventory. The problem here is, that it is a difference between crafting one and many items. The brutto and netto items can differ, this is due to the fact that you need for example 2 copper to craft one electronic circuit, but "only" 3 to craft 2. This is because you need 1.5 copper per one circuit netto, but because you cannot use 1/2 copper you need to take brutto 2 copper.

If you change this calculation in the middle of the process the calculation is then wrong or in other words: You can cheat here.
This makes no sense. You can just calculate it again, except this time with the new components.
Consider this: You queue up stacks of ten different items that each require 6-10 assembly steps before reaching the final product. Then, you expect to be able to run around your factory doing other things. If the game had to make adjustments to the assembly queue each time you picked up a new item, the game would likely slow to a crawl. That might be a chain of one hundred or even one thousand items that each have to be checked each time you pick up an item. Plus, you may pick up one item or a stack of items. Don't get me wrong. I would love it if the game adjusted the ingredient list on the fly as I'm running around my base at lightning speed in my Power Armor MKII with six exoskeletons. But I'm not sure any computer short of a quantum computer could actually do that.
I'm pretty sure the devs can figure out a nice way to handle this. Really can't see how you can use it to cheat though.

bNarFProfCrazy
Fast Inserter
Fast Inserter
Posts: 194
Joined: Sat Apr 23, 2016 7:11 am
Contact:

Re: Picked up product would be added to the crafting queue

Post by bNarFProfCrazy »

IMO this should be quite easy.
First of all if an item (electric circuit) is collected, then we check if it is required in any pending recipe.
If no, nothing has to be done.
If yes, then we just reduce the given recipe by the collected amounts.
After that we recalculate all sub recipes (copper cable) and update them accordingly.
On modern computers this shouldn't take much longer than a few ms.

PS: Please remeber that you can also adjust the final output of ECs by cancelling one or all copper cable crafting tasks.
Last edited by bNarFProfCrazy on Sat May 28, 2016 2:18 pm, edited 1 time in total.

Zeblote
Filter Inserter
Filter Inserter
Posts: 973
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: Picked up product would be added to the crafting queue

Post by Zeblote »

bNarFProfCrazy wrote: On modern computers this shouldn't take much longer than a few ms.
I'd be shocked if it takes even one ms.

bNarFProfCrazy
Fast Inserter
Fast Inserter
Posts: 194
Joined: Sat Apr 23, 2016 7:11 am
Contact:

Re: Picked up product would be added to the crafting queue

Post by bNarFProfCrazy »

Zeblote wrote:
bNarFProfCrazy wrote: On modern computers this shouldn't take much longer than a few ms.
I'd be shocked if it takes even one ms.
You'll never know how many crafting tasks are enqueued and their complexity.
If you use C or C++ this is probably <= 1ms area, but if you use lua or else you might end up > 1ms.
Please also remember that GUI updates are slow (at least the consoles I have used so far (up to 10ms/update)).

Zeblote
Filter Inserter
Filter Inserter
Posts: 973
Joined: Fri Oct 31, 2014 11:55 am
Contact:

Re: Picked up product would be added to the crafting queue

Post by Zeblote »

bNarFProfCrazy wrote:
Zeblote wrote:
bNarFProfCrazy wrote: On modern computers this shouldn't take much longer than a few ms.
I'd be shocked if it takes even one ms.
You'll never know how many crafting tasks are enqueued and their complexity.
If you use C or C++ this is probably < 1ms area, but if you use lua or else you might end up > 1ms.
Please also remember that GUI updates are slow (at least the consoles I have used so far (up to 10ms/update)).
Considering factorio is written in c++ and already handles hundreds of thousands of entities at 60 fps, I don't see a problem.

justarandomgeek
Filter Inserter
Filter Inserter
Posts: 300
Joined: Fri Mar 18, 2016 4:34 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by justarandomgeek »

ssilk wrote:Oh, that has discussed several times. The problem here is - in very short words - that this would enable you to cheat.

A bit more info: The crafting queue is calculated before beginning to craft. The needed items are taken out of your inventory. The problem here is, that it is a difference between crafting one and many items. The brutto and netto items can differ, this is due to the fact that you need for example 2 copper to craft one electronic circuit, but "only" 3 to craft 2. This is because you need 1.5 copper per one circuit netto, but because you cannot use 1/2 copper you need to take brutto 2 copper.

If you change this calculation in the middle of the process the calculation is then wrong or in other words: You can cheat here.

Solution till now: I don't know. This is much more complex. :)
What if, instead of calculating the whole craft queue at once, you just add the final item to the queue. Then, when an item comes up on the queue, if it's precursors arent' avaialble, add them *in front of the current item*, and jump to the head of the queue. If the item's precursors are available, they are then taken and the actual crafting is done. This way only the current tasks's items are removed, but the math issues don't come up as much, since the job is still n-units-of-item. This also means that things you pick up now are available for any crafts starting *after* now, but not the one that's currently running.

Of course, this may be problematic if any item in your craft series produces more stacks than it consumes (because of a lower stack size, probably), since each intermediate step would have to fit in your inventory again.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by ssilk »

That can work. But I wouldn't like that; it breaks my whole calculation, if some collected items are suddenly not available, cause automatically moved into the crafter.

What makes sense here is a button "Optimize crafting queue" (or similar), which does exactly that: It tries to refit the items in the queue, which aren't already in progress.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Brambor
Fast Inserter
Fast Inserter
Posts: 125
Joined: Thu May 07, 2015 1:52 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by Brambor »

This is not ideal then I would run on the belt, hold F and be constantly clicking the button at the same time (which is like 4keys at the same time btw - close to playing a piano). I think it should be done as it is said above, automaticly and all the time, but instead of checking it every tick it could check every second and/or after an item is finished crafting. ("And" because some things takes over ten seconds to craft so it would not be fast enough)

EDIT:
ssilk wrote:That can work. But I wouldn't like that; it breaks my whole calculation, if some collected items are suddenly not available, cause automatically moved into the crafter.
Oh! I might finally understod that. Did you ment that when you have a crafting queue and then pick up a EC to craft inserter then it would be immediately consumed by crafting queue so you cannot craft the inserter?
If that's right then it is a bad concern because the EC would be already needed so if you pick up one then the materials for crafting a EC will be released so you will be able to craft inserter (and this will add an EC to craft the inserter).
Another thing: I don't know how is the ´inventory of future things' done (how does it know that you will have one more Cu cable cause you will use only one of the two crafted) but if it is not done yet then I would make a 'future inventory' which will act as a normal one where things that will be crafted are stored. Of course player will not be able to see it.
Would it simplify this problem, or, is it already implemented?

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by ssilk »

Brambor wrote:
ssilk wrote:That can work. But I wouldn't like that; it breaks my whole calculation, if some collected items are suddenly not available, cause automatically moved into the crafter.
Oh! I might finally understod that. Did you ment that when you have a crafting queue and then pick up a EC to craft inserter then it would be immediately consumed by crafting queue so you cannot craft the inserter?
Exactly. That is an unawaited "feature". You cannot plan ahead like so.
If that's right then it is a bad concern because the EC would be already needed so if you pick up one then the materials for crafting a EC will be released so you will be able to craft inserter (and this will add an EC to craft the inserter).
No, no, no, that exactly is not true. :)
You need to think more general; there is not only one way to do things. Think: the much more clever way in this situation would be, that I build an assembly and put the EC's (and other stuff) into it, so that it crafts the stuff for me! Building assembly and puting stuff into it takes approximately less than 10 seconds, if you are used to it. Compared to the time you spare it's no question, that this is better. With your change that would not be possible.
I insist on this, NOT because I think this is the better way, but because I think everybody should play his style and that means, that the control must take care on all possibilities. :)
Another thing: I don't know how is the ´inventory of future things' done (how does it know that you will have one more Cu cable cause you will use only one of the two crafted) but if it is not done yet then I would make a 'future inventory' which will act as a normal one where things that will be crafted are stored. Of course player will not be able to see it.
Would it simplify this problem, or, is it already implemented?
The current logic is simple: All stuff that is needed to craft things is moved to a "hidden inventory". That inventory is also "endless" (hint, hint, you can use this as a hidden, endless inventory by crafting slow stuff and then abort crafting! That is also one more reason to make changes here very carefully, cause this can be easy used to cheat or abused) and everything that is crafted is put into another inventory, which is reintegrated after crafting.w
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Brambor
Fast Inserter
Fast Inserter
Posts: 125
Joined: Thu May 07, 2015 1:52 pm
Contact:

Re: Picked up product would be added to the crafting que

Post by Brambor »

I see one problem. When you pick up EC, and you get the items back, your inventory might overflow { you could get two items (Fe plate and Cu wire) while there could be only one place in your inventory }

That means that it would say you have full inventory (Cannot pick up one item EC, because {}) or it would drop one of the items on the ground, which is absolutely stupid (you would drop wires on EC belts with no space inventory to pick them up). So I now agree with your button .Yes it would have the problem too, but it could hapen only after you press the button, and it could say something like "Shorting crafting queue cannot be used because there is not enought space in your inventory".
I hope it will make sence to you, it may not since it is one sentence :)
So now, mod it, quickly!

Edit: gramatical adjustements

Brambor
Fast Inserter
Fast Inserter
Posts: 125
Joined: Thu May 07, 2015 1:52 pm
Contact:

Re: Picked up product would be added to the crafting queue

Post by Brambor »

Brambor wrote:I see one problem. When you pick up EC, and you get the items back, your inventory might overflow { you could get two items (Fe plate and Cu wire) while there could be only one place in your inventory }

That means that it would say you have full inventory (Cannot pick up one item EC, because {}) or it would drop one of the items on the ground, which is absolutely stupid (you would drop wires on EC belts with no space inventory to pick them up). So I now agree with your button .Yes it would have the problem too, but it could hapen only after you press the button, and it could say something like "Shorting crafting queue cannot be used because there is not enought space in your inventory".
Workaround might be: swich only if there is space for the items removed from the queue (after putting the replacements here).

Still it is a bit clunky as you may have be crafting inserters (and EC for them) and have EC in your inventory.
However the mod doesn't take those EC and thus makes no sence!
It is special case, but still, how would you say that to the user? Or how would you work around that (considering it has to be as cheat-prove as possible).

Now, nobody got to it so I guess I will have to mod it myself...
And learn how to mod beforehand...
The button is a good idea, maybe it should be a toggle button (automatic queue update on/off)

Post Reply

Return to “Ideas and Suggestions”