Foreman 0.1.9 - A factory optimisation tool.

Calculate optimal ratios for feeding recipes, search through the research-tree, specialized tools to view game-information.
Post Reply
PassCall
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Mar 14, 2015 2:30 pm
Contact:

Re: Foreman - A factory optimisation tool. Now 11.X compatible!

Post by PassCall »

Mind if I recode it on a website ?
Yes, no problem

Nicksaurus
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Thu Aug 28, 2014 12:56 pm
Contact:

Re: Foreman - A factory optimisation tool. Now 11.X compatible!

Post by Nicksaurus »

sadris wrote:I'm confused. I have DyTech enabled, which makes the recipe for Red Science pack a stone gear and copper plate. However, Foreman still says that Red Science is an iron gear. Does Foreman not actually read the recipe definitions? What does "supports mods" means?
It means it tries to read the recipes in exactly the same way as the game does, which means that that shouldn't be happening. Uh... sorry about that.

DRE
Inserter
Inserter
Posts: 41
Joined: Sun Jan 25, 2015 2:30 pm
Contact:

Re: Foreman - A factory optimisation tool. Now 11.X compatible!

Post by DRE »

ProductionGraph::SatisfyAllItemDemands() never ends, if I try to autocomplete chart for rocket defences / minute.

nodeChosen is always true.

EDIT: Program hangs only if factorio is running.

DRE
Inserter
Inserter
Posts: 41
Joined: Sun Jan 25, 2015 2:30 pm
Contact:

Re: Foreman - A factory optimisation tool. Now 11.X compatible!

Post by DRE »

You calculate speed bonus, adding bonus to basic crafting speed.

I think it is correct to sum bonuses from all speed modules, and multiply it by crafting speed + base crafting speed.

n9103
Smart Inserter
Smart Inserter
Posts: 1067
Joined: Wed Feb 20, 2013 12:09 am
Contact:

Re: Foreman - A factory optimisation tool. Now 11.X compatible!

Post by n9103 »

DRE wrote:You calculate speed bonus, adding bonus to basic crafting speed.

I think it is correct to sum bonuses from all speed modules, and multiply it by crafting speed + base crafting speed.
Effective crafting speed = base crafting speed * (1 + net speed modifiers)
Colonel Failure wrote:You can lose your Ecologist Badge quite quickly once you get to the point of just being able to murder them willy-nilly without a second care in the world.

slay_mithos
Fast Inserter
Fast Inserter
Posts: 204
Joined: Tue Feb 25, 2014 7:22 am
Contact:

Re: Foreman - A factory optimisation tool. Now 11.X compatible!

Post by slay_mithos »

I really like the idea behind Foreman, but it's a shame that it's not quite working when trying to make it load a lot of mods.

I wanted to try using it with darkshadow's pack, to generate clean graphs to help me setup my various production lines, as well as the numbers, but it didn't seem to load any data from mods.

I used to have an error log in older versions of the pack, pointing at "advanced equipment", specifically this line:
data.raw["gui-style"].default["adveq"] = adveq

Apparently, it didn't like "gui-style".



After a quick look through the code, the answer is obvious.
Factorio, since a few versions ago, is able to load mods that are in .zip archives (if named correctly), but Foreman only looks for directories.

This means that it won't even try to load any mod that are in .zip format, and due to most mods being distributed that way these days, it most likely won't load a single mod most of the time.

The first part of the fix for mod support would be to use ZipFile.OpenRead(ARCHIVENAME);
https://msdn.microsoft.com/en-gb/librar ... 10%29.aspx

I hope it helps, because apart from a few strange things here and there (seems to want to crack light oil for petroleum gas, somehow), this is a pretty good tool.

When I get the time, I might try to "fix" the mod support for the mods I am using, but I simply don't have the time right now to dedicate an unknown amount of time to it, and I don't want to do half assed "fixes".

User avatar
Ranakastrasz
Smart Inserter
Smart Inserter
Posts: 2124
Joined: Thu Jun 12, 2014 3:05 am
Contact:

Re: Foreman - A factory optimisation tool. Now 11.X compatible!

Post by Ranakastrasz »

I'm having trouble getting this to work for Dytech.
While it works for some of the items, it doesn't work for all of them.

It didn't work at all until I extracted all the files out of the Zip Directories, but that was already established.

Edit:
Apperently Foreman doesn't handle something correctly.. The data files require the Config. The Config defines several booleans for each subset of the mod. The Data file has a bunch of if statements enabling each part of the mod.

