thombruce / verse

🚀 A universe in progress
Other
8 stars 0 forks source link

Procedural Sprites #87

Open thombruce opened 9 months ago

thombruce commented 9 months ago

I've been wondering about how to create large amounts of varied species and characters for the game. Finally heard someone else combine the terms, "procedural" and "sprites".

Googling the term I have found this: https://github.com/zfedoran/pixel-sprite-generator <- There's also a Rust port listed in the readme. What's particularly interesting about this example is that it doesn't seem to use any base images. From what I can tell, it is defining the shapes as sort of like matrices. For each value in the matrix, a pixel is set by an algorithm accordingly:

/**
    *      -1 = Always border (black)
    *       0 = Empty
    *       1 = Randomly chosen Empty/Body
    *       2 = Randomly chosen Border/Body
**/

But we could just as well procedurally generate a sprite from given layers. Where appropriate, we could combine both approaches.

So, this concept will be useful to us for generating plant and animal species on alien worlds. And it will be useful to us in generating character sprites (every individual character should have a world sprite and a larger, more detailed portrait, I think).

Probably for characters, particularly human characters, we might have pre-defined hairstyles and clothing options as well as some general face structures. Characteristics like eyes, hair colour, noses, lips, ears... these might be generated more procedurally to within certain bounds.

For alien species of plant and fauna, we might allow far more variation. But we have a problem...

Animation.

I don't think we can reasonably generate every animation frame required this way. What would be easier would be to generate the body separate from the head and limbs, and map these onto a rig with some adjustable animation values. <- That, though, is not pixel art. Not that we're aiming for pixel perfection, but we really will have to see how it looks. A lot of games do do that sort of style - it works just fine.