Refactor; Optimize simulation
This commit is contained in:
parent
8581cf6fb8
commit
0ef5652cea
16 changed files with 508 additions and 651 deletions
|
|
@ -4,13 +4,13 @@ using Godot;
|
|||
|
||||
public partial class QueueManager : Node
|
||||
{
|
||||
public static ConcurrentQueue<string> LogQueue = new();
|
||||
public static ConcurrentQueue<Action> ActionQueue = new();
|
||||
public static readonly ConcurrentQueue<string> LogQueue = new();
|
||||
public static readonly ConcurrentQueue<Action> ActionQueue = new();
|
||||
|
||||
public static ConcurrentQueue<(Sector, GameObject)> SectorReassignQueue = new();
|
||||
public static ConcurrentQueue<(long, Godot.Collections.Dictionary)> NetworkSyncQueue = new();
|
||||
public static readonly ConcurrentQueue<(Sector, GameObject)> SectorReassignQueue = new();
|
||||
public static readonly ConcurrentQueue<(long, bool, Godot.Collections.Dictionary)> NetworkSyncQueue = new();
|
||||
|
||||
private readonly int sectorReassignQueueRateLimit = 500;
|
||||
private readonly int sectorReassignQueueRateLimit = 5000;
|
||||
private readonly int networkSyncQueueRateLimit = 10;
|
||||
|
||||
public override void _Process(double delta)
|
||||
|
|
@ -51,9 +51,12 @@ public partial class QueueManager : Node
|
|||
&& NetworkSyncQueue.TryDequeue(out var item)
|
||||
)
|
||||
{
|
||||
var (clientId, gameObjectData) = item;
|
||||
var (clientId, full, gameObjectData) = item;
|
||||
|
||||
RPCNode.Instance.RpcId(clientId, nameof(RPCNode.RpcSyncGameObject), gameObjectData);
|
||||
if (full)
|
||||
RPCNode.Instance.RpcId(clientId, nameof(RPCNode.RpcSpawnGameObject), gameObjectData);
|
||||
else
|
||||
RPCNode.Instance.RpcId(clientId, nameof(RPCNode.RpcSyncGameObject), gameObjectData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue