This commit is contained in:
wuyanchen 2025-12-26 14:18:08 +08:00
parent d0ff0dbfda
commit a5f9f6a1c1
2 changed files with 2 additions and 22 deletions

View File

@ -77,30 +77,10 @@ namespace XNet.Business
lastTime = currentTime;
// 【核心循环】
// 现在不需要一把大锁锁住全服了
// 1. 如果有来自 WebAPI 的异步命令(如动态创建副本),可以在 NavMeshManager 内部处理
// 或者在这里手动处理队列 (如果使用了 CommandQueue)
// _navMeshManager.ProcessCommands();
// 2. 并行更新所有副本的 Crowd
// 这行代码利用 SceneAgent 内部的 Parallel.ForEach效率极高
_sceneAgent.UpdateAll(deltaTime);
//// 2. 收集所有需要同步的Agent状态
//List<AgentPositionSyncMsg> allSyncMsgs = [];
//foreach (var instanceId in _instanceIds)
//{
// var syncMsgs = _sceneAgent.GetAgentsNeedSync(instanceId);
// allSyncMsgs.AddRange(syncMsgs);
//}
//// 3. 异步发送WebSocket消息不阻塞游戏循环
//if (allSyncMsgs.Count > 0)
//{
// _ = _wsManager.SendAgentPositionBatchAsync(allSyncMsgs);
//}
// 2. 异步收集+推送消息IO密集型提交到专用线程池不阻塞主循环
_ = Task.Run(async () =>

View File

@ -268,8 +268,8 @@ namespace XNet.Business
bmin.Y -= 0.5f;
}
Console.WriteLine($"Adjusted Bounds: Min({bmin.X},{bmin.Y},{bmin.Z}) Max({bmax.X},{bmax.Y},{bmax.Z})");
Console.WriteLine($"Adjusted Size: {bmax.X - bmin.X}, {bmax.Y - bmin.Y}, {bmax.Z - bmin.Z}");
//Console.WriteLine($"Adjusted Bounds: Min({bmin.X},{bmin.Y},{bmin.Z}) Max({bmax.X},{bmax.Y},{bmax.Z})");
//Console.WriteLine($"Adjusted Size: {bmax.X - bmin.X}, {bmax.Y - bmin.Y}, {bmax.Z - bmin.Z}");
var builderConfig = new RcBuilderConfig(config, bmin, bmax);
if (builderConfig.width <= 0 || builderConfig.height <= 0)