Jump to content

Animations memory management advice needed


Strateg
 Share

Recommended Posts

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?

Link to comment
Share on other sites

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

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

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

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

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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