Sign in to follow this  
someone2

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

Recommended Posts

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...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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!)

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
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.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
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?


Well, pre-rendered 2D graphics have disadvantages that can be solved by switching to 3D. One of the reasons I've started working on a hybrid 2D/3D engine (2D isometric map, 3D characters) is to get around having to use up 4 or 5 MB of texture memory to hold all of the animations for a character. Walk, run, attack (3), cast spell (3), stand idle, die, react to hit... all pre-rendered in 8 or 16 facing directions for an isometric adds up in a hurry. Not to mention, even 16 facing directions looks strange when the character is walking along certain vectors; this problem disappears when I can simply rotate the character.

My take on the situation is that every day there are fewer and fewer reasons not to use 3D, even for supposedly simple 2D games. One of the things that held me back for so long from 3D was the necessity of reducing polygon count, and thus character detail, in order to achieve acceptable framerates, but this limitation is quickly disappearing. Techniques such as normal mapping can make even low-poly models look damned good, especially in an isometric-ish game where you never view the character up close.

Another benefit my hybrid engine receives from drawing things in 3D is the fact that many of the tricky drawing-order problems of a standard 2D isometric are gone. I can draw models and objects now without any regard to back-to-front sorting, and still have correct overlap of objects. In an 2D isometric game, large multi-tile objects sort badly and are difficult to draw properly without getting wierd overlap. In my hybrid engine, that is no longer a problem, since I can use depth sorting. I have to perform some strange techniques to render the map using 3D transformations but still retain the exact appearance as the 2D version, but in the end it all works well.

Component-based character equipment systems is yet another area in which 3D shines compared to the dull hacks required to make it work well in 2D. 3D skeletally animated systems lend themselves nearly perfectly to composition of character appearances, whereas with a sprite-based system you have to tackle messy and inconsistent drawing orders, exponentially bloated memory usage, significantly more difficult artwork creation, etc...

Finally, most professional 2D isometric games these days use characters and objects that were modelled in 3D then rendered to sprite images for import into the game. So you're probably going to be making 3D models anyway, thus that isn't wasted work there.

However, 3D does come with additional complexity, at least to start with. You need a stronger foundation in mathematics, and there are some tricky concepts that need to be tackled during the learning stages, but this is true of a lot of things.

Quote:

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.


Heh. Well, considering the fact that all 3D games are simply doing a 2D projection of a 3D game, I don't really see the problem here. Until they come up with fully 3D holographic displays, a 2D projection is all we get.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
haha. I was trying to illustrate the difference between a game rendered entirely in two dimensions, and one projected into 2d!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this