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

NetworkTransform Performance Issue in Large Scenes

Aperta
#2,447 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

stat:imported Tracking type:optimization
Lingua principale
C#
Stelle
2.3k
Fork
461
Merge medio
3g 16h
PR unite (30g)
20

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il problema in un progetto Unity 2021.3.12f1 con circa 500 componenti NetworkTransform e ispeziona il profiler in una build. Confronta il costo della sincronizzazione dei transform con quello di una variabile di rete Matrix4x4 sincronizzata, quindi determina se il percorso di aggiornamento di NetworkTransform può essere elaborato in batch o spostato nel Job System; il lavoro è completato quando l'overhead a regime è sostanzialmente inferiore.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp, unity
Ambito
networking, performance
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
20/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.