FAForever Forums
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Login

    FAF sim mods API

    Scheduled Pinned Locked Moved I need help
    9 Posts 4 Posters 762 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Didvul
      last edited by

      I'm trying to find an HTTP requests to sim mods vault, but couldn't find anything at api.faforever.com. I also tried to find related code in the downlords-faf-client sources, but I'm already exhausted serfing through these interfaces and functions without any particular values being set.
      Please help me where can I find files to install or update sim mods or where in the downlords-faf-client sources should I search.
      (The only link I have seen is that one in the (downlord's) client itself when it was running, it was something like content.faforever.com/.../...)

      1 Reply Last reply Reply Quote 0
      • Dragun101D
        Dragun101
        last edited by

        Go to the vault and click mods

        I’m a shitty 1k Global. Any balance or gameplay suggestions should be understood or taken as such.

        Project Head and current Owner/Manager of SCTA Project

        1 Reply Last reply Reply Quote 0
        • Brutus5000B
          Brutus5000 FAF Server Admin
          last edited by

          API docs for the mod
          API docs for the mod version
          The result is valid JSON-API format as described on jsonapi.org

          The query you are asking for: https://api.faforever.com/data/mod?include=latestVersion&filter=latestVersion.type==SIM
          The easiest way is to get the query string from the client (tick the checkbox)

          He said, "I've been to the year 3000
          Not much has changed, but they live underwater
          And your great-great-great-granddaughter
          Is playin' FAF, playin' FAF"

          1 Reply Last reply Reply Quote 1
          • D
            Didvul
            last edited by

            Oh, completely missed that "select a definition" bar. Thank you very much!

            1 Reply Last reply Reply Quote 0
            • D
              Didvul
              last edited by

              I don't want to spam another topic, but could someone explain how does featured_mod_versions work?
              For example, I get the following info from the replay:
              {..., 'featured_mod' : 'nomads', ... , 'featured_mod_versions': {'6': 81, '9': 72, '10': 95, '11': 95, '12': 95, '13': 95, '14': 95, '15': 72, '16': 95, '17': 95, '18': 95, '19': 95, '20': 95}}
              What do these '6', '9', ... , '20' numbers mean? As I go to api.faforever.com none of these versions (95, 81, 72) have files with corresponding ids. Should I take maximum (95) as version?
              Thank you.

              1 Reply Last reply Reply Quote 0
              • Brutus5000B
                Brutus5000 FAF Server Admin
                last edited by Brutus5000

                Ahhh.. featured mods in replays is just retarded legacy crap.
                The API has a dedicated endpoint for featured mods: Swagger doc
                As you can see you need a featured mod id. You can look it up here

                So how does this (not) work:
                They key id refers to a particular file. The value refers to this files value.
                Some values being lower than others means that this file has not been changed since then.
                But you are right the maximum number gives you the actual patch version you can lookup in the api.

                Since nomads is id=4 and version=95, basically this endpoint would give you the files you need: https://api.faforever.com/featuredMods/4/files/95

                But: All featured mods are built on top of FAF base mod. The replay format json doesn't tell you which base mod version was played. There might be a chance that this info is in the binary replay stream though. (The client does not support this and the replay is broken if there is a base patch)

                He said, "I've been to the year 3000
                Not much has changed, but they live underwater
                And your great-great-great-granddaughter
                Is playin' FAF, playin' FAF"

                D 1 Reply Last reply Reply Quote 0
                • D
                  Didvul @Brutus5000
                  last edited by Didvul

                  @Brutus5000 Thanks, I will take the maximum then.

                  P.S. Actually it (the info about FAF base mod) is in the binary replay stream and, fortunately, Python client can deal with it. So, if you want to fix this in your client, to get such info you should (according to the Python code):

                  1. Open the replay file
                  2. Read the data starting from line 2 (the first line is the JSON info)
                  3. Decode the data from base64
                  4. Decompress the data with zlib (you might want to remove the header (the first 4 bytes) to do this)

                  Now the decompressed data should begin like this: 'Supreme Commander v1.50.3717\x00\ ...', so you can decode it and extract the version (3717).

                  1 Reply Last reply Reply Quote 0
                  • S
                    Sheikah
                    last edited by

                    Nice I was wondering how the python client did it. Thanks for the info I will probably add this to the java client as well.

                    1 Reply Last reply Reply Quote 0
                    • D
                      Didvul
                      last edited by

                      This post is deleted!
                      1 Reply Last reply Reply Quote 0
                      • First post
                        Last post