I made a second mod directory in the Foreman folder, and after extracting each mod, tore out that part of the code in the data file. It works for machines, but not for warfare or power. Unsure why.
My Mods:
Modular Armor Revamp - V16
Large Chests - V16
Agent Orange - V16
Flare - V16
Easy Refineries - V16

Nicksaurus
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Thu Aug 28, 2014 12:56 pm
Contact:

Re: Foreman - A factory optimisation tool. Now 11.X compatible!

Post by Nicksaurus »

New Version!

https://bitbucket.org/Nicksaurus/foreman/downloads

The most notable improvement is that you can now save and load your flowcharts as JSON files. Now you won't have to remake them every time you start playing again.

Also, you can enable and disable specific mods, just like in the game. Your mod selections are stored in graph files when you save them.

There's also an option for loading game data in any of the languages that the game supports. This doesn't affect Foreman's UI text, but it will load item and recipe names in the language you choose (assuming your language has a translation for the specific item/recipe).

Finally, there are some minor UI improvements. The pop-up for choosing the type of node you want to make now disappears when you click off it or press escape, and you can now use arrow keys + enter to select filtered items more quickly.

EDIT: I also forgot to mention that it can handle zipped mods now.
Last edited by Nicksaurus on Mon Jun 22, 2015 8:31 pm, edited 1 time in total.

Koub
Global Moderator
Global Moderator
Posts: 7203
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Foreman - A factory optimisation tool. Now 11.X compatible!

Post by Koub »

Nicksaurus wrote:The most notable improvement is that you can now save and load your flowcharts as JSON files.
Also, you can enable and disable specific mods, just like in the game. Your mod selections are stored in graph files when you save them.
You're my hero (twice) :)

However, I'm afraid I came across a bug. Here is a JSON (zipped for forum upload).
Have a look at the refinery products. It seems that the petroleum gas produced by the oil processing is merely ignored, all the petroleum used further in the flowchart comes from cracking, which seems suboptimal.

As a suggestion for the next version, may I suggest to add with the objects you can enable/disable the following options :
- Use basic / advanced oil processing
- Use cracking for Heavy > Light
- Use cracking for Light > Petroleum Gas

You can know neither what oil processing is used by the player, nor if he cracks everything to petroleum, or uses heavy/light for other purposes.
Attachments
AM3.zip
(975 Bytes) Downloaded 271 times
Koub - Please consider English is not my native language.

Nicksaurus
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Thu Aug 28, 2014 12:56 pm
Contact:

Re: Foreman - A factory optimisation tool. Now 11.X compatible!

Post by Nicksaurus »

Koub wrote:You're my hero (twice) :)
Aww :)
Koub wrote:
Nicksaurus wrote:However, I'm afraid I came across a bug.
Aww :(

Problems with oil refining recipes (and any modded items that have more than one recipe) have been plaguing this program since it began... I'll add in a menu to enable and disable specific recipes, but in the mean time you can just delete the recipe you don't want to use and put down the one you do. These problems won't be completely fixed until I sit down and write some proper code to make intelligent decisions about which recipes to use and in what ratios though.

PiggyWhiskey
Filter Inserter
Filter Inserter
Posts: 252
Joined: Wed May 13, 2015 5:28 am
Contact:

Re: Foreman - A factory optimisation tool. Version 0.1.8 is up!

Post by PiggyWhiskey »

Fresh bug report for you :) well two actually.

1. When loading the Floors mod I get a crash. Repeatable, and only when Floors is in the active mods. https://forums.factorio.com/forum/vie ... 1&start=50
Crash Report
2. There seems to be an issue when loading mods that add extra items to the game.
I'm running with Dytech (Core/Machine/Power) which all add tier'd items (Mk4/5/6 assembler/solar/boiler etc)

Scenario
1. Load Dytech Core - Works fine
2. Load Dytech Machine - Works fine (all other tiers are displayable and usable)
3. Load Dytech Power - No Additional items added (Solar Mk2/3/4/5 etc)
Mods shows, base, core, Dytech Core, Dytech Machine, Dytech Power
4. Remove Dytech Machine - Works fine, Dytech Power items added correctly, Dytech Machine items removed.
5. Re-add Dytech Machine - Same issue as #3
6. Load Dytech War - Dytech War/Dytech Machine items aren't in the listing.

At first I thought it was the last mod listed not loading the items, but #6 puts that idea down.
So I'm not sure what, but it can't handle so many mods with new items it seems.

I stopped testing when I had it confined to Dytech, not wanting to complicate the issue by mixing other mods in there.

Nicksaurus
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Thu Aug 28, 2014 12:56 pm
Contact:

Re: Foreman - A factory optimisation tool. Version 0.1.8 is up!

Post by Nicksaurus »

