[0.7.4] Extra products

This subforum contains all the issues which we already resolved.
Post Reply
jannee
Manual Inserter
Manual Inserter
Posts: 2
Joined: Tue Oct 22, 2013 6:57 am
Contact:

[0.7.4] Extra products

Post by jannee »

I have problem with Assembling mashine 3. I put 4 Productivity modules 3 and craft 5x one item and Mashine give me only 2 additional products and end after 5th item on 99% next one. Is it a bug? I calculate it 5p. / 100% = 0,05% * 60% = 3 pieces I want all my bonuses :)
Image

kovarex
Factorio Staff
Factorio Staff
Posts: 8079
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.7.4] Extra products

Post by kovarex »

Hello, thank you for the report.
The reason of this behavior is, that computer floating point numbers aren't precise.
This isn't issue in the long run, and I would personally tend to not mark it as a bug, but as a balancing feature :)

User avatar
Nova
Filter Inserter
Filter Inserter
Posts: 949
Joined: Mon Mar 04, 2013 12:13 am
Contact:

Re: [0.7.4] Extra products

Post by Nova »

In my opinion it is a bug. Maybe not important, but a bug.
Greetings, Nova.
Factorio is one of the greatest games I ever played, with one of the best developers I ever heard of.

Nirahiel
Filter Inserter
Filter Inserter
Posts: 351
Joined: Mon Sep 23, 2013 2:18 pm
Contact:

Re: [0.7.4] Extra products

Post by Nirahiel »

Instead of having each crafted item fill a percent of the bar, count how much crafts are required for an extra item, and decrement this value at each craft or something ?

kovarex
Factorio Staff
Factorio Staff
Posts: 8079
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.7.4] Extra products

Post by kovarex »

The simple yet not elegant solution would be to multiply the bonus production by number like 1.0001 ....

Coolthulhu
Fast Inserter
Fast Inserter
Posts: 201
Joined: Thu Apr 04, 2013 9:55 am
Contact:

Re: [0.7.4] Extra products

Post by Coolthulhu »

I've got a bit less hacky solution: when the regular production bar hits 100, force the productivity item creation event to happen if the productivity bar is within some epsilon of 100% and reset it.

Example: 125% productivity, ingredients for 4 items - 4th item is produced, productivity bar is at 99.98%, so we treat it as 100%, produce 2 new items (one regular, one from productivity) and set productivity bar to 0%.

It could also work both ways - starting production (the same procedure that consumes ingredients) could clear the productivity bar if it's below 0.01%.

User avatar
Math3vv
Long Handed Inserter
Long Handed Inserter
Posts: 99
Joined: Sun Oct 06, 2013 10:47 am
Contact:

Re: [0.7.4] Extra products

Post by Math3vv »

Coolthulhu wrote: It could also work both ways - starting production (the same procedure that consumes ingredients) could clear the productivity bar if it's below 0.01%.
i think this would create a bug were it clears the bar every time it starts a new craft, not sure tough i don't know the code for it...

this is an good idea tough
I've got a bit less hacky solution: when the regular production bar hits 100, force the productivity item creation event to happen if the productivity bar is within some epsilon of 100% and reset it.
or just multiply by 1.0001 after each craft is done

kovarex
Factorio Staff
Factorio Staff
Posts: 8079
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.7.4] Extra products

Post by kovarex »

It is now solved for 0.8.1.

When I compare the bonus production with the needed production, I add 0.0001.

FrozenOne
Fast Inserter
Fast Inserter
Posts: 177
Joined: Mon Mar 04, 2013 8:10 pm
Contact:

Re: [0.7.4] Extra products

Post by FrozenOne »

Such hacks. Wouldn't it be more reasonable to use some precise number format instead of float? Like Java has BigDecimal.

kovarex
Factorio Staff
Factorio Staff
Posts: 8079
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.7.4] Extra products

Post by kovarex »

FrozenOne wrote:Such hacks. Wouldn't it be more reasonable to use some precise number format instead of float? Like Java has BigDecimal.
From what I understood about the implementation, you still can't do 1/3 with unlimited precision, to do things like this, the value would have to be stored as symbolic expression, and it would definitely be slower.

Post Reply

Return to “Resolved Problems and Bugs”