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

Compress large networked entity events #5027

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ElectroJr
Copy link
Contributor

@ElectroJr ElectroJr commented Apr 6, 2024

This PR makes networked EntityEventArgs get automatically compressed if they are over 1024 bytes (game states currently get compressed above 256 bytes). This is probably useful for systems that consistently send easily compressible data (e.g., gas tile overlay), or just send large messages (e.g., some admin/debug overlays).

I'm somewhat unsure about what to do in the case of multi-threaded message sending. RaiseNetworkEvent now takes in an optional ZStdCompressionContext, so callers could use something like the PvsThreadResources pool, but it defaults to using a ThreadLocal<ZStdCompressionContext>.

This PR also removes the EntityMessageType enum, seeing as it was unused, and I'm not sure what it was event meant to be used for.

@PJB3005
Copy link
Member

PJB3005 commented Apr 7, 2024

holy fucking shit sensor monitoring console let's fricking go.

Copy link
Member

@PJB3005 PJB3005 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RaiseNetworkEvent now takes in an optional ZStdCompressionContext

Leaks way too many implementation details and is a weird API. The handle should be some opaque object that can be requested in advance instead.


namespace Robust.Shared.Network;

public abstract class CompressedNetMessage : NetMessage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be an abstract class at all, it only has some helper functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants