Wednesday, December 20, 2017

spritesheet - Combining multiple sprites vs separate sprites


I have a character which can hold ten types of weapons.


Should I:



  1. Create ten sets of animations for the character with each weapon

  2. Create animations for each weapon, and programmatically draw them on the character


Option 1 is simpler in general, but requires more work on the artist, and results in larger game size.



Option 2, to me, is a programming nightmare...


Whats the better practice in general? Thanks.



Answer



Unless you have a high frame rate and very low size requirements, the number of sprites you're talking about won't matter compared to, say, the audio files (especially music!). If game size was the only requirement, I'd say go with pre-baked animations.


As long as you only have ten weapons, either way will be roughly the same amount of work for the artist; I'm assuming she'll be reusing most of the character animations and only changing a bit for each weapon.


If you have combinations of items, then Option 2 becomes more appealing. If you have, say, 10 weapons and 4 armors that can be worn in combination, you suddenly have the choice between 40 animations or combining 14 programmatically. If you add 10 hats, it's 200 versus 24. Combinations of items is the most common reason I've seen that developers programmatically layer sprite animation.


So I say you might as well go for Option 1 unless you're combining stuff.


As an aside, though, the code for layering sprites shouldn't be too hard if you're using a decent library or framework. The fact that it seems intimidating may show a weakness in your development skills. It might be worth it to expand your programming knowledge by treating this as an exercise.


No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...