Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I know when I did some game development with XNA they recommended that we try to group are sprites into fewer sheets because the graphic card could process it faster. Does this also apply to web based games?

Note: Not sure if this makes a difference but most of my artwork is pretty defined by separate levels. In other words I'm not really reusing artwork across levels, which kind of made me wonder if I should be loading sprites that never get used just for the sake of grouping them into a spritesheet.

share|improve this question
add comment

3 Answers 3

up vote 5 down vote accepted

The idea behind condensing sprite sheets is that the actual loading of the file (the sprite sheet) is considered heavy lifting in any game system. Imagine you have this system where all your data types are highly optimized and all these algorithms to reduce the memory foot print but then you have to constantly bottle-neck memory with loading and parsing files.

However, I wouldn't say packing "all" sprites on to one sheet would be a good idea. Creating sheets specific to each level could be a better approach. I wouldn't see any point in having large sprite sheets where significant portions may never be used in a user's game session.

share|improve this answer
4  
Typically, a good approach would be to have one sprite sheet per load-limited area, and one for very common shared sprites that stays in memory throughout the program's lifetime. –  Shotgun Ninja Apr 15 '13 at 18:28
    
+1 @Shotgun I like the idea of separating by load. –  loyalpenguin Apr 15 '13 at 18:35
    
@ShotgunNinja Agreed. That would be a performance-friendly approach in any development scenario. –  Mike Johnson Apr 16 '13 at 1:48
add comment

It is not only the memory footprint you have to think about but also the number of requests the client is making to the server to fetch the images.

By default the maximum number of parallel requests is 2 but some browsers ignore this.

If you have many images then this will become a bottleneck.

share|improve this answer
add comment

In my game engine, I load the sprite sheet once, parse it upon load completion, calculate indices and animation frame data, and it's ready to go. It's extremely fast, and the only level loading is done dynamically as the player progresses through the game world.

YMMV, but consider either background-loading, or loading everything at startup and caching it client-side using manifest/caching.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.