2D games in a 3D world... which way is better

Started by
10 comments, last by GameDev.net 19 years, 7 months ago
Hello, How are you? I hope you are very fine.. I have a small question... I am trying to create a 2D game. We are using DirectX 9. It looks like there are two choices... 1. Use pretransformed vertices (RHW), and use quads to create sprites, and move them around 2. Use a real 3D engine with a fixed camera, to give an impression of a 2D game I was wondering which way is better? Our game is going to be similar to boulder dash. I wonder which way will be easier? which way is more powerful.. If we use pre-transformed vertices, can we still rotate the sprites around the x-axis or y-axis? Or, to do this, we will still need to make it a real 3D? If we use a real 3D engine, do you have any idea how can we put the objects in a very specific locations... We need to do lots of trial and error before everything fits into place... (Because now, we have to worry about camera location, and so on...) Thank you very very much in advance for all the help...
Advertisement
I certainly wouldn't bother with a 3d engine for 2d stuff if I were you. You can do everything you need using the homogenous coordinates. Any transformations you want to do (such as rotations etc), you'll have to do beforehand though.
Hey someone, I think the best route to go would be to use un-transformed textured quads with an orthogonal view projection. If you are familiar with the fixed-function pipeline (i.e. model coordinates -> world coordinates -> screen coordinates) then using transformation matrices can be VERY powerful. Plus, you would potentially only need one textured quad for each object because each entity that uses that textured quad would have their own transformation matrices.

The advantage of using this setup is that it is 2D, yet uses the Direct3D pipeline. This will allow you to use more powerful scaling and rotation functions. Also, you will be able to add cool effects like particle effects without too much effort.

I hope that didn't sound too complicated :S. And remember, this is *just* my opinion. Others may suggest a different way. I like this way because of the added power you have and the transition from 2D to 3D becomes a lot less intimidating.

I hope this helps! Good luck and enjoy yourself.

Jason Olson - Software Developer[ Managed World ]
i'm also playing around with a 2D-based game, which I already have the 'world' up and running nicely. Im using Direct3D, because it had the Sprite object which lets you use 2D graphics as easy as DirectDraw did. And, indeed, a big plus: later on, you'll be able to add small fancy 3D effects very easily, since you are using a 3D-device! Just place them between the StartScene() and EndScene() (and make sure to use a valid 3D backbuffer!)
As someone creating a 2d platform sort of game in a 3d environment, here are some of the problems I came across going with the 3d route. EVERYTHING is time consuming. Levels are no longer tiles on the screen but are rather actual geometric objects that need to be modeled and defined. Collision is far more complicated. Triggers and Powerups are not placed like little boxes in the world but rather actual polygons, this led to making a custom editor (very time consuming). Not only did I have to make a level editor but it had to handle the camera movement through the 3d world by use of splines. Although not complicated, it is very tedious to implement.

If you make the game all 2d, your level editor can be a text editor. And it will crash far less then any program that you end up having to write. The visual impact will not be the same but make no mistake that you can seriously do some cool stuff in flat 2d.

~Wave
If you don't need to use 3d stuff... Then don't!

I think people are confused between using DirectX (which supports 3d rendering) with using a specific 3d engine.

If you're working in 2d and you're having to think about cameras then something is wrong. You should just be shifting around an orthographic projection matrix at most.
Just to note, it's entirely possible to have your levels be text files and use 3D. Simply have a set of 3D "tiles" (meshes modeled to fit a certain size). Collision shouldn't be much more complicated, so long as you remember the only 3D part of the game is the API you're using. So long as you're doing orthographic projection, you can effectively do the same thing you would with 2D.

It's really not that hard, just remember not to make things more complex than they need to be.
The main thing that annoyed me about using Direct3D for 2D was the fact that all the textures had to have widths that were powers of two.
I'm using option 2 in my game, with elements of 1 for the GUI/HUD.

It's fairly easy to limit your use of one dimension, whilst still using the 3D concept. Personally, I like it - having full 3d models flying around and not being limited to only 2D. But that's just my opinion.

I'll agree with Wavewash and say that it is adding extra complexities into the mix, but overall I enjoy the extra freedom. Just make sure you use your Frustum for scrolling/clipping and such because that's one thing that you can't take for granted like you can in a regular 2D game.
Textures being a power of two is dependent on your graphics card.

If you're doing 3d models for 2d games then surely you're wasting your time! If you have an orthographic projection then these models will look the same all the time so what's the point of having the model? Perhaps if you're doing some kind of real time lighting maybe... But then you're really doing a 2d projection of a 3d game.

This topic is closed to new replies.

Advertisement