Doom 3D style game? (2D sprites in a 3D world?)

So, when thinking about games I want to make, particularly the animation part, I figured I wanted to stick to After Effects 2D animation, seeing as I feel a bit more comfortable dealing with that style of animation. I remembered seeing game clips from an old game called Doom 3D, which was structured like an FPS, but the characters, enemies, and gore effects were 2D animated sprites. I want to make games that have a similar structure to Doom 3D, in which the environments are 3D, but the main animated components are 2D. Do you guys have any ideas on how to place 2D animations as objects in a 3D project and being able to control them like a standard game object? Heck, is it possible to program a 2D object to change images depending on where the camera is positioned (If my character is walking around a 2d character, he needs to see the front when facing her, her right side when he’s standing to the right of her, and so on…)

The name of the game is just Doom and this post is written in such a way that I feel like a grandmother for having to make that correction. I’m literally aging to dust as we speak.

ON TOPIC this is all pretty simple. I’d do it the following way:

  • Render the sprite to a quad using the spritesheet shader of your choice.
  • Make sure the quad is always rotated towards the player.
  • Store the rotation of the object internally and use this to determine which sprite from the spritesheet to use.

There are other, likely more efficient ways to do this sort of thing, but from a beginner’s perspective, this should give you an idea of where to start.

5 Likes

Dang! What I meant to say was Duke Nukem 3D! My apologies.

Oh, same basic principles apply though.

I don’t know that you need to muck about with quads. Just throw a sprite into your scene — it already works as well in 3D as it does in 2D. (You do still need to rotate it towards the camera, though.)

3 Likes

while ago tried to get that kind of billboard system working, but it still has some issues,

you give it a texture sheet like,

*not very good sheet, each row should be different animation…here only text changes

and then it draws the image based on camera angle in that shader…

1 Like

The effect you’re looking for is commonly called a “billboard” sprite.

The Unity wiki has some very simple examples of this type of effect called CameraFacingBillboard and LookAtCameraYonly. However, you’re apparently looking for a multi-directional billboard effect, which is much more complicated. Fortunately, there is great open source project called Daggerfall Unity that has recreated this very effect already. You can find the project source code here.

2 Likes

Not to get all pompous, but telling a sprite to look at a the camera is not really a billboard.

Billboards are rendered differently.

But this script would work for sure and with modern hardware, the hit you’ll take for telling it to look at the camera every frame is marginal.

As far as the animations go, it’s pretty easy.

Just create a grid on an image that’s sides are powers of 2 (256x256, 512x512, 1024x1024) and the do a row of all the animations needed facing one way. Then turn the character a little and do the animations from a different angle. Then turn some more and repeat.

Next you’ll want to make a base for the enemy. Place a rigidbody and a collider on the base (you may want to use a cube that delete the mesh so you can safely position it). Then make the “billboard” on it as a child. Write a script that swaps out the set of animations depending on the parent’s rotation relative to the player. Then write another script that rotates the image to look at the main camera, but always sets the y and z rotation to 0.

To make the animations, I recommend doing digital pictures and/or stop motion.

If you go for stop motion, get a rotating cake stand and mark off 8 directions on the sides and line them up with a mark on the what you set the cake stand on. Pose the figure, line up a mark, take a picture, rotate to the next spots, take more pictures… you get the idea.

Oh, crap!

Two posts.

Yeah, I just wasted my time explaining all this to someone who will never come back, didn’t I?

2 Likes

@Not_Sure Yeah, the term “billboard” never made much sense to me neither, but it’s not my terminology! :stuck_out_tongue: I guess the idea of billboarding might make a little more sense?

Don’t even get me started on the concept of “isometric” and how that term has been misused to death for games.

It also sounds like you’ve actually done this kind of work before, but I’m guessing you just read Masters of Doom or something. :wink:

1 Like

Yeah, I haven’t read it but I was considering doing something along the lines of Blood or Shadow Warrior since I’m a huge build engine geek.

There’s too much I’d like to do though and I need to pick my projects.

3 Likes

Story of my life. Ha!

True dat!

That’s why I just set this idea free today.

Future person talking to you from The Future, here. Yes, you did. And thank you very much for doing it! Because now when google decides that this thread is the most relevant search result, and hundreds of us poor sad dummies in The Future try to Google how to make an oldschool FPS, we’ll get your helpful explanation instead of a whole lotta nothing. Even if that guy never comes back, even if you wasted your time in the short term, you’re saving hundreds, perhaps thousands of people’s time in the long run.

1 Like

Unfortunately a lot of what I posted is now out of date.

@Not_Sure There are definitely newer and more efficient techniques for achieving this effect in Unity today but the basic concept remains the same. So I wouldn’t call your advice “outdated”, and in any case I still think this is the best place for newbies to start since it’s easy to learn. Better, more complex techniques can be used after they gain more experience.

1 Like

Fun fact: The latest official port of Doom (classic 1993 version) from Bethesda was made using Unity!

2 Likes

Out of curiosity, how would you implement this today? I started with this guy’s tutorial, messed around with it, ended up pestering him in his Discord, and managed to get a more advanced version up and running that passes animation keyframe data to the shader using vertex colors.

Unity actually opened up their built-in billboard rendering API a few years ago, so the easiest and most efficient approach today, would be to use custom billboard assets. Unfortunately, you still need to write your own scripts to generate and animate them. But I think I might have an editor script laying around somewhere that could help you get started, if you’re interested.

Huh. Interesting. Please, by all means, post it here. Though I’m pretty satisfied with my current solution, it’d be great to know more, and it might help someone else.

I was sure you were gonna say Sprites, because there are tools to animate them already in Unity. :stuck_out_tongue: