Laserbrain Studios

Games Forum Blog Contact

Archive

Creating semi-random character appearances – Part 1

2 Comments September 14th, 2010 by Christian Knudsen

In this blog post and the next one, I will try to describe the process that goes into creating the sprites that I use for semi-randomly generating character appearances. Part 1 (this blog post) will focus mostly on the making of the actual sprites, while Part 2 will explain how these sprites are blitted (drawn) to the screen at the correct positions and in the right order.

To create the sprites, I primarily use two programs: Poser and GIMP.

Poser is a 3D program focusing mainly on human characters. A few character models come with the program, and you can apply poses and animations to these character models a lot easier than in a full 3D program like Blender or 3D Studio MAX as Poser is designed specifically for manipulating human character models. Additional character models – as well as clothing and props for these models – can be bought at various websites, making it pretty much unnecessary for you to create assets on your own.

Character model in Poser

GIMP is an open source image manipulation program that is often considered the free alternative to Photoshop. It’s available for both Linux and Windows operating systems, but I’m using the Linux version as the Windows one was a bit unstable on my Windows XP laptop. (Poser, on the other hand, only exists for Mac OS X and Windows, so I’m using the Windows version of that program.)

Now, let’s take a single frame of a walk animation:

Single frame of walking animation

This character sprite is actually made up of no less than 14 subsprites – the hat, head, neck/chest, right arm, right sleeve, left arm, left sleeve, shirt, pants, legs, right foot, right shoe, left foot and left shoe:

The 14 subsprites

You’ll probably notice that the clothing subsprites are all white. This is because that having the base sprites being white allows for them to be drawn to the screen in any color you want. I use OpenGL for blitting sprites to the screen, and when calling the procedure for doing that, you can tell OpenGL how high the red, green and blue values of the sprite should be when blitting. When the sprites are white, these values are all 100% at default, but if you want another color, you can for example tell OpenGL to only draw the sprite with a blue value of 50%, which would make the sprite more yellow. Likewise, when drawing the body parts, I can change the colors a bit to allow for different skin colors.

The character models are all rendered out to .png files from Poser, but I can’t just render a fully clothed character – the different body and clothes parts all have to be rendered separately. This would take a looooong time if I had to load and setup each body and clothing part manually. Thankfully Poser supports Python scripting. So I’ve written a bunch of scripts that make Poser (somewhat) automatically load, setup and render each body and clothing part for the various frames and directions that make up an animation.

That’s not the end of it though, as the rendered subsprites from Poser still have to be resized, cropped and cleaned up. For example, this is the shirt sprite that Poser renders:

Rendered shirt from Poser

As you can see, there’s a big margin on this image and blackness where the character’s neck should be visible. So using GIMP, the image is cropped to remove the margin and the black part is manually erased. Finally, the image is shrunk to half size and the subsprite is complete. Like I wrote in my last blog entry, the full walk animation uses ~2050 subsprites which have all been rendered from Poser and manually resized, cropped and cleaned up in GIMP. I’m currently working on completing all the subsprites for the run animation and am making good process. I certainly get to listen to a lot of podcasts while doing this work!

And that’s how the subsprites that make up the complete character sprite are created. They still need to be drawn to the screen, and for them to properly form a character sprite, they all need to be drawn at specific positions and in the correct order. I’ll look at how that’s accomplished in the next blog post.


Clothing for walk animation done

2 Comments September 9th, 2010 by Christian Knudsen

The sprites that make up the clothes and body parts for the 8 directions of the walk cycle are now done. The below video shows 90 randomly generated characters walking at different speeds:


Watch it in HD!

It’s been a bit more than a week since I posted the last video that showed off just one direction of the walk animation. This doesn’t mean that it only took that time to create the required sprites though, as I’d cheated a little and was already well into making the remaining sprites when I posted the last video. If I add up the time used, I think it’s probably taken about 14 days of full time sprite making to create these sprites (~2050 separate sprites in total), which isn’t too bad and makes me feel that the system I’ve set up is definitely viable. I can imagine that the final six months or so of working on the full game will be all about cranking out these kinds of sprites to allow for even greater variety in character appearances.

I’ve already started work on the sprites for the running animation (the neutral position is done) and am also looking at animation and body templates for female characters. A pity it’s just 3D models and not real models – would certainly have made the task slightly more interesting… Ahem…

Shooting and impact animations are also somewhat in the pipeline – as are weapons – but I want the walk and run animations to be done and implemented in the engine for both male and female characters before I move on to that.