Add a latest replay URL
-
Currently you can get replays from FAF with a URL as such:
https://replay.faforever.com/18645999
It would be good if a URL that downloaded the highest number avalable replay like
https://replay.faforever.com/latest
was implemented
This should not be a hard feature to add
Something with some more utility and harder to add would be the ability to download all replays based on a date played example
-
No it would not be good to add logic to this endpoint. Nobody is supposed to filter on the replay.faforever.com domain.
Just (learn to) use our api instead.https://api.faforever.com/data/game?filter=replayAvailable==true&sort=-id&page[limit]=1 gives you the latest present replay in the
replayUrl
field. -
I am getting service unavalable for the API. Is the API down or have I been too much "API learning" to be IP banned?
-
API was down
-
Lmao
-
@brutus5000 said in Add a latest replay URL:
No it would not be good to add logic to this endpoint. Nobody is supposed to filter on the replay.faforever.com domain.
Just (learn to) use our api instead.https://api.faforever.com/data/game?filter=replayAvailable==true&sort=-id&page[limit]=1 gives you the latest present replay in the
replayUrl
field.Has the API been locked down? I am getting a permissions error on this link.
-
Yes you have to supply an access token now for the API
-
is there a guide on this anywhere?
-
This is nothing you can do without additional tools.
-
I would like to automatically review some replays (units built, when they were built) in certian rating brackets on certian maps using askaholics python replay parser and get a win / loss from each one using the API. Is there no way to do this now?
-
You need to implement OAuth login in your script. There are helper libraries for every programming language.
The auto discovery url is here: https://hydra.faforever.com/.well-known/openid-configuration
-
Just be aware that the replay data doesn’t contain exactly the info you’re looking for. It contains the sequences of commands executed by all the players so you can see when units were queued up to be built but you would need to actually run those commands through the simulation to find out when/how many of those queued units were actually built. That’s only possible by viewing the replay with the FAForever.exe. It’s still possible to automate that, I would point you towards the FAForever AI discord since I think some of the AI guys like @maudlin27 have come up with some scripts to automate running a bunch of AI games and analyzing their results. Something similar could probably be done for replays too.
-
The AI development guide linked from the wiki (https://docs.google.com/document/d/1puzW5hKcOBNE7wu7bXj6qXfTJ60r2f93/edit?usp=share_link&ouid=100973959280546778272&rtpof=true&sd=true) gives more details on the AI game automation script created by Softles - essentially it just runs say 8 instances of FAF using different cpu cores to make the process of running lots of AI vs AI games at the same time a bit faster
-
thanks for all this info - It was very easy to get the AI automation script running.
To use this script to anaylse replays could some LUA script get all the existing units and there locations every 10? seconds and dump it to a text file?
And then just modify the script to run replays instead of make new games?
-
@nooby The first part is probably possible, Kazbek faf analysis was doing something similar. You could scroll the entire game directly on the website in 15-30 seconds and units were displayed at yellow dots. The more units in the same area, the bigger the dots. You could basically see map control. But it didn’t distinguish t1 scout and gc in these dots.
However I’m not sure how rebuilding new replay from the old one concept is possible. Let’s say you can dump them into a text file. But can you create replay out of such a text file? That would be much, much harder.
-
@sainserow said in Add a latest replay URL:
@nooby The first part is probably possible, Kazbek faf analysis was doing something similar. You could scroll the entire game directly on the website in 15-30 seconds and units were displayed at yellow dots. The more units in the same area, the bigger the dots. You could basically see map control. But it didn’t distinguish t1 scout and gc in these dots.
I think it was analysing commands, as Askaholic stated, rather than where the units actually were.
I dont understand what you mean by creating a new replay from the old one?
The purpose is to generate unit position, identifcation and time data that can be used to get some insight into the way the game is played with other tools.
-
You can also end all series of commands with an attack move. As an example: if you send out an engineer to build a few extractors you add an attack move command at the end. That way it will reclaim instead of idle as you describe. It won't build extractors though. The engineer also won't show as idle.
I think in general if you feel like your units are idling too much then you're not batch-queueing enough commands. The more commands you queue at a given moment (which usually takes very little to no time) the less often you need to check on the unit :). If you're not aware of it: distributing orders (the hotkey) can also be very useful to quickly batch commands to units with little effort. Especially when you're dealing with many-to-many relationships (many engineers that want to build many extractors)
edit: I think I responded to the wrong topic
edit2: yep: https://forum.faforever.com/topic/7690/question-feedback-before-i-dig-in/13 -
@nooby Yes it's possible to export information to a text file (although it makes things run very slowly depending on how much information you're exporting at once). E.g. I would expect you could modify the FAF files on your local machine (using a copy of the FAF develop repo) to do this when running a replay.
i've not looked into whether it's possible to run replays in the same way that the AI automation script hosts games, but I'd have thought there's a decent chance of coming up with something that will run a replay.
However, it would be a time consuming process to do this for FAF replays in an offline setup in large numbers - e.g. when I want to view a FAF replay offline it means loading the replay through the FAF client, which then creates a temporary (offline compatible) replay file, and then I copy that offline replay file into my offline replays folder, load up FAF in offline mode, and I can then load the replay. It will also either fail to load if I'm using a different FAF exe (major updates often change the exe), or desync if there are differences in the SIM mods (e.g. I've got a more recent version of a SIM mod).
-
-
Thanks for all the info @maudlin27
While I am sure I could figure out some python scripting around launching the faf.exe and replays automatically
The exporting information to a text file is beyond my skillset
Is it possible to run the FAF EXE in a windowless or headless graphics free mode?
Is there a documented list of command line options avalable to the executable? -
@nooby said in Add a latest replay URL:
Is there a documented list of command line options avalable to the executable?
This should get you started: https://wiki.faforever.com/en/Development/Game-Development/Command-Line-Switches