Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress sending data at high score screen #175

Open
Javantea opened this issue May 27, 2024 · 1 comment
Open

Suppress sending data at high score screen #175

Javantea opened this issue May 27, 2024 · 1 comment

Comments

@Javantea
Copy link
Contributor

Looking at the traffic while the player is sitting at the high score screen, I notice a lot of data. By using the binary=0 flag, I am able to see the JSON version of the data that is being sent. It's sending information that can be suppressed to save some bandwidth and processing. This seems like it would have some benefit to players and those trying to debug.

{"gameid":21167,"lines":null,"level":null,"preview":null,
"field":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
"score":null,"T":null,"J":null,"Z":null,"O":null,"S":null,"L":null,"I":null,
"game_type":1,"ctime":12446}
@timotheeg
Copy link
Owner

timotheeg commented Sep 28, 2024

Sorry I missed this ticket 😰

NTC frame representation is very compact at 73 bytes per frame, which means that at the highest level (29), when data is submitted at 60 frames per seconds, a player stream only consumes about 4kb/s.

In high score and menu screen, since when the data is null and static, data frames are sent over the network only every 250ms (i.e. at 4 frames per second), which is 292 bytes per seconds (see code here). Even though the traffic is technically unnecessary, I consider that bandwidth consumption a freshness/keep-alive mechanism, and 292bp/s is negligible.

We could indeed make this smaller or replace sending the frames by sending a ping instead, but I don't think that's very high priority.

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

No branches or pull requests

2 participants