ultimate-research / ssbh_lib

Reading and writing SSBH file formats in Rust
MIT License
8 stars 3 forks source link

perfectly preserve animation data on export #105

Open ScanMountGoat opened 2 years ago

ScanMountGoat commented 2 years ago

Anim files after version 2.0 use lossy compression for certain tracks, which can cause desyncs in some games when used online if one the player's files is slightly modified. It's unclear if there is a reasonable way to achieve this given the current API design. ssbh_data considers anim compression settings to be an implementation detail, so ssbh_data_py also has no way of producing binary identical output.

It's unclear if the issue is the output not being binary identical or compressing at a lower quality setting than the original. It's possible to compute the error as a function of min, max, and bit_count. This function is not well behaved across its range of inputs, so there's no straightforward way to determine the optimal compression setting.

While not guaranteed, the compression <-> decompression process is 1:1 for floats in practice. This could be doable if the original compression settings were preserved. Attempts to modify the data would potentially require recalculating the correct compression settings.