Compressing data with the ENetConnection class
The Godot Engine’s high-level network API includes the ENetConnection
class. This class is available after a connection between peers, such as the server and client, is established. Using ENetConnection
, we can tweak the peer’s connections, allowing us to tell, for instance, the compression method. We can access the ENetConnection
instance after the peers have successfully connected. For that, we can use the ENetMultiplayerPeer.host
property.
There are five available compression methods to use in the ENetConnection
class:
- None, which can be used through the
CompressionMode
enumerator’sCOMPRESS_NONE
option. This is what the documentation says:This uses the most bandwidth but has the upside of requiring the fewest CPU resources. This option may also be used to make network debugging using tools like Wireshark easier.
- ENet’s built-in Range Coder, which can be used through the
CompressionMode
enumerator...