Methods for having sprite characters in 3d game?
I am making a game much like Doom. The world is 3d but objects and characters are 2d sprites. I am not asking about billboarding objects. I am asking about methods for having sprite characters that aren't always facing the player and have different frames depending on which way the character is facing. For example when an enemy is walking towards the player it is a 2d texture of a front and when walking away it is a 2d texture of a back.

One way I thought I read about was to draw a cube primitive that is "invisible". This 3d cube allows you to track the orientation of the character. Then you apply a sprite frame to each side of the cube but the 2d texture is only drawn on the side the player is looking at.

The other way I suspected I could do this is to make a 3d plane in a modeling program and import it to XNA. Then use the billboarding method to make sure the plane is always facing the player (you don't see the edge). Apply a the appropriate 2d texture (sprite frame) to the plane based on the direction the character is facing.

I know this is not how Doom did it but please tell me what you think of my ideas or a method on how this can be done.

1 Answer
1

Billboarding and swapping images is afaik exactly what Doom (and many other games) did. It might not look like it in the source because Doom is not running on a general purpose 3D engine. The game had the advantage to have a fairly locked camera, reducing the amount of possible perspectives (just rotation around 1 axis) and therefor reducing the amount of images required to display a character correctly. You can see this when you run close to a barrel. It still show's you the sideways perspective although you are taller and should see its top.

I never read about the cube technique but it sounds like it has the advantage to already skew and resize the sprite plane (side that is rendered) according to the perspective. I could imagine this adds to the illusion of perspective and may work as a great way to blend between different perspective images of your character. But it is basically the same as rotating a plane in 3D and a plane sounds like less impact.

I would go for the billboarding technique. Depending on your game and visual perfection you aim for you might also want to lock the applied rotation on one axis aswell. You need to implement a way to change your 2D animations anyway and swapping perspective is just that but based on the direction the character is facing and your player is looking. I'm unfamiliar with xna but I could imagine it allows you to create planes at runtime, so you don't need to import it from a 3D program can also easily set the size according to your sprite.