Compare commits

..

2 Commits

Author SHA1 Message Date
edmand46 b39bd8bd0a fix: updated workflows 2024-04-14 19:23:08 +03:00
edmand46 12b80c546c fix: updated workflows 2024-04-14 19:14:57 +03:00
34 changed files with 60 additions and 620 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ jobs:
- name: Setup dotnet - name: Setup dotnet
uses: actions/setup-dotnet@v1 uses: actions/setup-dotnet@v1
with: with:
dotnet-version: 7.0.x dotnet-version: 8.0.x
- name: Build - name: Build
shell: bash shell: bash
run: | run: |
@@ -55,6 +55,7 @@ namespace Ragon.Client
public ushort Id { get; private set; } public ushort Id { get; private set; }
public ushort Type { get; private set; } public ushort Type { get; private set; }
public RagonAuthority Authority { get; private set; } public RagonAuthority Authority { get; private set; }
public RagonPlayer Owner { get; private set; } public RagonPlayer Owner { get; private set; }
public RagonEntityState State { get; private set; } public RagonEntityState State { get; private set; }
@@ -1,52 +0,0 @@
/*
* Copyright 2024 Eduard Kargin <kargin.eduard@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using Ragon.Protocol;
namespace Ragon.Client
{
internal class PlayerUserDataHandler: IHandler
{
private RagonPlayerCache _playerCache;
private RagonListenerList _listenerList;
public PlayerUserDataHandler(
RagonPlayerCache playerCache,
RagonListenerList listenerList
)
{
_playerCache = playerCache;
_listenerList = listenerList;
}
public void Handle(RagonBuffer reader)
{
var playerPeerId = reader.ReadUShort();
var player = _playerCache.GetPlayerByPeer(playerPeerId);
if (player != null)
{
player.UserData.Read(reader);
_listenerList.OnPlayerUserData(player);
return;
}
RagonLog.Warn("Received user data for unknown player.");
}
}
}
@@ -50,6 +50,6 @@ public class RoomEventHandler : IHandler
if (player.IsLocal && executionMode == RagonReplicationMode.LocalAndServer) if (player.IsLocal && executionMode == RagonReplicationMode.LocalAndServer)
return; return;
_client.Room.HandleEvent(eventCode, player, buffer); _client.Room.Event(eventCode, player, buffer);
} }
} }
@@ -1,38 +0,0 @@
/*
* Copyright 2024 Eduard Kargin <kargin.eduard@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using Ragon.Protocol;
namespace Ragon.Client
{
internal class RoomUserDataHandler : IHandler
{
private readonly RagonClient _client;
private readonly RagonListenerList _listenerList;
public RoomUserDataHandler(RagonClient client, RagonListenerList listenerList)
{
_client = client;
_listenerList = listenerList;
}
public void Handle(RagonBuffer reader)
{
_client.Room?.HandleUserData(reader);
_listenerList.OnRoomUserData();
}
}
}
-27
View File
@@ -1,27 +0,0 @@
/*
* Copyright 2024 Eduard Kargin <kargin.eduard@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using Ragon.Protocol;
namespace Ragon.Client;
public interface IUserData
{
public byte[] this[string key] { get; set; }
bool Dirty { get; }
void Read(RagonBuffer buffer);
void Write(RagonBuffer buffer);
}
@@ -25,10 +25,7 @@ namespace Ragon.Client
IRagonSceneListener, IRagonSceneListener,
IRagonOwnershipChangedListener, IRagonOwnershipChangedListener,
IRagonPlayerJoinListener, IRagonPlayerJoinListener,
IRagonPlayerLeftListener, IRagonPlayerLeftListener
IRagonRoomListListener,
IRagonRoomUserDataListener,
IRagonPlayerUserDataListener
{ {
} }
@@ -1,22 +0,0 @@
/*
* Copyright 2023 Eduard Kargin <kargin.eduard@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace Ragon.Client;
public interface IRagonPlayerUserDataListener
{
void OnPlayerUserDataUpdated(RagonClient client, RagonPlayer player);
}
@@ -1,6 +0,0 @@
namespace Ragon.Client;
public interface IRagonRoomUserDataListener
{
public void OnUserDataUpdated(RagonClient client);
}
+8 -53
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2023-2024 Eduard Kargin <kargin.eduard@gmail.com> * Copyright 2023 Eduard Kargin <kargin.eduard@gmail.com>
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -98,37 +98,31 @@ namespace Ragon.Client
_writeBuffer = new RagonBuffer(); _writeBuffer = new RagonBuffer();
_readBuffer = new RagonBuffer(); _readBuffer = new RagonBuffer();
_playerCache = new RagonPlayerCache();
_session = new RagonSession(this, _writeBuffer); _session = new RagonSession(this, _writeBuffer);
_playerCache = new RagonPlayerCache();
_entityCache = new RagonEntityCache(this, _playerCache, _sceneCollector); _entityCache = new RagonEntityCache(this, _playerCache, _sceneCollector);
_handlers = new IHandler[byte.MaxValue]; _handlers = new IHandler[byte.MaxValue];
_handlers[(byte)RagonOperation.AUTHORIZED_SUCCESS] = new AuthorizeSuccessHandler(this, _listeners); _handlers[(byte)RagonOperation.AUTHORIZED_SUCCESS] = new AuthorizeSuccessHandler(this, _listeners);
_handlers[(byte)RagonOperation.AUTHORIZED_FAILED] = new AuthorizeFailedHandler(_listeners); _handlers[(byte)RagonOperation.AUTHORIZED_FAILED] = new AuthorizeFailedHandler(_listeners);
_handlers[(byte)RagonOperation.JOIN_SUCCESS] = _handlers[(byte)RagonOperation.JOIN_SUCCESS] = new JoinSuccessHandler(this, _listeners, _playerCache, _entityCache);
new JoinSuccessHandler(this, _listeners, _playerCache, _entityCache);
_handlers[(byte)RagonOperation.JOIN_FAILED] = new JoinFailedHandler(_listeners); _handlers[(byte)RagonOperation.JOIN_FAILED] = new JoinFailedHandler(_listeners);
_handlers[(byte)RagonOperation.LEAVE_ROOM] = new LeaveRoomHandler(this, _listeners, _entityCache); _handlers[(byte)RagonOperation.LEAVE_ROOM] = new LeaveRoomHandler(this, _listeners, _entityCache);
_handlers[(byte)RagonOperation.OWNERSHIP_ROOM_CHANGED] = _handlers[(byte)RagonOperation.OWNERSHIP_ROOM_CHANGED] = new OwnershipRoomHandler(_listeners, _playerCache, _entityCache);
new OwnershipRoomHandler(_listeners, _playerCache, _entityCache); _handlers[(byte)RagonOperation.OWNERSHIP_ENTITY_CHANGED] = new EntityOwnershipHandler(_listeners, _playerCache, _entityCache);
_handlers[(byte)RagonOperation.OWNERSHIP_ENTITY_CHANGED] =
new EntityOwnershipHandler(_listeners, _playerCache, _entityCache);
_handlers[(byte)RagonOperation.PLAYER_JOINED] = new PlayerJoinHandler(_playerCache, _listeners); _handlers[(byte)RagonOperation.PLAYER_JOINED] = new PlayerJoinHandler(_playerCache, _listeners);
_handlers[(byte)RagonOperation.PLAYER_LEAVED] = new PlayerLeftHandler(_entityCache, _playerCache, _listeners); _handlers[(byte)RagonOperation.PLAYER_LEAVED] = new PlayerLeftHandler(_entityCache, _playerCache, _listeners);
_handlers[(byte)RagonOperation.LOAD_SCENE] = new SceneLoadHandler(this, _listeners); _handlers[(byte)RagonOperation.LOAD_SCENE] = new SceneLoadHandler(this, _listeners);
_handlers[(byte)RagonOperation.CREATE_ENTITY] = _handlers[(byte)RagonOperation.CREATE_ENTITY] = new EntityCreateHandler(this, _playerCache, _entityCache, _entityListener);
new EntityCreateHandler(this, _playerCache, _entityCache, _entityListener);
_handlers[(byte)RagonOperation.REMOVE_ENTITY] = new EntityRemoveHandler(_entityCache); _handlers[(byte)RagonOperation.REMOVE_ENTITY] = new EntityRemoveHandler(_entityCache);
_handlers[(byte)RagonOperation.REPLICATE_ENTITY_STATE] = new StateEntityHandler(_entityCache); _handlers[(byte)RagonOperation.REPLICATE_ENTITY_STATE] = new StateEntityHandler(_entityCache);
_handlers[(byte)RagonOperation.REPLICATE_ENTITY_EVENT] = new EntityEventHandler(_playerCache, _entityCache); _handlers[(byte)RagonOperation.REPLICATE_ENTITY_EVENT] = new EntityEventHandler(_playerCache, _entityCache);
_handlers[(byte)RagonOperation.REPLICATE_ROOM_EVENT] = new RoomEventHandler(this, _playerCache); _handlers[(byte)RagonOperation.REPLICATE_ROOM_EVENT] = new RoomEventHandler(this, _playerCache);
_handlers[(byte)RagonOperation.SNAPSHOT] = _handlers[(byte)RagonOperation.SNAPSHOT] = new SnapshotHandler(this, _listeners, _entityCache, _playerCache, _entityListener);
new SnapshotHandler(this, _listeners, _entityCache, _playerCache, _entityListener);
_handlers[(byte)RagonOperation.TIMESTAMP_SYNCHRONIZATION] = new TimestampHandler(this); _handlers[(byte)RagonOperation.TIMESTAMP_SYNCHRONIZATION] = new TimestampHandler(this);
_handlers[(byte)RagonOperation.REPLICATE_RAW_DATA] = new RoomDataHandler(_playerCache, _listeners); _handlers[(byte)RagonOperation.REPLICATE_RAW_DATA] = new RoomDataHandler(_playerCache, _listeners);
_handlers[(byte)RagonOperation.ROOM_LIST_UPDATED] = new RoomListHandler(_session, _listeners); _handlers[(byte)RagonOperation.ROOM_LIST_UPDATED] = new RoomListHandler(_session, _listeners);
_handlers[(byte)RagonOperation.ROOM_DATA_UPDATED] = new RoomUserDataHandler(this, _listeners);
_handlers[(byte)RagonOperation.PLAYER_DATA_UPDATED] = new PlayerUserDataHandler(_playerCache, _listeners);
var protocolRaw = RagonVersion.Parse(protocol); var protocolRaw = RagonVersion.Parse(protocol);
_connection.Connect(address, port, protocolRaw); _connection.Connect(address, port, protocolRaw);
@@ -154,8 +148,6 @@ namespace Ragon.Client
_entityCache.WriteState(_writeBuffer); _entityCache.WriteState(_writeBuffer);
SendTimestamp(); SendTimestamp();
SendRoomUserData();
SendPlayerUserData();
} }
_stats.Update(_connection.BytesSent, _connection.BytesReceived, _connection.Ping, dt); _stats.Update(_connection.BytesSent, _connection.BytesReceived, _connection.Ping, dt);
@@ -172,7 +164,6 @@ namespace Ragon.Client
_status = RagonStatus.DISCONNECTED; _status = RagonStatus.DISCONNECTED;
_connection.Disconnect(); _connection.Disconnect();
} }
_connection.Dispose(); _connection.Dispose();
} }
@@ -189,8 +180,6 @@ namespace Ragon.Client
public void AddListener(IRagonSceneRequestListener listener) => _listeners.Add(listener); public void AddListener(IRagonSceneRequestListener listener) => _listeners.Add(listener);
public void AddListener(IRagonDataListener listener) => _listeners.Add(listener); public void AddListener(IRagonDataListener listener) => _listeners.Add(listener);
public void AddListener(IRagonRoomListListener listener) => _listeners.Add(listener); public void AddListener(IRagonRoomListListener listener) => _listeners.Add(listener);
public void AddListener(IRagonPlayerUserDataListener listener) => _listeners.Add(listener);
public void AddListener(IRagonRoomUserDataListener listener) => _listeners.Add(listener);
public void RemoveListener(IRagonListener listener) => _listeners.Remove(listener); public void RemoveListener(IRagonListener listener) => _listeners.Remove(listener);
public void RemoveListener(IRagonAuthorizationListener listener) => _listeners.Remove(listener); public void RemoveListener(IRagonAuthorizationListener listener) => _listeners.Remove(listener);
public void RemoveListener(IRagonConnectionListener listener) => _listeners.Remove(listener); public void RemoveListener(IRagonConnectionListener listener) => _listeners.Remove(listener);
@@ -204,8 +193,6 @@ namespace Ragon.Client
public void RemoveListener(IRagonSceneRequestListener listener) => _listeners.Remove(listener); public void RemoveListener(IRagonSceneRequestListener listener) => _listeners.Remove(listener);
public void RemoveListener(IRagonDataListener listener) => _listeners.Remove(listener); public void RemoveListener(IRagonDataListener listener) => _listeners.Remove(listener);
public void RemoveListener(IRagonRoomListListener listener) => _listeners.Remove(listener); public void RemoveListener(IRagonRoomListListener listener) => _listeners.Remove(listener);
public void RemoveListener(IRagonRoomUserDataListener listener) => _listeners.Remove(listener);
public void RemoveListener(IRagonPlayerUserDataListener listener) => _listeners.Remove(listener);
#endregion #endregion
@@ -245,38 +232,6 @@ namespace Ragon.Client
_writeBuffer.Write(value.Int1, 32); _writeBuffer.Write(value.Int1, 32);
} }
private void SendRoomUserData()
{
if (_room == null) return;
var props = _room.UserData;
if (!props.Dirty) return;
_writeBuffer.Clear();
_writeBuffer.WriteOperation(RagonOperation.ROOM_DATA_UPDATED);
props.Write(_writeBuffer);
var sendData = _writeBuffer.ToArray();
_connection.Reliable.Send(sendData);
}
private void SendPlayerUserData()
{
if (_playerCache.Local == null) return;
var props = _playerCache.Local.UserData;
if (!props.Dirty) return;
_writeBuffer.Clear();
_writeBuffer.WriteOperation(RagonOperation.PLAYER_DATA_UPDATED);
props.Write(_writeBuffer);
var sendData = _writeBuffer.ToArray();
_connection.Reliable.Send(sendData);
}
private void OnConnected() private void OnConnected()
{ {
RagonLog.Trace("Connected"); RagonLog.Trace("Connected");
+1 -39
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2023-2024 Eduard Kargin <kargin.eduard@gmail.com> * Copyright 2023 Eduard Kargin <kargin.eduard@gmail.com>
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -33,8 +33,6 @@ namespace Ragon.Client
private readonly List<IRagonPlayerLeftListener> _playerLeftListeners = new(); private readonly List<IRagonPlayerLeftListener> _playerLeftListeners = new();
private readonly List<IRagonDataListener> _dataListeners = new(); private readonly List<IRagonDataListener> _dataListeners = new();
private readonly List<IRagonRoomListListener> _roomListListeners = new(); private readonly List<IRagonRoomListListener> _roomListListeners = new();
private readonly List<IRagonRoomUserDataListener> _roomUserDataListeners = new();
private readonly List<IRagonPlayerUserDataListener> _playerUserDataListeners = new();
private readonly List<Action> _delayedActions = new(); private readonly List<Action> _delayedActions = new();
public RagonListenerList(RagonClient client) public RagonListenerList(RagonClient client)
@@ -53,8 +51,6 @@ namespace Ragon.Client
_ownershipChangedListeners.Add(listener); _ownershipChangedListeners.Add(listener);
_playerJoinListeners.Add(listener); _playerJoinListeners.Add(listener);
_playerLeftListeners.Add(listener); _playerLeftListeners.Add(listener);
_roomUserDataListeners.Add(listener);
_playerUserDataListeners.Add(listener);
} }
public void Remove(IRagonListener listener) public void Remove(IRagonListener listener)
@@ -70,8 +66,6 @@ namespace Ragon.Client
_ownershipChangedListeners.Remove(listener); _ownershipChangedListeners.Remove(listener);
_playerJoinListeners.Remove(listener); _playerJoinListeners.Remove(listener);
_playerLeftListeners.Remove(listener); _playerLeftListeners.Remove(listener);
_roomUserDataListeners.Remove(listener);
_playerUserDataListeners.Remove(listener);
}); });
} }
@@ -143,16 +137,6 @@ namespace Ragon.Client
_roomListListeners.Add(listener); _roomListListeners.Add(listener);
} }
public void Add(IRagonRoomUserDataListener listener)
{
_roomUserDataListeners.Add(listener);
}
public void Add(IRagonPlayerUserDataListener listener)
{
_playerUserDataListeners.Add(listener);
}
public void Remove(IRagonDataListener listener) public void Remove(IRagonDataListener listener)
{ {
_delayedActions.Add(() => _dataListeners.Remove(listener)); _delayedActions.Add(() => _dataListeners.Remove(listener));
@@ -213,16 +197,6 @@ namespace Ragon.Client
_delayedActions.Add(() => _roomListListeners.Remove(listener)); _delayedActions.Add(() => _roomListListeners.Remove(listener));
} }
public void Remove(IRagonRoomUserDataListener listener)
{
_delayedActions.Add(() => _roomUserDataListeners.Remove(listener));
}
public void Remove(IRagonPlayerUserDataListener listener)
{
_delayedActions.Add(() => _playerUserDataListeners.Remove(listener));
}
public void OnAuthorizationSuccess(string playerId, string playerName, string payload) public void OnAuthorizationSuccess(string playerId, string playerName, string payload)
{ {
foreach (var listener in _authorizationListeners) foreach (var listener in _authorizationListeners)
@@ -306,17 +280,5 @@ namespace Ragon.Client
foreach (var listListener in _roomListListeners) foreach (var listListener in _roomListListeners)
listListener.OnRoomListUpdate(roomInfos); listListener.OnRoomListUpdate(roomInfos);
} }
public void OnRoomUserData()
{
foreach (var userDataListener in _roomUserDataListeners)
userDataListener.OnUserDataUpdated(_client);
}
public void OnPlayerUserData(RagonPlayer player)
{
foreach(var playerUserDataListener in _playerUserDataListeners)
playerUserDataListener.OnPlayerUserDataUpdated(_client, player);
}
} }
} }
+1 -3
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2023-2024 Eduard Kargin <kargin.eduard@gmail.com> * Copyright 2023 Eduard Kargin <kargin.eduard@gmail.com>
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -24,7 +24,6 @@ namespace Ragon.Client
public ushort PeerId { get; set; } public ushort PeerId { get; set; }
public bool IsRoomOwner { get; set; } public bool IsRoomOwner { get; set; }
public bool IsLocal { get; set; } public bool IsLocal { get; set; }
public IUserData UserData { get; private set; }
public RagonPlayer(ushort peerId, string playerId, string name, bool isRoomOwner, bool isLocal) public RagonPlayer(ushort peerId, string playerId, string name, bool isRoomOwner, bool isLocal)
{ {
@@ -33,7 +32,6 @@ namespace Ragon.Client
IsLocal = isLocal; IsLocal = isLocal;
Name = name; Name = name;
Id = playerId; Id = playerId;
UserData = isLocal ? new RagonUserData() : new RagonUserDataReadOnly();
} }
} }
} }
+1 -1
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2023-2024 Eduard Kargin <kargin.eduard@gmail.com> * Copyright 2023 Eduard Kargin <kargin.eduard@gmail.com>
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
+11 -27
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2023-2024 Eduard Kargin <kargin.eduard@gmail.com> * Copyright 2023 Eduard Kargin <kargin.eduard@gmail.com>
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@@ -49,12 +49,11 @@ namespace Ragon.Client
private delegate void OnEventDelegate(RagonPlayer player, RagonBuffer serializer); private delegate void OnEventDelegate(RagonPlayer player, RagonBuffer serializer);
private readonly RagonClient _client; private RagonClient _client;
private readonly RagonScene _scene; private RagonScene _scene;
private readonly RagonEntityCache _entityCache; private RagonEntityCache _entityCache;
private readonly RagonPlayerCache _playerCache; private RagonPlayerCache _playerCache;
private readonly RoomParameters _parameters; private RoomParameters _parameters;
private readonly RagonUserData _userData;
public string Id => _parameters.RoomId; public string Id => _parameters.RoomId;
public int MinPlayers => _parameters.Min; public int MinPlayers => _parameters.Min;
@@ -64,15 +63,10 @@ namespace Ragon.Client
public IReadOnlyList<RagonPlayer> Players => _playerCache.Players; public IReadOnlyList<RagonPlayer> Players => _playerCache.Players;
public RagonPlayer Local => _playerCache.Local; public RagonPlayer Local => _playerCache.Local;
public RagonPlayer Owner => _playerCache.Owner; public RagonPlayer Owner => _playerCache.Owner;
public RagonUserData UserData => _userData;
private readonly Dictionary<int, OnEventDelegate> _events = new Dictionary<int, OnEventDelegate>(); private readonly Dictionary<int, OnEventDelegate> _events = new Dictionary<int, OnEventDelegate>();
private readonly Dictionary<int, List<Action<RagonPlayer, IRagonEvent>>> _localListeners = new Dictionary<int, List<Action<RagonPlayer, IRagonEvent>>>();
private readonly Dictionary<int, List<Action<RagonPlayer, IRagonEvent>>> _localListeners = private readonly Dictionary<int, List<Action<RagonPlayer, IRagonEvent>>> _listeners = new Dictionary<int, List<Action<RagonPlayer, IRagonEvent>>>();
new Dictionary<int, List<Action<RagonPlayer, IRagonEvent>>>();
private readonly Dictionary<int, List<Action<RagonPlayer, IRagonEvent>>> _listeners =
new Dictionary<int, List<Action<RagonPlayer, IRagonEvent>>>();
public RagonRoom(RagonClient client, public RagonRoom(RagonClient client,
RagonEntityCache entityCache, RagonEntityCache entityCache,
@@ -85,7 +79,6 @@ namespace Ragon.Client
_entityCache = entityCache; _entityCache = entityCache;
_playerCache = playerCache; _playerCache = playerCache;
_scene = scene; _scene = scene;
_userData = new RagonUserData();
} }
internal void Cleanup() internal void Cleanup()
@@ -99,7 +92,7 @@ namespace Ragon.Client
_scene.Update(sceneName); _scene.Update(sceneName);
} }
internal void HandleEvent(ushort eventCode, RagonPlayer caller, RagonBuffer buffer) internal void Event(ushort eventCode, RagonPlayer caller, RagonBuffer buffer)
{ {
if (_events.TryGetValue(eventCode, out var evnt)) if (_events.TryGetValue(eventCode, out var evnt))
evnt?.Invoke(caller, buffer); evnt?.Invoke(caller, buffer);
@@ -107,11 +100,6 @@ namespace Ragon.Client
RagonLog.Warn($"Handler event on entity {Id} with eventCode {eventCode} not defined"); RagonLog.Warn($"Handler event on entity {Id} with eventCode {eventCode} not defined");
} }
internal void HandleUserData(RagonBuffer buffer)
{
_userData.Read(buffer);
}
public IDisposable OnEvent<TEvent>(Action<RagonPlayer, TEvent> callback) where TEvent : IRagonEvent, new() public IDisposable OnEvent<TEvent>(Action<RagonPlayer, TEvent> callback) where TEvent : IRagonEvent, new()
{ {
var t = new TEvent(); var t = new TEvent();
@@ -150,12 +138,8 @@ namespace Ragon.Client
public void LoadScene(string sceneName) => _scene.Load(sceneName); public void LoadScene(string sceneName) => _scene.Load(sceneName);
public void SceneLoaded() => _scene.SceneLoaded(); public void SceneLoaded() => _scene.SceneLoaded();
public void ReplicateEvent<TEvent>(TEvent evnt, RagonTarget target, RagonReplicationMode mode) public void ReplicateEvent<TEvent>(TEvent evnt, RagonTarget target, RagonReplicationMode mode) where TEvent : IRagonEvent, new() => _scene.ReplicateEvent(evnt, target, mode);
where TEvent : IRagonEvent, new() => _scene.ReplicateEvent(evnt, target, mode); public void ReplicateEvent<TEvent>(TEvent evnt, RagonPlayer target, RagonReplicationMode mode) where TEvent : IRagonEvent, new() => _scene.ReplicateEvent(evnt, target, mode);
public void ReplicateEvent<TEvent>(TEvent evnt, RagonPlayer target, RagonReplicationMode mode)
where TEvent : IRagonEvent, new() => _scene.ReplicateEvent(evnt, target, mode);
public void ReplicateData(byte[] data, bool reliable = false) => _scene.ReplicateData(data, reliable); public void ReplicateData(byte[] data, bool reliable = false) => _scene.ReplicateData(data, reliable);
public void CreateEntity(RagonEntity entity) => CreateEntity(entity, null); public void CreateEntity(RagonEntity entity) => CreateEntity(entity, null);
-70
View File
@@ -1,70 +0,0 @@
/*
* Copyright 2024 Eduard Kargin <kargin.eduard@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using Ragon.Protocol;
namespace Ragon.Client
{
public class RagonUserData: IUserData
{
public byte[] this[string key]
{
get => _properties[key];
set
{
_properties[key] = value;
_dirty = true;
}
}
public bool Dirty => _dirty;
private bool _dirty = false;
private readonly Dictionary<string, byte[]> _properties = new();
public RagonUserData()
{
}
public void Read(RagonBuffer buffer)
{
_properties.Clear();
var len = buffer.ReadUShort();
for (int i = 0; i < len; i++)
{
var key = buffer.ReadString();
var valueSize = buffer.ReadUShort();
var value = buffer.ReadBytes(valueSize);
_properties[key] = value;
}
}
public void Write(RagonBuffer buffer)
{
buffer.WriteUShort((ushort)_properties.Count);
foreach (var property in _properties)
{
buffer.WriteString(property.Key);
buffer.WriteUShort((ushort) property.Value.Length);
buffer.WriteBytes(property.Value);
}
_dirty = false;
}
}
}
@@ -1,65 +0,0 @@
/*
* Copyright 2024 Eduard Kargin <kargin.eduard@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using Ragon.Protocol;
namespace Ragon.Client;
public class RagonUserDataReadOnly : IUserData
{
public byte[] this[string key]
{
get => _properties[key];
set { }
}
public bool Dirty => _dirty;
private bool _dirty = false;
private readonly Dictionary<string, byte[]> _properties = new();
public RagonUserDataReadOnly()
{
}
public void Write(RagonBuffer buffer)
{
buffer.WriteUShort((ushort)_properties.Count);
foreach (var property in _properties)
{
buffer.WriteString(property.Key);
buffer.WriteUShort((ushort)property.Value.Length);
buffer.WriteBytes(property.Value);
}
_dirty = false;
}
public void Read(RagonBuffer buffer)
{
_properties.Clear();
var len = buffer.ReadUShort();
for (int i = 0; i < len; i++)
{
var key = buffer.ReadString();
var valueSize = buffer.ReadUShort();
var value = buffer.ReadBytes(valueSize);
_properties[key] = value;
}
}
}
-1
View File
@@ -283,7 +283,6 @@ namespace Ragon.Protocol
_write += numBits; _write += numBits;
} }
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public uint Read(int numBits = 16) public uint Read(int numBits = 16)
{ {
-2
View File
@@ -45,7 +45,5 @@ namespace Ragon.Protocol
TRANSFER_ENTITY_OWNERSHIP = 24, TRANSFER_ENTITY_OWNERSHIP = 24,
TIMESTAMP_SYNCHRONIZATION = 25, TIMESTAMP_SYNCHRONIZATION = 25,
ROOM_LIST_UPDATED = 26, ROOM_LIST_UPDATED = 26,
PLAYER_DATA_UPDATED = 27,
ROOM_DATA_UPDATED = 28,
} }
} }
+1 -1
View File
@@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<RootNamespace>Ragon.Relay</RootNamespace> <RootNamespace>Ragon.Relay</RootNamespace>
<TargetFrameworks>net7.0;net8.0</TargetFrameworks> <TargetFramework>net8.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
-1
View File
@@ -10,7 +10,6 @@
"limitPlayersPerRoom": 20, "limitPlayersPerRoom": 20,
"limitRooms": 200, "limitRooms": 200,
"limitBufferedEvents": 50, "limitBufferedEvents": 50,
"limitUserData": 1024,
"webHooks": "webHooks":
{ {
"room-created": "http://127.0.0.1:3000/service/create-room", "room-created": "http://127.0.0.1:3000/service/create-room",
-23
View File
@@ -1,23 +0,0 @@
using Ragon.Protocol;
namespace Ragon.Server.Data;
public class RagonData
{
private byte[] _data;
public bool IsDirty { get; set; }
public byte[] Data
{
get => _data;
set
{
_data = value;
IsDirty = true;
}
}
public RagonData(byte[] data)
{
_data = data;
}
}
@@ -29,19 +29,16 @@ public sealed class AuthorizationOperation: BaseOperation
private readonly RagonWebHookPlugin _webhook; private readonly RagonWebHookPlugin _webhook;
private readonly RagonContextObserver _observer; private readonly RagonContextObserver _observer;
private readonly RagonBuffer _writer; private readonly RagonBuffer _writer;
private readonly RagonServerConfiguration _configuration;
public AuthorizationOperation( public AuthorizationOperation(
RagonBuffer reader, RagonBuffer reader,
RagonBuffer writer, RagonBuffer writer,
RagonWebHookPlugin webhook, RagonWebHookPlugin webhook,
RagonContextObserver observer, RagonContextObserver observer): base(reader, writer)
RagonServerConfiguration configuration): base(reader, writer)
{ {
_webhook = webhook; _webhook = webhook;
_observer = observer; _observer = observer;
_writer = writer; _writer = writer;
_configuration = configuration;
} }
public override void Handle(RagonContext context, NetworkChannel channel) public override void Handle(RagonContext context, NetworkChannel channel)
@@ -58,7 +55,7 @@ public sealed class AuthorizationOperation: BaseOperation
return; return;
} }
var configuration = _configuration; var configuration = context.Configuration;
var key = Reader.ReadString(); var key = Reader.ReadString();
var name = Reader.ReadString(); var name = Reader.ReadString();
var payload = Reader.ReadString(); var payload = Reader.ReadString();
@@ -44,7 +44,7 @@ public sealed class EntityCreateOperation : BaseOperation
Authority = eventAuthority, Authority = eventAuthority,
AttachId = attachId, AttachId = attachId,
StaticId = 0, StaticId = 0,
BufferedEvents = context.LimitBufferedEvents, BufferedEvents = context.Configuration.LimitBufferedEvents,
}; };
var entity = new RagonEntity(entityParameters); var entity = new RagonEntity(entityParameters);
@@ -1,40 +0,0 @@
using NLog;
using Ragon.Protocol;
using Ragon.Server.IO;
using Ragon.Server.Lobby;
namespace Ragon.Server.Handler
{
public class PlayerUserDataOperation : BaseOperation
{
private readonly ILogger _logger = LogManager.GetCurrentClassLogger();
private readonly int _userDataLimit;
public PlayerUserDataOperation(
RagonBuffer reader,
RagonBuffer writer,
int userDataLimit
) : base(reader, writer)
{
_userDataLimit = userDataLimit;
}
public override void Handle(RagonContext context, NetworkChannel channel)
{
if (context.ConnectionStatus == ConnectionStatus.Unauthorized)
{
_logger.Warn($"Player {context.Connection.Id} not authorized for this request");
return;
}
var playerUserData = Reader.ReadBytes(Reader.Capacity);
if (playerUserData.Length > _userDataLimit)
{
_logger.Warn($"Player {context.Connection.Id} exceeded user data limit");
return;
}
context.UserData.Data = playerUserData;
}
}
}
@@ -1,57 +0,0 @@
/*
* Copyright 2023 Eduard Kargin <kargin.eduard@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using NLog;
using Ragon.Protocol;
using Ragon.Server.IO;
using Ragon.Server.Lobby;
namespace Ragon.Server.Handler;
public sealed class RoomUserDataOperation : BaseOperation
{
private readonly ILogger _logger = LogManager.GetCurrentClassLogger();
private readonly int _userDataLimit;
public RoomUserDataOperation(
RagonBuffer reader,
RagonBuffer writer,
int userDataLimit
) : base(reader, writer)
{
_userDataLimit = userDataLimit;
}
public override void Handle(RagonContext context, NetworkChannel channel)
{
if (context.ConnectionStatus == ConnectionStatus.Unauthorized)
{
_logger.Warn($"Player {context.Connection.Id} not authorized for this request");
return;
}
var roomUserData = Reader.ReadBytes(Reader.Capacity);
if (roomUserData.Length > _userDataLimit)
{
_logger.Warn("Room user data is too big");
return;
}
var room = context.Room;
if (room != null)
room.UserData.Data = roomUserData;
}
}
@@ -62,7 +62,7 @@ public sealed class SceneLoadedOperation : BaseOperation
Authority = eventAuthority, Authority = eventAuthority,
AttachId = 0, AttachId = 0,
StaticId = staticId, StaticId = staticId,
BufferedEvents = context.LimitBufferedEvents, BufferedEvents = context.Configuration.LimitBufferedEvents,
}; };
var entity = new RagonEntity(entityParameters); var entity = new RagonEntity(entityParameters);
@@ -14,7 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
using Ragon.Server.Data;
using Ragon.Server.IO; using Ragon.Server.IO;
namespace Ragon.Server.Lobby; namespace Ragon.Server.Lobby;
@@ -37,7 +36,7 @@ public class RagonLobbyPlayer
{ {
Id = id; Id = id;
Name = name; Name = name;
Connection = connection;
Payload = payload; Payload = payload;
Connection = connection;
} }
} }
@@ -16,7 +16,6 @@
using System.Net; using System.Net;
using System.Net.Http.Json; using System.Net.Http.Json;
using System.Text;
using Newtonsoft.Json; using Newtonsoft.Json;
using Ragon.Protocol; using Ragon.Protocol;
using Ragon.Server.Handler; using Ragon.Server.Handler;
+7 -7
View File
@@ -14,7 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
using Ragon.Server.Data;
using Ragon.Server.IO; using Ragon.Server.IO;
using Ragon.Server.Lobby; using Ragon.Server.Lobby;
using Ragon.Server.Time; using Ragon.Server.Time;
@@ -27,28 +26,28 @@ public class RagonContext
public ConnectionStatus ConnectionStatus { get; set; } public ConnectionStatus ConnectionStatus { get; set; }
public INetworkConnection Connection { get; } public INetworkConnection Connection { get; }
public IExecutor Executor { get; private set; } public IExecutor Executor { get; private set; }
public int LimitBufferedEvents { get; private set; } public RagonServerConfiguration Configuration { get; private set; }
public IRagonLobby Lobby { get; private set; } public IRagonLobby Lobby { get; private set; }
public RagonLobbyPlayer? LobbyPlayer { get; private set; } public RagonLobbyPlayer? LobbyPlayer { get; private set; }
public RagonRoom? Room { get; private set; } public RagonRoom? Room { get; private set; }
public RagonRoomPlayer? RoomPlayer { get; private set; } public RagonRoomPlayer? RoomPlayer { get; private set; }
public RagonData UserData { get; private set; }
public RagonScheduler Scheduler { get; private set; } public RagonScheduler Scheduler { get; private set; }
public RagonContext( public RagonContext(
INetworkConnection connection, INetworkConnection connection,
RagonServerConfiguration configuration,
IExecutor executor, IExecutor executor,
IRagonLobby lobby, IRagonLobby lobby,
RagonScheduler scheduler, RagonScheduler scheduler)
int limitBufferedEvents)
{ {
ConnectionStatus = ConnectionStatus.Unauthorized; ConnectionStatus = ConnectionStatus.Unauthorized;
LimitBufferedEvents = limitBufferedEvents; Configuration = configuration;
Connection = connection; Connection = connection;
Executor = executor; Executor = executor;
Lobby = lobby; Lobby = lobby;
Scheduler = scheduler; Scheduler = scheduler;
UserData = new RagonData(Array.Empty<byte>());
} }
internal void SetPlayer(RagonLobbyPlayer player) internal void SetPlayer(RagonLobbyPlayer player)
@@ -65,4 +64,5 @@ public class RagonContext
Room.AttachPlayer(RoomPlayer); Room.AttachPlayer(RoomPlayer);
} }
} }
+2 -43
View File
@@ -74,13 +74,11 @@ public class RagonServer : IRagonServer, INetworkListener
var contextObserver = new RagonContextObserver(_contextsByPlayerId); var contextObserver = new RagonContextObserver(_contextsByPlayerId);
_scheduler.Run(new RagonActionTimer(SendRoomList, 1.0f)); _scheduler.Run(new RagonActionTimer(SendRoomList, 1.0f));
_scheduler.Run(new RagonActionTimer(SendPlayerUserData, 0.2f));
_scheduler.Run(new RagonActionTimer(SendRoomUserData, 0.2f));
_serverPlugin.OnAttached(this); _serverPlugin.OnAttached(this);
_handlers = new BaseOperation[byte.MaxValue]; _handlers = new BaseOperation[byte.MaxValue];
_handlers[(byte)RagonOperation.AUTHORIZE] = new AuthorizationOperation(_reader, _writer, _webhooks, contextObserver, configuration); _handlers[(byte)RagonOperation.AUTHORIZE] = new AuthorizationOperation(_reader, _writer, _webhooks, contextObserver);
_handlers[(byte)RagonOperation.JOIN_OR_CREATE_ROOM] = new RoomJoinOrCreateOperation(_reader, _writer, plugin, _webhooks); _handlers[(byte)RagonOperation.JOIN_OR_CREATE_ROOM] = new RoomJoinOrCreateOperation(_reader, _writer, plugin, _webhooks);
_handlers[(byte)RagonOperation.CREATE_ROOM] = new RoomCreateOperation(_reader, _writer, plugin, _webhooks); _handlers[(byte)RagonOperation.CREATE_ROOM] = new RoomCreateOperation(_reader, _writer, plugin, _webhooks);
_handlers[(byte)RagonOperation.JOIN_ROOM] = new RoomJoinOperation(_reader, _writer, _webhooks); _handlers[(byte)RagonOperation.JOIN_ROOM] = new RoomJoinOperation(_reader, _writer, _webhooks);
@@ -96,8 +94,6 @@ public class RagonServer : IRagonServer, INetworkListener
_handlers[(byte)RagonOperation.TIMESTAMP_SYNCHRONIZATION] = new TimestampSyncOperation(_reader, _writer); _handlers[(byte)RagonOperation.TIMESTAMP_SYNCHRONIZATION] = new TimestampSyncOperation(_reader, _writer);
_handlers[(byte)RagonOperation.REPLICATE_ROOM_EVENT] = new RoomEventOperation(_reader, _writer); _handlers[(byte)RagonOperation.REPLICATE_ROOM_EVENT] = new RoomEventOperation(_reader, _writer);
_handlers[(byte)RagonOperation.REPLICATE_RAW_DATA] = new RoomDataOperation(_reader, _writer); _handlers[(byte)RagonOperation.REPLICATE_RAW_DATA] = new RoomDataOperation(_reader, _writer);
_handlers[(byte)RagonOperation.ROOM_DATA_UPDATED] = new RoomUserDataOperation(_reader, _writer, _configuration.LimitUserData);
_handlers[(byte)RagonOperation.PLAYER_DATA_UPDATED] = new PlayerUserDataOperation(_reader, _writer, _configuration.LimitUserData);
_logger.Trace($"Server Tick Rate: {_configuration.ServerTickRate}"); _logger.Trace($"Server Tick Rate: {_configuration.ServerTickRate}");
} }
@@ -154,7 +150,7 @@ public class RagonServer : IRagonServer, INetworkListener
public void OnConnected(INetworkConnection connection) public void OnConnected(INetworkConnection connection)
{ {
var context = new RagonContext(connection, _executor, _lobby, _scheduler, _configuration.LimitBufferedEvents); var context = new RagonContext(connection, _configuration, _executor, _lobby, _scheduler);
_logger.Trace($"Connected: {connection.Id}"); _logger.Trace($"Connected: {connection.Id}");
_contextsByConnection.Add(connection.Id, context); _contextsByConnection.Add(connection.Id, context);
@@ -248,43 +244,6 @@ public class RagonServer : IRagonServer, INetworkListener
} }
} }
public void SendPlayerUserData()
{
foreach (var (_, value) in _contextsByPlayerId)
{
if (value.UserData.IsDirty)
{
_writer.Clear();
_writer.WriteOperation(RagonOperation.PLAYER_DATA_UPDATED);
_writer.WriteUShort(value.Connection.Id);
_writer.WriteBytes(value.UserData.Data);
var sendData = _writer.ToArray();
_server.Broadcast(sendData, NetworkChannel.RELIABLE);
value.UserData.IsDirty = false;
}
}
}
public void SendRoomUserData()
{
foreach (var room in _lobby.Rooms)
{
if (room.UserData.IsDirty)
{
_writer.Clear();
_writer.WriteOperation(RagonOperation.ROOM_DATA_UPDATED);
_writer.WriteBytes(room.UserData.Data);
var sendData = _writer.ToArray();
_server.Broadcast(sendData, NetworkChannel.RELIABLE);
room.UserData.IsDirty = false;
}
}
}
public BaseOperation ResolveHandler(RagonOperation operation) public BaseOperation ResolveHandler(RagonOperation operation)
{ {
return _handlers[(byte)operation]; return _handlers[(byte)operation];
@@ -39,7 +39,6 @@ public struct RagonServerConfiguration
public int LimitPlayersPerRoom; public int LimitPlayersPerRoom;
public int LimitRooms; public int LimitRooms;
public int LimitBufferedEvents; public int LimitBufferedEvents;
public int LimitUserData;
public Dictionary<string, string> WebHooks; public Dictionary<string, string> WebHooks;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger(); private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
-2
View File
@@ -14,7 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
using Ragon.Server.Data;
using Ragon.Server.Entity; using Ragon.Server.Entity;
using Ragon.Server.IO; using Ragon.Server.IO;
@@ -27,7 +26,6 @@ public interface IRagonRoom
public int PlayerMin { get; } public int PlayerMin { get; }
public int PlayerMax { get; } public int PlayerMax { get; }
public int PlayerCount { get; } public int PlayerCount { get; }
public RagonData UserData { get; }
RagonRoomPlayer GetPlayerByConnection(INetworkConnection connection); RagonRoomPlayer GetPlayerByConnection(INetworkConnection connection);
RagonRoomPlayer GetPlayerById(string id); RagonRoomPlayer GetPlayerById(string id);
-3
View File
@@ -15,7 +15,6 @@
*/ */
using Ragon.Protocol; using Ragon.Protocol;
using Ragon.Server.Data;
using Ragon.Server.Entity; using Ragon.Server.Entity;
using Ragon.Server.IO; using Ragon.Server.IO;
using Ragon.Server.Plugin; using Ragon.Server.Plugin;
@@ -31,7 +30,6 @@ public class RagonRoom : IRagonRoom, IRagonAction
public int PlayerMin { get; private set; } public int PlayerMin { get; private set; }
public int PlayerCount => WaitPlayersList.Count; public int PlayerCount => WaitPlayersList.Count;
public RagonData UserData { get; set; }
public RagonRoomPlayer Owner { get; private set; } public RagonRoomPlayer Owner { get; private set; }
public RagonBuffer Writer { get; } public RagonBuffer Writer { get; }
public IRoomPlugin Plugin { get; private set; } public IRoomPlugin Plugin { get; private set; }
@@ -68,7 +66,6 @@ public class RagonRoom : IRagonRoom, IRagonAction
_entitiesDirtySet = new HashSet<RagonEntity>(); _entitiesDirtySet = new HashSet<RagonEntity>();
UserData = new RagonData(Array.Empty<byte>());
Writer = new RagonBuffer(); Writer = new RagonBuffer();
} }
@@ -14,7 +14,6 @@
* limitations under the License. * limitations under the License.
*/ */
using Ragon.Server.Data;
using Ragon.Server.Entity; using Ragon.Server.Entity;
using Ragon.Server.IO; using Ragon.Server.IO;