Tool for parsing game data files - does it exist? Is it needed?

Place to post guides, observations, things related to modding that are not mods themselves.
Holy-Fire
Fast Inserter
Fast Inserter
Posts: 194
Joined: Sun Apr 14, 2013 9:15 am
Contact:

Tool for parsing game data files - does it exist? Is it needed?

Post by Holy-Fire »

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.
Xorimuth
Filter Inserter
Filter Inserter
Posts: 730
Joined: Sat Mar 02, 2019 9:39 pm
Contact:

Re: Tool for parsing game data files - does it exist? Is it needed?

Post by Xorimuth »

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?
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).

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
Holy-Fire
Fast Inserter
Fast Inserter
Posts: 194
Joined: Sun Apr 14, 2013 9:15 am
Contact:

Re: Tool for parsing game data files - does it exist? Is it needed?

Post by Holy-Fire »

Xorimuth wrote: Wed Apr 16, 2025 1:52 pm
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?
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).
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.
Post Reply

Return to “Modding discussion”