🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Does loading a spritesheet use resources for the entire images or only what you use?

Started by
0 comments, last by hatenames 10 years, 10 months ago

I feel like this is a retarded question since I'm pretty sure the spritesheet uses memory for the entire sheet, but I just wanted to make 100% sure and can't find the answer any where. Sorry in advance for the newbie post.

For a html project I wanted to be 'smart' and make as little http requests as possible, so I created a 2048x2048 image that only has about 150x150 not being used, which is actually great since it can allow me to add other images in the future if I need.

The problem is, after purchasing and configuring a server, I was afraid if a lot of people connected at once, that the server would be using more memory for the bigger spritesheet? I only use 10% of the images in the sprite sheet at any given time, and when they change, the previous ones get replaced. So was it stupid of me to make one big file, will it only use extra memory for no reason? Would the rule of thumb here be, use big sprite sheets for images that are always being loaded, and then split the remainder into smaller sprite sheets that are used only at certain times?

Thanks for any advice and sorry for the newbie question. Thanks again for any help

Advertisement

A http server will likely use the exact same memory to serve the image to many clients because it most likely uses an API like sendfile (or something that mimics it).

Also, a single request for one spritesheet has much lower latency and is much more efficient than hundreds of small requests.

Wow, that's awesome. Thank you very much for your help! I was hoping it'd be like that but at the same time it sounded to good to be true. Thank you once again

This topic is closed to new replies.

Advertisement