InsOp

Render objects outside of camera

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

Share this post


Link to post
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(?)

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.