TutorialInfiniteTerrain icon indicating copy to clipboard operation
TutorialInfiniteTerrain copied to clipboard

Chunk.unload() hurts performance

Open Teelord opened this issue 6 years ago • 1 comments

Hi Jared,

Thanks for sharing this code. It's very informative and easy to follow.

I noticed that whenever a Chunk is unloaded, the rendering hangs. I was wondering if you had looked into this or had any ideas how to optimize that part. Whenever you reach the edge of a chunk, you'll see a pause in movement as Phaser clears out the Group.

I've tried small tweaks, deferring unloading until the scrolling has stopped, etc. to make it less noticeable but it seems like unloading a whole chunk is costly and interferes with rendering no matter what I do.

Thanks!

T

Teelord avatar May 18 '19 19:05 Teelord

Hi again. I've tried shrinking chunk size to 8 and it seems to spread out the processing load of clearing the group... Is this a reasonable solution? Does making chunks that are so small (i.e. 1/4 the original size) defeat the benefit of using chunks?

One non-performance issue that I noticed is that since the water sprite tile animations aren't synchronized, it allows you to see the edges between chunks (I haven't yet tried fixing this). Smaller chunks makes this more obvious.

Thanks again.

Teelord avatar May 18 '19 19:05 Teelord