Some classes for syncing entity state changes. Similar to the NetworkEvents in the old netcode, but the logic is split into separate classes which prevent the server from reading updates for entities that aren't IClientSerializable.
todo: add NetEntityEventManagers to server & client, some logic to prevent sending events that don't need to be sent (e.g. duplicate event state updates)
This commit is contained in:
@@ -3,25 +3,27 @@ using Lidgren.Network;
|
||||
|
||||
namespace Barotrauma.Networking
|
||||
{
|
||||
interface INetSerializable { }
|
||||
|
||||
/// <summary>
|
||||
/// Interface for entities that the clients can send information of to the server
|
||||
/// </summary>
|
||||
interface IClientSerializable
|
||||
interface IClientSerializable : INetSerializable
|
||||
{
|
||||
UInt32 NetStateID { get; }
|
||||
|
||||
void ClientWrite(NetOutgoingMessage msg);
|
||||
void ClientWrite(NetBuffer msg);
|
||||
void ServerRead(NetIncomingMessage msg, Client c);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Interface for entities that the server can send information of to the clients
|
||||
/// </summary>
|
||||
interface IServerSerializable
|
||||
interface IServerSerializable : INetSerializable
|
||||
{
|
||||
UInt32 NetStateID { get; }
|
||||
|
||||
void ServerWrite(NetOutgoingMessage msg, Client c);
|
||||
void ServerWrite(NetBuffer msg, Client c);
|
||||
void ClientRead(NetIncomingMessage msg, float sendingTime);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user