diff --git a/addons/HLNC/Serialization/HLBuffer.cs b/addons/HLNC/Serialization/HLBuffer.cs index 7d267b4..296a2e1 100644 --- a/addons/HLNC/Serialization/HLBuffer.cs +++ b/addons/HLNC/Serialization/HLBuffer.cs @@ -4,6 +4,11 @@ namespace HLNC.Serialization { + /// + /// Standard object used to package data that will be transferred across the network. + /// Used extensively by . + /// + /// public class HLBuffer(byte[] bytes = null) { public byte[] bytes = bytes ?? []; diff --git a/addons/HLNC/Serialization/HLBytes.cs b/addons/HLNC/Serialization/HLBytes.cs index 945cb2b..3ed2ff3 100644 --- a/addons/HLNC/Serialization/HLBytes.cs +++ b/addons/HLNC/Serialization/HLBytes.cs @@ -6,8 +6,16 @@ namespace HLNC.Serialization { + /// + /// Converts variables and Godot variants into binary and vice-versa. is the medium of storage. + /// public class HLBytes { + /// + /// GZip bytes for smaller network packages. + /// + /// + /// public static byte[] Compress(byte[] data) { using (var compressedStream = new MemoryStream()) @@ -20,6 +28,11 @@ public static byte[] Compress(byte[] data) } } + /// + /// Unzip GZipped bytes. + /// + /// + /// public static byte[] Decompress(byte[] data) { using (var compressedStream = new MemoryStream(data)) diff --git a/addons/HLNC/Serialization/Serializers/IStateSerializable.cs b/addons/HLNC/Serialization/Serializers/IStateSerializable.cs index 4826f06..dba82d7 100644 --- a/addons/HLNC/Serialization/Serializers/IStateSerializable.cs +++ b/addons/HLNC/Serialization/Serializers/IStateSerializable.cs @@ -6,11 +6,33 @@ namespace HLNC.Serialization.Serializers { public interface IDeserializedData { }; + + /// + /// Defines an object which the server utilizes to serialize and send data to the client, and the client can then receive and deserialize from the server. + /// public interface IStateSerailizer { + /// + /// Client-side only. Receive and deserialize binary received from the server. + /// + /// + /// + /// public void Import(IPeerController networkState, HLBuffer data, out NetworkNode3D nodeOut); + + /// + /// Server-side only. Serialize and send data to the client. + /// + /// + /// + /// public HLBuffer Export(IPeerController networkState, PeerId peer); public void Acknowledge(IPeerController networkState, PeerId peer, Tick tick); + + /// + /// Client-side only. Useful for data interpolation. + /// + /// public void PhysicsProcess(double delta); public void Cleanup(); }