Page 1 of 1

Modules not working as intended

Posted: Sun Sep 13, 2015 2:07 pm
by Gallex
The problem is machines produce less (or more in few cases) than they should.

This is setup that I used to test this.

Image

And the test itself.

Image

As you can see result depends on recipe craft time. I didn't test very long (5s+) recipes but I think they would be closest to expected result. As for cause of this behaviour I think the problem is that the real craft time of quick recipes after modification by machine speed and modules is close if not lower than one game tick and because of huge productivity would require to output product 2-5 times per tick and that's impossible. This is big problem because many recipes use 0.5s or 1s craft time.

This problem also occur in Drills and is even more significant because even 1 God module 5 would decrease real productivity in mk5 drill (compared to full raw productivity modules setup)

Re: Modules not working as intended

Posted: Sun Sep 13, 2015 2:38 pm
by Boogieman14
That's a known issue with the game, it simply breaks with very high speeds of assemblers: https://forums.factorio.com/forum/vie ... 41&t=15093

Re: Modules not working as intended

Posted: Sun Sep 13, 2015 6:28 pm
by orzelek
Could you post a save with this setup for devs in that thread with bug report?

Re: Modules not working as intended

Posted: Thu Sep 17, 2015 3:18 am
by crysanja
maybe thats kind of the reason why productivity modules in the base game slow down production?

Re: Modules not working as intended

Posted: Thu Sep 17, 2015 7:51 am
by bobingabout
I don't think that is the reason.

But I will admit that putting 6 god modules in an assembling machine is beyond the intention of the devs.

I think the current way the game works is that you are basically allowed one entire bar fill per tick. if the bar fills faster than this. if you get more than one fill per tick, the excess is carried over to the next tick. in a situation where it is running flat out constantly, these excess productions arn't fully taken account for.

Re: Modules not working as intended

Posted: Wed Sep 23, 2015 6:06 am
by Rseding91
Productivity modules in the base game slow down production because it's a good balance system for generating free items :)

Regarding the weirdness when super overclocking a machine - picture this:
  • Iron gear wheels have a crafting time of 0.5s.
  • That means they have an "energy" of 0.5 - the literal floating point number "0.5".
  • Crafting machines produce: (recipe energy / 60 energy per tick) * crafting speed.
  • So in this instance you have: (0.5 / 60) * 1 = 0.0083333333333333 "energy" produced per game tick for a total craft tine of 30 game ticks (0.5 seconds).
  • Now this works just fine for a crafting speed of 1: 0.0083333333333333 * 30 ~ 0.5 so you get ~1 item per half second.
Now lets factor in the modded assembling machines and modules:
  • Iron gear wheels crafting time: 0.5s - energy of 0.5.
  • Crafting machine 6 crafting speed: 3.5
  • Modules: 6 totaling 1200% speed and 300% productivity
  • In this instance you have: (0.5 / 60) * 15.5 * 3 = 0.3875 energy produced per game tick
  • Now you'd experience a crafting time of 2 ticks: 0.3875 + 0.3875 > 0.5 and the energy re-sets to 0 after producing the item.
This seems like it should be simple to fix but this is assuming no rounding errors anywhere in any of the calculations. In reality *all* of the numbers get skewed every time any one of the steps is done. As a rough estimate there are 9 floating point calculations done each time energy is added each game tick.

9 * 60 ticks (1 second) and now the number is wrong by 540 floating point rounding errors. 1 second later that number is up to 1080 and it keeps going. 10 minutes into constant crafting and the number would be wrong by 324,000 rounding errors.

Now, these errors are consistent - that is to say that the same error happens every time the same calculation is done. If they weren't then the game would be desyncing every few ticks. However, they throw off these types of calculations by massive amounts over time.


As the crafting system is now when the machine produces an item it re-sets the energy stored value to 0 - erasing all of the left over rounding errors accumulated over the life time of the 1 craft. That's why a crafting machine with a calculated energy-per-tick of 0.3875 only produces 2 items over the course of 4 ticks when 0.3875 * 4 > 1.55.

Re: Modules not working as intended

Posted: Wed Sep 23, 2015 6:47 am
by bobingabout
Rseding91 wrote:Now you'd experience a crafting time of 2 ticks: 0.3875 + 0.3875 > 0.5 and the energy re-sets to 0 after producing the item.
If this is true, it's wrong. it shouldn't reset to 0 just because an item is made. it should reset to 0.3875 + 0.3875 = 0.775 - 0.5 = 0.275 and get an item. Then since this would result in a cumulative increase in items given, if an item is given, it should check again to see if it is above the time, therefore allowing more than 1 item to be given per tick.

Re: Modules not working as intended

Posted: Wed Sep 23, 2015 9:30 am
by Boogieman14
But if you do that, rounding errors will start accumulating. Wouldn't that lead to desyncs in MP games (since floating point precision isn't guaranteed to be the same across platforms).

Also, realistically, how big of a deal is this? With 1 item created every tick, you're going to need a decent amount of inserters already for input and output. Add in the productivity bonus of your god modules and it moves into ridiculous territory :lol: I would find it an acceptable compromise to limit production to one item per tick from regular production and the proper amount of items from productivity bonus - as long as input consumption is correct and no input is lost along the way.

Re: Modules not working as intended

Posted: Wed Sep 23, 2015 11:57 am
by oLaudix
bobingabout wrote:It should reset to 0.3875 + 0.3875 = 0.775 - 0.5 = 0.275 and get an item. Then since this would result in a cumulative increase in items given, if an item is given, it should check again to see if it is above the time, therefore allowing more than 1 item to be given per tick.
That still gives maximum of 1 item per second since even if you get that 0.275 for next tick, itll be completed in 1 tick and give another 0.275 in next tick resulting in 0.275 shifts per tick giving nothing but troubles.

Re: Modules not working as intended

Posted: Wed Sep 23, 2015 12:35 pm
by crysanja
guess a work around would be to produce bigger stacks in a proportional time.

Re: Modules not working as intended

Posted: Wed Sep 23, 2015 1:22 pm
by oLaudix
crysanja wrote:guess a work around would be to produce bigger stacks in a proportional time.
Even if you max out the production to make 60 items per second and 60 items from productivity per second it still gives you 7200 items per minute. You need about 10 inserters to get it out of the assembly machine (5 with bobs inserters) and you need space for inserters that put stuff in the machine as well. Its already impossible to fit. With copper wire its 14400 items per minute since it produces 2 items per tick.

Re: Modules not working as intended

Posted: Wed Sep 23, 2015 2:23 pm
by bobingabout
oLaudix wrote:
bobingabout wrote:It should reset to 0.3875 + 0.3875 = 0.775 - 0.5 = 0.275 and get an item. Then since this would result in a cumulative increase in items given, if an item is given, it should check again to see if it is above the time, therefore allowing more than 1 item to be given per tick.
That still gives maximum of 1 item per second since even if you get that 0.275 for next tick, itll be completed in 1 tick and give another 0.275 in next tick resulting in 0.275 shifts per tick giving nothing but troubles.
this is basically where the check to see if you get an item needs to be a loop, so if the speeed would give you 10 completed cycles in a tick, you should get 10 completed cycles worth of items in a tick.

It's a bit pointless debating it in here though, the devs are unlikely to see this, it's not often they snoop through mod subforums.