Jump to content

Quick question - does phaser only render what's in the viewport?


vspinnet
 Share

Recommended Posts

I have a large 2D isometric game with many sprites/tiles (using a texture atlas). Normally I would write code that only renders graphics that are within the viewport with large maps. Does Phaser do this automatically? I'm not sure if I should add all my sprites at one time, or if I need to write code that adds/removes sprite that are in or not in the viewport..

Link to comment
Share on other sites

48 minutes ago, VitaZheltyakov said:

Large or many sprites?

My tiles are 64x32 pixels. My 2D isometric maps can be up to 300x300 tiles. If the entire world is rendered with each update, I am going to add code that adds or removes sprites depending on whether or not they're in the viewport, but I don't want to bother if this is done automatically.

Link to comment
Share on other sites

I don't think it is.

My game's viewport is set to your window size while my map is MUCH bigger.  

By accident I made the viewport the same size as my world size and the performance was awful.  

When I reduced the viewport size, the performance went back to normal.

Disclaimer: I am an experienced JS dev but new to Phaser. 

Link to comment
Share on other sites

2 hours ago, vspinnet said:

My tiles are 64x32 pixels. My 2D isometric maps can be up to 300x300 tiles. If the entire world is rendered with each update, I am going to add code that adds or removes sprites depending on whether or not they're in the viewport, but I don't want to bother if this is done automatically.

It is 90000 tiles. This is very bad.

A large number of objects in the scene leads to low productivity. I would advise to remove unwanted tiles or combine them into larger ones.

Link to comment
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...
 Share

  • Recently Browsing   0 members

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