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

 Share

  • Recently Browsing   0 members

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