PiggyWhiskey wrote:Fresh bug report for you :) well two actually.

1. When loading the Floors mod I get a crash.
Fixed. That one was easy. Floors marks its floor items as 'resources' which foreman took to mean that they could be mined by miners, causing it to crash while looking for mining hardness/item yield/etc. values that weren't there. I've put up a new version with this fix: https://bitbucket.org/Nicksaurus/foreman/downloads
PiggyWhiskey wrote: 2. There seems to be an issue when loading mods that add extra items to the game.
This... is harder. I've worked out what the problem is. Individual DyTech mods have config.lua files which enable and disable specific parts of the mod. However, since each config file has the same module name (as far as Lua is concerned), the interpreter only reads the first one and then assumes that all subsequent ones are just the same file again and ignores them. This means that anything that needs to be enabled in the config file just isn't loaded.

The thing is... I'm not nearly good enough with lua to work out how to solve this. I really wish I could look at Factorio's source code to see exactly how they load their game data and just emulate that.

PiggyWhiskey
Filter Inserter
Filter Inserter
Posts: 252
Joined: Wed May 13, 2015 5:28 am
Contact:

Re: Foreman - A factory optimisation tool. Version 0.1.8 is up!

Post by PiggyWhiskey »

Nicksaurus wrote:....
This... is harder. I've worked out what the problem is. Individual DyTech mods have config.lua files which enable and disable specific parts of the mod. However, since each config file has the same module name (as far as Lua is concerned), the interpreter only reads the first one and then assumes that all subsequent ones are just the same file again and ignores them. This means that anything that needs to be enabled in the config file just isn't loaded.

The thing is... I'm not nearly good enough with lua to work out how to solve this. I really wish I could look at Factorio's source code to see exactly how they load their game data and just emulate that.
Well config.lua is specific to individual mods and doesn't follow a standard convention, So you could potentially ignore these.
Otherwise you would need to manually code for every single mod that uses a config file including what items the mod means by each keyword.

As the config.lua controls whether certain items are present in the game, you already have this functionality in "Enable/Disable Objects" which the user can specifically disable the items that are blocked by the mod.
So I'm not sure what the config.lua is doing inside Foreman otherwise.

Nicksaurus
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Thu Aug 28, 2014 12:56 pm
Contact:

Re: Foreman - A factory optimisation tool. Version 0.1.8 is up!

Post by Nicksaurus »

PiggyWhiskey wrote:
Nicksaurus wrote:....
This... is harder. I've worked out what the problem is. Individual DyTech mods have config.lua files which enable and disable specific parts of the mod. However, since each config file has the same module name (as far as Lua is concerned), the interpreter only reads the first one and then assumes that all subsequent ones are just the same file again and ignores them. This means that anything that needs to be enabled in the config file just isn't loaded.

The thing is... I'm not nearly good enough with lua to work out how to solve this. I really wish I could look at Factorio's source code to see exactly how they load their game data and just emulate that.
Well config.lua is specific to individual mods and doesn't follow a standard convention, So you could potentially ignore these.
Otherwise you would need to manually code for every single mod that uses a config file including what items the mod means by each keyword.

As the config.lua controls whether certain items are present in the game, you already have this functionality in "Enable/Disable Objects" which the user can specifically disable the items that are blocked by the mod.
So I'm not sure what the config.lua is doing inside Foreman otherwise.
It's not that simple - config.lua is just another lua script. Data.lua runs config.lua, which enables certain booleans, which in turn instruct data.lua to load several other scripts in the mod. If those scripts are never run, their data is never even loaded and they don't appear in the enable/disable list.

I think I'm just going to hack in a workaround that manually parses data.lua for any scripts it needs in the top-level mod directory.

User avatar
oLaudix
Filter Inserter
Filter Inserter
Posts: 282
Joined: Sun Jun 14, 2015 3:24 pm
Contact:

Re: Foreman - A factory optimisation tool. Version 0.1.8 is up!

Post by oLaudix »

How do I switch from basic oil processing to advanced? Also can i somehow incorporate cracking into nodes like "basic oil processing to plastic"?. I dont think ill need 2 rafineries for 1 plastic plant if I crack light oil.
Image

Nicksaurus
Long Handed Inserter
Long Handed Inserter
Posts: 52
Joined: Thu Aug 28, 2014 12:56 pm
Contact:

Re: Foreman - A factory optimisation tool. Version 0.1.8 is up!

Post by Nicksaurus »

oLaudix wrote:How do I switch from basic oil processing to advanced? Also can i somehow incorporate cracking into nodes like "basic oil processing to plastic"?. I dont think ill need 2 rafineries for 1 plastic plant if I crack light oil.
Delete the basic oil node and drag an advanced one onto the flowchart (either by dragging from a crude oil input on another node or by dragging crude oil from the item menu).

