I'm working on some tool for Factorio. If and when it's finished I'll share more about it.
For this purpose, I need to be able to parse prototypes from the game .lua data files and extract some of their properties.
Since I'm not completely sure what are the properties I'll need, I've been working (with some help from Claude) on a general framework that will take the files and parse all of their properties into strongly typed C# classes.
But this is getting a bit complicated and I'm wondering if I should continue expanding the parser, or if I should simplify things and focus only on those properties that I actually need.
So I've been wondering - does such a parsing tool already exist, in which case I could just integrate it into my project?
If not - is there demand for one? I figure that if there is such an open-source tool with data structures and parsing for the data, people could use that to handle the prototypes programmatically for a variety of applications. And if that is the case, it would make more sense to invest the time into making this framework fully general.
Tool for parsing game data files - does it exist? Is it needed?
Re: Tool for parsing game data files - does it exist? Is it needed?
Yes. You can run the factorio executable with the `--dump-data` parameter and it will load all the lua data files and export them as a json. (https://wiki.factorio.com/Command_line_parameters).Holy-Fire wrote: Wed Apr 16, 2025 1:39 pm
So I've been wondering - does such a parsing tool already exist, in which case I could just integrate it into my project?
Furthermore, the devs provide the data API in machine-readable format, which you can use to determine the types of any objects in the data dump: https://lua-api.factorio.com/latest/aux ... otype.html
There are plenty of existing tools which accomplish this (though not necessarily using the above methods) such as FactorioLab and YAFC.
My mods
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Content: Lunar Landings | Freight Forwarding | Spidertron Patrols | Spidertron Enhancements | Power Overload
QoL: Factory Search | Module Inserter Simplified | Wire Shortcuts X | Ghost Warnings
Re: Tool for parsing game data files - does it exist? Is it needed?
Thanks. This covers only a part of what I've been working on in this context, but it definitely simplifies things. I'll just extract the specific things I need from the JSON.Xorimuth wrote: Wed Apr 16, 2025 1:52 pmYes. You can run the factorio executable with the `--dump-data` parameter and it will load all the lua data files and export them as a json. (https://wiki.factorio.com/Command_line_parameters).Holy-Fire wrote: Wed Apr 16, 2025 1:39 pm
So I've been wondering - does such a parsing tool already exist, in which case I could just integrate it into my project?