Jump to content

Render objects outside of camera


InsOp
 Share

Recommended Posts

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

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)

1c68f39331.jpg

 

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

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

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...