SatisfactoryTools icon indicating copy to clipboard operation
SatisfactoryTools copied to clipboard

API documentation

Open lynn2910 opened this issue 1 year ago • 1 comments

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:

  • Resolver Functionality: What data does the API resolver return, and how should it be interpreted?
  • API Usage: Are there any guidelines or examples available for using the Satisfactory Tools API?

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?

lynn2910 avatar Aug 20 '24 22:08 lynn2910

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:

  • Mine - means mining of a raw resource (Tools can't do miners, so it won't tell you how many of what type or anything). The resource class is the first part, amount mined is the value
  • Product - means it's result of requested production, item class is first part, amount produced is the value
  • Byproduct - means it's excess production of something, same as above
  • Input - means input of an item into the production line (if added in the request), same as above

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.

greeny avatar Aug 20 '24 22:08 greeny