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 摘要。