Hey, I’m thinking about something that seems pretty daunting right now, wanted to get your thoughts.
In my football game, I load a single spritesheet for each team at the start of a game (one wears white jerseys, the other wears color jerseys). As a result, every player on the field has the same jersey number. The mod creators and I still have the psd files which use lots of layers for editing, and we can remove the jersey numbers and put those in separate files (a separate spritesheet for each possibly number, 0-99).
We’ve been batting around the idea of using real numbers on jerseys. Here’s my initial thought on how, and I’m not sure it’s feasible for performance and memory.
• we modify the sprite sheets not include jersey numbers
• the mod guys create 100 sprite sheets of jersey numbers (0-99) matching every player frame, preferably with two colors that I can hopefully swap on the fly (one for the jersey number and one for the outline). These are probably black (outline) and white (number), and I’d swap the colors on the fly.
• before animating a play, I load 11 sprite sheets for the offense and 11 for the defense, based on who’s on the field.
• for each frame, for every player, I load his current image from his team’s sprite sheet and also load the corresponding jersey number sprite from the sprite sheet. I then color the number and outline of that jersey number sprite based on his team and lay that sprite on top of the player sprite. So, for example, I might color the number navy blue and the outline black or white.
I’m afraid this might not be feasible because of memory and perhaps because of performance, and maybe there’s a better way to do this?
My question is, will this kill memory, since I’m loading 22 spritesheets into memory. Since I set the GL context to 24 bits at the start, my concern is that every spritesheet may load as 24 bits. Well, now that I think about it, I guess I do need to allow that jersey number to be at least 8 bits, maybe 16.
My spritesheets are pretty large, with each sheet 3840x2640 in size. That’s 10MB each (for one-bit) before I even consider the depth.
Also, would I use
SpriteFrameCache::getInstance()->addSpriteFramesWithFile();
for all 22 jersey numbers?
I load all 22 jersey numbers, because the teams will vary depending on who’s on offense, rather this is a punt, whether some subs are in the game, etc.
Now, I might be able to scale these images down to maybe 60% if that’ll help.
Any ideas on this?
thanks!