Unity-Technologies / Unity-Technologies/com.unity.netcode.gameobjects

NetworkTransform Performance Issue in Large Scenes

未關閉
#2,447 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

stat:imported Tracking type:optimization
主要語言
C#
星號
2.3k
分支
461
平均合併
3 天 16 小時
30 天內合併 PR
20

描述

Description

The Network Transform component is significantly more expensive than necessary. I suspect this is due to its lack of batching or usage of the Job System. It might be possible to move most, if not all, the logic into a burst compiled job.

Reproduce Steps
  1. Build a new project with netcode
  2. Add ~500 network transforms
  3. Observe profiler in build

image

Expected Outcome

Executing the syncing of the transforms should incur a time cost on par with simply using a synced network variable of a matrix4x4

Actual Outcome

Considerable performance losses, possibly due to Update overhead

Details

Unity Version 2021.3.12f1
Netcode Version 1.2.0
Transport Version 1.3.0

Additional Thoughts

Im working on a fairly large simulation project, and am using NGO for sharing said data. As such, I have between 500 and 1000 network transforms for syncing simulation data between clients. The profiling data above is after the simulation settles, so the only network messages been sent are heartbeat.

After doing my own deep dive into the network transform, I noticed that the work it was doing wasn't batched. It might be possible to use the job system to deal with these transforms, thus allowing a much larger cap on the amount of synced network objects in a scene.

Sadly, until the performance of the network transform is improved, I'm going to have to attempt to implement my own version of the network transform.

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

首先,在包含約 500 個 NetworkTransform 元件的 Unity 2021.3.12f1 專案中重現問題,並在建置版本中檢查 profiler。將 transform 同步成本與同步的 Matrix4x4 網路變數進行比較,然後確認 NetworkTransform 的更新路徑是否可以進行批次處理或移至 Job System;當穩態負擔大幅降低時,即表示完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
csharp, unity
領域
networking, performance
Issue 類型
缺陷
難度
5/5
預估耗時
一週以上
活躍度
停滯
描述清晰度
基本清楚
新手友好度
20/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。