Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for #127 #131

Merged
merged 2 commits into from
Apr 4, 2022
Merged

Fix for #127 #131

merged 2 commits into from
Apr 4, 2022

Conversation

Kingdud
Copy link
Contributor

@Kingdud Kingdud commented Jan 16, 2021

The code included does two things:

  1. It fixes Mining Speed / ETA is not Accurate #127
  2. It changes how ore_per_minute is calculated. It keeps a circular list of the last 10 changes to the field size and averages them out, then factors in the idle time between the most recent update, the now, and the oldest data in the array to give an accurate use rate on 'pulsed' (on for a bit, off for a bit) fields.

So, say the array had 10 minutes of data from a field that was 100% in use. But then all belts filled after 10 minutes and it went idle for 10 minutes. The code would say "10 minutes passed between the oldest snapshot of the field and the most recent change." and it would also realize 10 minutes had passed between the last snapshot and right now. It would thus compute the average ore rate for the 10 minute the field was running (say 3000 ore/min) and then decrease that by the factor of idle time (10m of data, 10m of idle = 50% decrease to mining rate). So it would report 1500 ore/min as the result to be displayed.

I have lots of comments in the code explaining how and why things are done. I need to test it more on my end to ensure there are no more weird bugs. But for now, I can add a field, remove a field, and just have fields mine all without issue. The one 'weird bit' is that until a field has been mining for at least 20 seconds (with default settings) it will not display a correct mining rate. This is because I need at least two snapshots to calculate a mining rate, and we only check for changes every 10 seconds (at least on my map).

Kingdud and others added 2 commits January 16, 2021 13:01
@dturner42
Copy link

It seems you are working on this again @narc0tiq - Can this fix be merged in if it resolves issue #127?

@narc0tiq
Copy link
Owner

narc0tiq commented Apr 4, 2022

Well, I've just returned to playing a bit of Factorio and so I've been trying this patch for the last couple of days. It feels fairly reliable, so I'm going to merge it in and call it good.

@narc0tiq narc0tiq merged commit 32b8c9b into narc0tiq:master Apr 4, 2022
@narc0tiq
Copy link
Owner

narc0tiq commented Apr 4, 2022

Sorry this took so long, I haven't been playing Factorio for the last, um... two years or so, so YARM and EvoGUI weren't really something I was paying much attention to.

@narc0tiq
Copy link
Owner

narc0tiq commented Apr 4, 2022

NB: There have been multiple reports of save file corruption (including #145) with this patch; I'm going to go ahead and revert it, but will attempt to reinclude it later. From testing, it seems that an ore site that's idle enough to generate "n/m" as the ore-per-minute report is what causes Factorio to believe the save to be corrupted -- where "n" stands for "NaN", aka Not a Number. Mining a single piece of ore is enough to prevent the corruption, but obviously this can't be left this way.

narc0tiq added a commit that referenced this pull request Apr 4, 2022
This reverts commit 32b8c9b, reversing
changes made to 5d83895.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mining Speed / ETA is not Accurate
3 participants