You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Browser: Chrome Version 105.0.5195.102 (Official Build) (64-bit)
Description
Hello,
I've discovered that depth sorting is running slow when rendering large number of sprites. Situation doesn't improve if sprite is not on the screen.
Depth sorting:
I've first seen this issue when running this game.
Performance of stable sort may be the problem here.
I've "updated" the depthSort function like this:
if(this.sortChildrenFlag){StableSort=(list,fn)=>list.sort(fn);// note this override with native JS fnStableSort(this.list,this.sortByDepth);this.sortChildrenFlag=false;}
And results:
Results look much better, but sorting may not be correct - right?
Note that many of sprites won't be visible in camera, so they wouldn't need to be rendered - right?
But by checking renderer function, I see that visibleChildren count doesn't change, whether all sprites are visible on screen or not:
varvisibleChildren=this.getVisibleChildren(displayList.getChildren(),camera);// visibleChildren.length -> this returns 20003
Is there a way these sprites can be occluded?
I am just trying to create new isometric RTS game, where medium-sized grid can be used, and is only partially visible in the camera. So in this case, I have issues with depth sorting slowing down the game, plus renderer taking all sprites into account, and not only ones visible on camera.
Is there a way I can bypass these issues somehow?
The text was updated successfully, but these errors were encountered:
Ok, please test the new StableSort I've put into the master branch (you'll need to do a Beta 11 build to get it, npm run dist will create that) - as for camera occlusion, that is out of scope for the v3 renderer, so you'll need to figure out a way to do this for your use-case I'm afraid.
Version
Description
Hello,
I've discovered that depth sorting is running slow when rendering large number of sprites. Situation doesn't improve if sprite is not on the screen.
Depth sorting:
I've first seen this issue when running this game.
I've confirmed this also with following example:
http://labs.phaser.io/view.html?src=src/depth%20sorting/Depth%20Sorting.js&v=3.55.2
The performance drops because of depth sorting:
Performance of stable sort may be the problem here.
I've "updated" the depthSort function like this:
And results:
Results look much better, but sorting may not be correct - right?
Is there a way we could improve this StableSort?
It seems that JS sort is stable since ECMA 2019, and twitter post with example
Rendering:
I've also updated same example with for loop like this
Note that many of sprites won't be visible in camera, so they wouldn't need to be rendered - right?
But by checking
renderer
function, I see thatvisibleChildren
count doesn't change, whether all sprites are visible on screen or not:Is there a way these sprites can be occluded?
I am just trying to create new isometric RTS game, where medium-sized grid can be used, and is only partially visible in the camera. So in this case, I have issues with depth sorting slowing down the game, plus renderer taking all sprites into account, and not only ones visible on camera.
Is there a way I can bypass these issues somehow?
The text was updated successfully, but these errors were encountered: