用测试环压缩osu重放lzma
wtc的Python项目详细描述
世贸中心
wtc是lzma压缩格式的扩展,专门为osu而设计!STD在存储之前会回放更小的内容。它减少了原始.osr格式中某些数据类型的大小,实现了约40%的有损压缩比。
Part | Original lzma datatype | WTC datatype |
---|---|---|
w (ms since preivous frame) | Long (8 bytes) | 24bit Integer (3 bytes) |
x (x-cord) | Float (4 bytes) | Short (2 bytes) |
y (y-cord) | Float (4 bytes) | Short (2 bytes) |
z (bit combination of keypresses) | Integer (4 bytes) | Char (1 byte) |
这会将原来的20字节帧压缩为8字节帧,但并非没有损失。W、X和Y的精度会降低,但Z的精度不会降低,因为按键位组合对于OSU永远不会超过4位!标准。虽然它可能更大的其他游戏模式,如7K躁狂症,这个压缩机是明确的OSU!标准。
WTC压缩平均达到40%?5压缩(不是正式计算的数字-只是根据经验)。
安装:
$ pip install git+git://github.com/osu-anticheat/wtc-lzma-compressor
用法:
importwtc# to compress an lzma bytestringwtc_bytestring=wtc.compress(lzma_bytestring)# to decompress a wtc bytestring into an lzma bytestringlzma_bytestring=wtc.decompress(wtc_bytestring)# compress and decompress are (almost) inverse operations, so lzma_bytestring ≈ wtc.decompress(wtc.compress(lzma_bytestring)).# some precision is lost, so the strings are not identical.