Rendering and performance questions

  • So, after reading the post Ashley did about how WebGL renders, I started making each texture spawn on a different layer. I also read somewhere that rendering multiple layers, in itself, takes some memory for each layer. Is this accurate? I'm trying to optimize my game, a space shooter. I've read all available articles on optimizing and tried to put as many of the tips into play as possible. I also read about power of two textures. Will that give a decent performance boost if you only use PO2 sprites?

  • space shooter you say? do you have particles in your game? i've noticed they reduce performance greatly if you have a lot of them.

  • I do have some particles. Only spawn 20 at a time and they fade quickly.

  • 20? as in their rate is 20? or 20 objects with some x rate?

  • 20 total objects. It only spawns when power ups are gained, fairly infrequently.

  • how much is their rate? it's usually how many particles times their rate = extra obj on screen.

  • Single shot.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • For mobiles or PC? If PC then you don't really need to worry.

    For mobiles, it's important to test early and often on your devices. Layers aren't an issue, it's sprite count including particles but also what you are doing code-wise, ie. static sprites aren't an issue but if you manipulate a lot of them often, it will lag on mobiles.

  • Yes - it's android export of my game that I'm working on right now. I'd like to message you to ask you some questions of you didn't mind but it says that I need 500 rep first. I've seen lots of your posts in most of the discussions I've been reading. I'm not a techie but still trying to make my game as good as possible before I publish it.

  • Layers with 100% opacity, normal blend mode, no effects, and without "force own texture" enabled have effectively zero memory overhead. Changing any of those will cause the layer to render to an intermediate texture, which has a memory and performance overhead.

    You should basically ignore the power-of-two size issue. The C2 engine handles it internally by assembling all images on to spritesheets which are themselves a power-of-two size. In fact the optimal size for a sprite is two pixels less than a power of two (e.g. 126x126, 62x62 etc) due to padding on the spritesheet, and the worst size is an exactly power of two size since it will pack least efficiently! So at least for sprites, just ignore powers of two and use whatever size is convenient.

  • Ashley - thanks for the info! My game is running extremely smoothly in chrome. Now I'm just working on optimizing it for mobiles. I'm getting OK (though inconsistent) results with cocoon and a version of crosswalk. Still working on that.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)