greeny / SatisfactoryTools

Satisfactory Tools for planning and building the perfect base.
https://www.satisfactorytools.com/
MIT License
278 stars 58 forks source link

API documentation #141

Open lynn2910 opened 3 weeks ago

lynn2910 commented 3 weeks ago

Greetings!

I'm developing a tool to generate different factory layouts in the game Satisfactory. Users would input their desired production goals, and the tool would automatically create layouts with machines, belts, and other necessary components.

To achieve this, I'd like to leverage the API provided by satisfactorytools instead of building a custom resolver.

Unfortunately, I haven't been able to locate any documentation for the API. Specifically, I'm unclear about:

I attempted to glean insights by analyzing the API requests, but without documentation, it proved challenging (as illustrated in the attached screenshot).

image

I can glimpse the basic logic behind but I don't know how I should use it

Does Satisfactory Tools offer any documentation for its API?

greeny commented 3 weeks ago

Hi

first of all, the API is not really designed to be used by public, but I don't really care much if you use it, assuming you don't flood SFTools server with tons of requests :)

second, there's no guarantee that the API will work the same, there may be changes or the API may even stop working if I replace it (I'm working on new Tools, which will have different API, if at all).


That being said, from your message it seems you know what to send as request and just want to parse the response:

first of you want to split by # and take the second part. It can be one of these:

if it's not either of these, it's a classname of a machine making something. In that case, you have to split the first part by @, then the first part will be recipe class and second part will be clock speed (it's always 100 because tools don't do clock speeds yet). The value is "amount of buildings running that recipe"

it sometimes also includes weird things like special__power, which you can just ignore, basically if the classname doesn't match to any item/recipe, just skip that.


Once you have the "nodes" from the result above, connecting them to make the graph is up to you (Tools do it by just blindly connecting outputs to inputs).

That should be all. If you have questions, feel free to ask me (you can also write on Discord, e.g. in the Tools server.