Memory usage question

0 favourites
  • 5 posts
From the Asset Store
Test and challenge your memory in this amazing Christmas themed memory game!
  • I've got a question about memory and loading sprites. Lets say I have a terrain made of N 32x32 pixel sprites. Suppose that each terrain sprite could have 1 of 8 possible images. Would it be more efficient to create one sprite with a sprite sheet that has all 8 frames? Or would it be more efficient to create 8 different sprites each with 1 frame?

    It seems to me that having each sprite on the layout contain all 8 frames would be more memory intensive than having 8 different sprites each with 1 frame.

    Can anyone answer this?

  • It'd be the same thing, since sprites are fully loaded into memory (with every single animation and frame) as soon as the layout starts.

    Also, relevant. If you're really haggling for memory then you should probably just use one or two base layers as tiled backgrounds, then sprinkle them with sprites to add variety.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you for the quick response. I just read that post. It's what made me finally pose this question.

    But isn't each sprite created on the layout a new instance? Meaning that each one would contain the 8 frame sprite sheet, variables, etc? Or is it simply drawing that one sprite to the screen in multiple locations?

  • There is GPU/CPU overhead for running multiple instances of the same sprite, but in terms of memory usage it's treated as a single object.

  • Thank you! I know this is common in other engines. Just wasn't sure if it worked the same in html5.

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