InsOp Posted February 6, 2016 Share Posted February 6, 2016 Hello, as I currently noticed, my fps are dropping when i have many (currently ~7.000) gameobjects in a scene. Each object contains several other sprites like shadows,etc. So I wondered whether phaser is rendering all of them. If so: would it make sense to destroy all game objects outside of the cameraview and only display those within the cameraview? (Like here: https://github.com/marcus-robinson/chunk-map ) Quote .. and only the chunks of map neighbouring the camera are rendered, allowing the creation of potentially infinite maps that perform well I'm using phaser 2.4.0a Link to comment Share on other sites More sharing options...
AzraelTycka Posted February 6, 2016 Share Posted February 6, 2016 Hello, acoording to camera in docs. Well I don't know if it renders outside or not, but how do you hadnle objects outside the camera game logic wise? Do you process all 7000 objects all the time, is it necessary? Link to comment Share on other sites More sharing options...
InsOp Posted February 6, 2016 Author Share Posted February 6, 2016 thanks for the answer, No I dont. (At some times I do, but this wouldnt be the reason it has low fps all the time) I did profile the app with chromes devtools and i figured out that it probably is not my fault. (the marked game.update is my implementation) nonetheless the fact that i have several groups (layers) full of gameobjects which stretch themselves across the world could be the reason why it is not able to skip objects which are not inside the cameraview(?) Link to comment Share on other sites More sharing options...
InsOp Posted February 7, 2016 Author Share Posted February 7, 2016 Well I solved the problem. I am destroying sprites which are not in the cameraview and creating those which newly came into the cameraview. I now have 60 fps again and it does not matter whether I have 5 or 50000 units (i guess). the drawback is that scrolling is a little bit slower than before. Link to comment Share on other sites More sharing options...
AzraelTycka Posted February 7, 2016 Share Posted February 7, 2016 Well if they are actually drawn, did you try visibility = false? Link to comment Share on other sites More sharing options...
Recommended Posts