Strateg Posted December 20, 2014 Share Posted December 20, 2014 Hello, everybody! We are creating MMO game with many animations and layers of equipment:https://drive.google.com/file/d/0B9amDAb8YxiqYWo2cXlDU0JfVzA/view?usp=sharing Body spritesheet – https://drive.google.com/file/d/0B9amDAb8YxiqeFczNFhFWnJLSm8/view?usp=sharing Equipment layer spritesheet – https://drive.google.com/file/d/0B9amDAb8YxiqTWxlcXlXdjBibkU/view?usp=sharing Layer has texture 8192х2048 pixels and holds 67 108 864 bytes in memory.When player equip for example sword + shield + breastplate + helmet + gloves + leggings + greaves + body layer – that is 8 * 67 MB = 534 MB only for 1 player textures! Any ideas? MichaelD 1 Link to comment Share on other sites More sharing options...
MichaelD Posted December 20, 2014 Share Posted December 20, 2014 As an extra question here, can a large spritesheet affect FPS on a mobile device? Link to comment Share on other sites More sharing options...
spencerTL Posted December 20, 2014 Share Posted December 20, 2014 This thread may offer some useful info:http://www.html5gamedevs.com/topic/10412-is-one-single-35mb-sprite-atlas-to-big-to-push-on-the-gpu-on-mobile-devices/ Link to comment Share on other sites More sharing options...
Strateg Posted December 21, 2014 Author Share Posted December 21, 2014 As an extra question here, can a large spritesheet affect FPS on a mobile device? As I understand best way for perfomance - use one large spritesheet with frame atlas for all graphics.But you spritesheets must not be more than 4096x4096 pixels to work on most devices. But in my case we have too much animations to store all in memory at once. So I seek for some good example for animation memory management "on the fly".As I see nobody can help me here. Link to comment Share on other sites More sharing options...
lewster32 Posted December 22, 2014 Share Posted December 22, 2014 There seems to be a lot of empty space in your sprite sheets; you could optimise this hugely by using texture atlases instead, which would allow you to retain the dimensions/offsets of the frames without the need to have all that unused space in your assets. Export all of your frames individually at their full size, then run them through something like TexturePacker or Leshy SpriteSheet Tool to optimise them and create texture atlases you can use in Phaser in place of the sprite sheets. Link to comment Share on other sites More sharing options...
Strateg Posted December 22, 2014 Author Share Posted December 22, 2014 Yes, of course, after testing all animations will be optimized and empty space cropped. But it isn't solve my problem. We already have huge amount of animations. I need some algorithm for change animation "on the fly".Probably I'll try to use bitmap buffer for current animation and fill it from separate assets. Link to comment Share on other sites More sharing options...
lewster32 Posted December 22, 2014 Share Posted December 22, 2014 Unfortunately there's not a lot you can do - if you want all of the frames for animations to be accessible you generally have to have them all in memory. You don't really have much choice beyond some potentially very complicated loading and caching routines, but they'll still require you load your assets in full to retrieve the frames. Remember that sprite sheets/atlases are shared though, so whether you have 1 character or 100 characters, if they share the same assets for their animations, you won't use much more memory than the tiny amount used for the animations' frame references. Combine this with using texture atlases to reduce the physical dimensions of your assets and you should be okay. If you still run into issues it's probably time to think about performing the animation procedurally rather than frame-by-frame, i.e. making a hammer swing by taking a single frame (or only a few frame) sprite and moving/rotating it in a convincing way to produce a similar effect. Link to comment Share on other sites More sharing options...
Strateg Posted December 22, 2014 Author Share Posted December 22, 2014 Remember that sprite sheets/atlases are shared though, so whether you have 1 character or 100 characters I know that. if you want all of the frames for animations to be accessible you generally have to have them all in memory. Not exactly. While you don't load assets as texture its not in memory as bitmapdata. Link to comment Share on other sites More sharing options...
Recommended Posts