Factorio python tooling
Posted: Sun Sep 11, 2016 1:42 am
So I've started a python library to read Factorio's data, complete with any installed and enabled mods. The library may be found here: https://github.com/jcranmer/factorio-tools. The library also comes with a Flask-based webserver that shows some statistics pages. The webserver itself does almost nothing, merely mapping URLs to either the static page list or a generated image file from the Factorio data files (including from within zipped mods, this is hard to do with command-line tools) or a JSON file representing parsed data. I could generate static pages for a given version (/mod combo), but including the images is risky licensing, and I don't really have accessible webspace at the moment to do any hosting.
Features:
Features:
- schema.json: This file is a mapping of the Lua prototype data to JSON attributes. It notes the names, default values, types, and inheritance hierarchies of various tables. Well, for the properties I've seen fit to include to date. Getting everything added requires tracking down a whole lot of documentation that is missing or plain wrong.
- ratio.html: This page dumps ratios, for example, saying that 2 electronics circuits to 3 copper cables is an exact ratio. I plan to add configurable maximum numerators/denominators (currently hardcoded to 100) and productivity module ratios later.
- tech-tree.html: This page dumps a tech-tree in a layered graph representation. The output is admittedly hard-to-read, because I didn't implement all the steps of Sugiyama layout, and there's no way (yet) to highlight only a single node's induced subgraph.