my question will be about performance
info on the project:
game’s for desktop only, window size is 640, 360
a character size is 17, 52 pixels, platformer
i have this NPCMask obj with its AI events set, and this is how i plan to deal with its visuals
to every NPCMask, “NPCBaseSprite” is attached with “every 0.01 sec, set position to” logic
Within that base sprite will be “male, female, old, child” animation stripes
these animations will be assigned to each NPC mask according to their “overProfile” instance variable, which will define if the NPC is old, female etc, like:
if npc is walking,
>if overProfile is “old”
<start walkOld animation stripe on NPCBaseSprite
>if overProfile is “female” etc.
so i’ll have 4 whole sets of animations inside this “BaseSprite” object, from punchFemale to runChild - (i dont condone violence to women, that name just seems weird is all<3)
all of the above is a “must” cause the game is all about lively towns, my question is, as i’ll have like 40 npcs on the largest level (with a small window size - we’ll see like 4-5 npcs at a time, max) - how taxing on performance would this selection of animation sprites in branching fashion be, and is there a smarter way? i especially ask cause i want to know if i can add, not a “must” but “nice to have” addition TO this
i want to make another variable to the NPCMask, “underProfile” which will have 3 values, and they will define each overProfile’s visual sub category, things like hair additions, hats dresses etc, all as 3 sets each. Most of it transparent, just some costume and hair additions on the animation frames
so now we have on top of NPCMask, an NPCBaseSprite, and for this underProfile thing i want to add NPCCosmetics, both BaseSprite and Cosmetics objects attached to NPCMask with “every 0.01 sec, set position to” logic
if npc is walking,
>if overProfile is “old”
<start walkOld animation stripe (for NPCBaseSprite)
>if underProfile is “2”
<start walkOld2 animation stripe (for NPCCosmetics)
which will mean on this “Cosmetics” sprite object, i will have 12 whole fuken sets of animations, jumping, crouching punching… seems like im asking for a bad surprise at project end.
in accordance to expert opinion about performance impact of this method; i might add “ColorReplace” effect on NPCCosmetics, and randomize each hair, skirt etc color at layout start - then ill truly achieve a visually dynamic town
2 things that seem counter intuitive for performance to me as an amateur:
1- having 3 objects welded together as NPCs every 0.01 sec, and having 40 of these NPC sets at the same time on “city level” (biggest level on the game) (NPCMask wont be visible in game though, obv)
2- having loads of animation sprites on a single sprite object, even though only one of the sets will be used per NPC
i suppose i can also have different masks and event chunks and different sprites for each “overProfile” instead of this singular method, but i dont know which would be more performance friendly
can someone just tell me “naaah, ur worrying too much my dude! Knock yourself tf out, hell, make 5 underProfile visuals for those NPCs!”
please
all wisdom is appreciated