I'm aware of the limitations with oil processing at the moment though. There might not be a way to get an accurate reading on them for what you're doing...

User avatar
oLaudix
Filter Inserter
Filter Inserter
Posts: 282
Joined: Sun Jun 14, 2015 3:24 pm
Contact:

Re: Foreman - A factory optimisation tool. Version 0.1.8 is up!

Post by oLaudix »

Nicksaurus wrote:
oLaudix wrote:How do I switch from basic oil processing to advanced? Also can i somehow incorporate cracking into nodes like "basic oil processing to plastic"?. I dont think ill need 2 rafineries for 1 plastic plant if I crack light oil.
Delete the basic oil node and drag an advanced one onto the flowchart (either by dragging from a crude oil input on another node or by dragging crude oil from the item menu).

I'm aware of the limitations with oil processing at the moment though. There might not be a way to get an accurate reading on them for what you're doing...
Ye i just take numbers of petrol i need that program shows me and calculate it by hand with cracking in mind ... As for the advanced oil i thought there is option to turn it on for "automatcally complete flowchart" button like assemblers and stuff. Ill just look at plastic and calculate rest by hand. Still best tool to help my ocd with good ratios. When i saw ammount of oil i would need for 1 rocket defence / hour i almost got heart attack ... I cant even imagine finding so much oil around ...
Image

Ash19256
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun Jun 28, 2015 10:32 am
Contact:

Re: Foreman - A factory optimisation tool. Version 0.1.8 is up!

Post by Ash19256 »

Can this tell me how many miners/speed or productivity modules I will need to achieve a given input rate?

PiggyWhiskey
Filter Inserter
Filter Inserter
Posts: 252
Joined: Wed May 13, 2015 5:28 am
Contact:

Re: Foreman - A factory optimisation tool. Version 0.1.8 is up!

Post by PiggyWhiskey »

Ash19256 wrote:Can this tell me how many miners/speed or productivity modules I will need to achieve a given input rate?
Yes it can.
If you let it do its thing, it'll tell you how many speed modules/what type of assembler/furnaces to use as well.
And you can also lock it down. So if you want the entire production line to have the same type (All Assembler MK2 or all Steel Furnaces, it can calculate that too)
And it can also be limited to your current tech limit. There isn't any point to telling you that you can use Mk3 assemblers with Speed 3 modules if you can't craft them.

Ash19256
Manual Inserter
Manual Inserter
Posts: 2
Joined: Sun Jun 28, 2015 10:32 am
Contact:

Re: Foreman - A factory optimisation tool. Version 0.1.8 is up!

Post by Ash19256 »

Ok, why is this happening?
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ArgumentNullException: Value cannot be null.
Parameter name: source
at System.Linq.Enumerable.Where[TSource](IEnumerable`1 source, Func`2 predicate)
at Foreman.MainForm.FilterTextBox_TextChanged(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnTextChanged(EventArgs e)
at System.Windows.Forms.TextBoxBase.OnTextChanged(EventArgs e)
at System.Windows.Forms.TextBoxBase.WmReflectCommand(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.TextBox.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1022 (RTMGDR.030319-1000)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
Foreman
Assembly Version: 0.0.1.1
Win32 Version: 0.0.0.0
CodeBase: file:///E:/Game%20Files/Foreman/Foreman.exe
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1002 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1001 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1001 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.233 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1015 (RTMGDR.030319-1000)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1015 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
WindowsBase
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1015 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/WindowsBase/v4.0_4.0.0.0__31bf3856ad364e35/WindowsBase.dll
----------------------------------------
Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
----------------------------------------
Newtonsoft.Json
Assembly Version: 6.0.0.0
Win32 Version: 6.0.8.18111
CodeBase: file:///E:/Game%20Files/Foreman/Newtonsoft.Json.DLL
----------------------------------------
System.Numerics
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
System.Runtime.Serialization
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1016 (RTMGDR.030319-1000)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
System.Xml.Linq
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml.Linq/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.Linq.dll
----------------------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.237 (RTMGDR.030319-2300)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
NLua
Assembly Version: 1.3.0.0
Win32 Version: 1.3.0
CodeBase: file:///E:/Game%20Files/Foreman/NLua.DLL
----------------------------------------
KeraLua
Assembly Version: 1.3.0.0
Win32 Version: 1.3.0.0
CodeBase: file:///E:/Game%20Files/Foreman/KeraLua.DLL
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.

Post Reply

Return to “Cheatsheets / Calculators / Viewers”