Scene graph entities kill game thread

Summary

Entities affect game thread performance significantly even when you are not doing anything with them. Entities with only a mesh component. If the mesh component is set to Collidable and Queryable then its even worse.

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Stability

Steps to Reproduce

Make a prefab with just a mesh component, uncheck Collidable and Queryable, and name the entity “Prefab_Rock”
Just paste the code below in a device in the OnBegin() method.

var NextTransform : transform = transform{}
        set NextTransform.Translation.Up =  1200.0
        var Counter : int = 0
        if(SimulationEntity := GetSimulationEntity[])
        {
            loop:
                for(X := 0..50)
                {
                    NewRock := Prefab_Rock{}
                    SimulationEntity.AddEntities of array:
                        NewRock
    
                    NewRock.SetGlobalTransform(NextTransform)
                    set NextTransform.Translation.Forward =  NextTransform.Translation.Forward + 50.0
                    if(NextTransform.Translation.Forward > 1000.0)
                    {
                        set NextTransform.Translation.Right = NextTransform.Translation.Right + 50.0
                        set NextTransform.Translation.Forward =  0.0
                    }

                    set Counter = Counter + 1
                }
                    
    
            
                if(Counter > 10000)
                {
                    break
                }

                Print("Counter = {Counter}")

                Sleep(0.05)
        }

Place the device in the world, launch the game and wait for the device to finish spawning entities.

Expected Result

After entities have finished spawning, game thread should have similar performance to when entities were not spawned.

Observed Result

Game thread is over 16ms on my machine

Platform(s)

PC

Additional Notes

This was the same before 34.00 but I thought its a known issue and didnt bother posting

Thanks for reporting this @TheGoodHunter. I’ve submitted a fix for the major performance bottleneck I found here which should be coming out in 34.20.

3 Likes