austincap Posted May 7, 2018 Share Posted May 7, 2018 I typed "how many sprites can phaser handle" in the search bar and didn't get any relevant results. My game can't seem to handle more than 1,000 sprites simultaneously on-screen before the FPS dips below 40 (what I deem acceptable). Is this reasonable? From what I've read other games typically don't have more than 300 sprites loaded into the game world simultaneously, but I'm trying to make a game that let's users add content dynamically and I want to know what the upper limit should be. According to the Chrome profiler tool, "Animation Frame Fired" is taking up most of my resources. Is there anyway around this? Thanks. Link to comment Share on other sites More sharing options...
samme Posted May 7, 2018 Share Posted May 7, 2018 23 minutes ago, austincap said: According to the Chrome profiler tool, "Animation Frame Fired" is taking up most of my resources. Is there anyway around this? Look for the functions taking up the most "self" time. Link to comment Share on other sites More sharing options...
chriswa Posted May 8, 2018 Share Posted May 8, 2018 Are you using SpriteBatch? If it's implemented correctly in Phaser, batched sprites (i.e. sprites that use parts of the same texture) can be drawn with a single WebGL draw call, which can mean tens of thousands of sprites without a noticable dip in framerate. I use a Chrome extension called Spector to inspect the WebGL calls made by web pages, which can help you determine how much room for improvement there is available. Link to comment Share on other sites More sharing options...
alex_h Posted May 8, 2018 Share Posted May 8, 2018 11 hours ago, austincap said: I typed "how many sprites can phaser handle" in the search bar and didn't get any relevant results. It's not a question with a single simple answer as it depends on what hardware its running on Link to comment Share on other sites More sharing options...
austincap Posted May 8, 2018 Author Share Posted May 8, 2018 I'm not using SpriteBatch but I don't think it's relevant for my purposes. Basically in my "game" players make posts, like you would on a message board. Each "post" is comprised of 4 sprites: the post-type (basically the block outline), an identicon representing the text data, the text data itself, and the sprite for the number of upvotes it currently has. On top of that, there's enemy sprites, bullet sprites, and image sprites of the post is for a picture. Also replies have dynamically drawn reply lines. For the record, my system is Windows 7 x64, 8GB ram, 3.3 GHz quadcore, and 2GB video memory. Link to comment Share on other sites More sharing options...
samme Posted May 8, 2018 Share Posted May 8, 2018 https://developers.google.com/web/tools/chrome-devtools/rendering-tools/js-execution Link to comment Share on other sites More sharing options...
chriswa Posted May 8, 2018 Share Posted May 8, 2018 Phaser's docs explicitly mention 1000 sprites: "...you only really need to use a SpriteBatch if you have over 1000 sprites that all share the same texture (or texture atlas)." https://phaser.io/docs/2.6.2/Phaser.SpriteBatch.html Link to comment Share on other sites More sharing options...
chriswa Posted May 8, 2018 Share Posted May 8, 2018 I don't see more than 1000 sprites in your screenshot. Are you drawing off-screen sprites too? That can slow things down quite a bit. Are you able to skip drawing sprites outside of an (AABB) rectangle which represents your viewable screen size? austincap 1 Link to comment Share on other sites More sharing options...
austincap Posted May 10, 2018 Author Share Posted May 10, 2018 I'm drawing all off-screen sprites. I'll look into skipping drawing sprites outside of an AABB rectangle. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts