Hey, I’m fascinated by one thing that appears fairly daunting proper now, needed to get your ideas.
In my soccer sport, I load a single spritesheet for every staff at the beginning of a sport (one wears white jerseys, the opposite wears coloration jerseys). In consequence, each participant on the sector has the identical jersey quantity. The mod creators and I nonetheless have the psd recordsdata which use numerous layers for modifying, and we will take away the jersey numbers and put these in separate recordsdata (a separate spritesheet for every presumably quantity, 0-99).
We’ve been batting across the thought of utilizing actual numbers on jerseys. Right here’s my preliminary thought on how, and I’m undecided it’s possible for efficiency and reminiscence.
• we modify the sprite sheets not embrace jersey numbers
• the mod guys create 100 sprite sheets of jersey numbers (0-99) matching each participant body, ideally with two colours that I can hopefully swap on the fly (one for the jersey quantity and one for the define). These are most likely black (define) and white (quantity), and I’d swap the colours on the fly.
• earlier than animating a play, I load 11 sprite sheets for the offense and 11 for the protection, based mostly on who’s on the sector.
• for every body, for each participant, I load his present picture from his staff’s sprite sheet and in addition load the corresponding jersey quantity sprite from the sprite sheet. I then coloration the quantity and description of that jersey quantity sprite based mostly on his staff and lay that sprite on prime of the participant sprite. So, for instance, I’d coloration the quantity navy blue and the define black or white.
I’m afraid this won’t be possible due to reminiscence and maybe due to efficiency, and perhaps there’s a greater means to do that?
My query is, will this kill reminiscence, since I’m loading 22 spritesheets into reminiscence. Since I set the GL context to 24 bits at the beginning, my concern is that each spritesheet could load as 24 bits. Effectively, now that I give it some thought, I suppose I do want to permit that jersey quantity to be no less than 8 bits, perhaps 16.
My spritesheets are fairly massive, with every sheet 3840×2640 in dimension. That’s 10MB every (for one-bit) earlier than I even contemplate the depth.
Additionally, would I take advantage of
SpriteFrameCache::getInstance()->addSpriteFramesWithFile();
for all 22 jersey numbers?
I load all 22 jersey numbers, as a result of the groups will fluctuate relying on who’s on offense, relatively it is a punt, whether or not some subs are within the sport, and many others.
Now, I’d have the ability to scale these photographs all the way down to perhaps 60% if that’ll assist.
Any concepts on this?
thanks!