Skip to content

feat: count how a peer compressed its first batches - #19

Merged
NaySurGithub merged 1 commit into
mainfrom
feat/batch-traits
Nov 12, 2026
Merged

NaySurGithub merged 1 commit into
mainfrom
feat/batch-traits

Conversation

@NaySurGithub

Copy link
Copy Markdown
Contributor

CompressedNetworkPeer now counts, over the first 64 batches a peer sends, how they were compressed. A server can read the counts with getBatchTraits().

What is counted:

  • batches compressed although shorter than the threshold the peer was given
  • batches in an algorithm other than the one it was told to use
  • deflate batches whose bytes differ from what the game's compressor writes for the same content

The game's sender (sub_1404C8960 in the 1.26.60 client) sends a batch below the threshold as it is, and deflates the others raw at level 7 with memory level 8, in one call (sub_140734E70), with stock zlib 1.3.1.

The comparison only runs when the local zlib writes the reference bytes for a fixed input, so a drop-in replacement such as zlib-ng turns it off instead of giving wrong counts. zlib 1.2.12 and 1.3.1 were both checked against that input. Batches over 256 KiB are not compared.

Limit: zlib at a neighbouring level (6) often writes the same bytes as level 7, so this mostly tells other deflate implementations apart.

New test batch-traits. I ran it against the library built in Falcon's tree, not through this repository's own CMake.

AI disclosure

Written by Claude Fable 5.2 (research in the client with IDA, code, test).

@falcon-actions

Copy link
Copy Markdown

Falcon rules

1 warning(s)

Rule Where Line
Function body on one line include/Network/CompressedNetworkPeer.h:37 const BatchTraits &getBatchTraits() const { return mBatchTraits; }

@NaySurGithub
NaySurGithub merged commit 6510c22 into main Nov 12, 2026
1 of 3 checks passed
@NaySurGithub
NaySurGithub deleted the feat/batch-traits branch November 12, 2026 17:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant