File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -96,3 +96,32 @@ done on replay `8653680` (an almost 50 minute long Seton's game).
9696
9797In this case ` body_ticks ` turned out to be more than 7x faster than using a
9898` Parser ` .
99+
100+ ### Reading .fafreplay files
101+ Replays downloaded from [ faforever.com] ( https://faforever.com ) use a compressed
102+ data format to reduce the size of the files. These can be decompressed to the
103+ original ` .scfareplay ` data using the ` extract_scfa ` function.
104+
105+ ``` python
106+ from fafreplay import extract_scfa
107+
108+
109+ with open (" 12345.scfareplay" , " rb" ) as f:
110+ scfa_data = f.read()
111+
112+ with open (" 12345.fafreplay" , " rb" ) as f:
113+ faf_data = extract_scfa(f)
114+
115+ # The extracted data is in the .scfareplay format
116+ assert faf_data == scfa_data
117+ ```
118+
119+ Note that there are several versions of the ` .fafreplay ` format. Version 1 uses
120+ base64 and zlib compression which are both part of the python standard library.
121+ However, version 2 uses ` zstd ` which must be installed through a third party
122+ package. To ensure that this dependency is installed you can use the ` faf ` extra
123+ when installing the parser:
124+
125+ ```
126+ pip install "faf-replay-parser[faf]"
127+ ```
You can’t perform that action at this time.
0 commit comments