Allegro.cc - Online Community

Allegro.cc Forums » Game Design & Concepts » Is it a good idea to make your own 3D system?

This thread is locked; no one can reply to it. rss feed Print
Is it a good idea to make your own 3D system?
Wind Scar
Member #9,680
April 2008

Before anything, sorry for my english, I am not american

I am making a 2D game like POKEMON RUBY.
http://www.vgmaps.com/Atlas/GBA/Pokemon-FL-CinnabarIsland.png

But in this game you can't see what's on the sides or backwards of a building. I want something more complex. But I also think that using a heavy 3D engine like Ogre is too much for what I need. And I actually don't know anything about 3D engines (yet). So I thought, maybe I can program some simple kind of fake 3d using rotated/resized sprites, something like this (poor) example:
http://img25.imageshack.us/img25/7811/pokeperspectiva.jpg

I like the idea but I'm not certain if it will look better, and I also don't know how hard it will be to implement. So I have 3 options: false 3D, 2D or maybe to learn a 3D engine. What do you guys think is the best one? ???

EDIT: I have actually already made the code to convert a position (x,y,z) to it's right place on the screen, and I created some cubes and rotated them around. The next step is to make it with bitmaps not drawn lines, but I don't know how to draw bitmaps to fill polygons. If you do, please check this:
http://www.allegro.cc/forums/thread/599322

Darizel
Member #10,585
January 2009
avatar

You can probably get away with not using an actual 3D engine & just "faking" it, but I'm not sure how hard it would be.
You can also use an isometric-style engine. Don't know any off the top of my head.

----------
struthersgames.com - fun games for free download ;)
I am not an idiot.*
*in my opinion.

mystiscool
Member #4,441
March 2004
avatar

I would imagine that it wouldn't be that hard to write the game engine like a standard 2D top-down game, but then write a simple 3D display engine. The question then is how much is going to be in 3D and how much is going to be 2D - you could leave a lot of things (characters, objects, etc) as 2D sprites, and just render the buildings in 3D... the ground tiles could just be texture-mapped quads.

Instead of writing your own simple 3D engine, it would be simpler (especially for texture mapping) to use some low-level 3D library - not a game engine, maybe just the 3D routines in Allegro, or some simple OpenGL if you think you'd really want hardware acceleration.

Rejoice, glory is ours - our young men have not died in vain. Their graves need no flowers, the tapes have recorded their names.
ELP's lyrics about the evils of tape backup systems

Thomas Harte
Member #33
April 2000
avatar

OpenGL is much simpler than Allegro's routines - the Allegro 3d API is relatively poorly designed. And it won't be present in Allegro 5 anyway, so is a good thing to avoid. Probably Allegro 4.9 with the OpenGL driver is stable enough to use, AllegroGL is a smart option if you want to be safe.

If you really just want to draw cuboids with textures then full 3d shouldn't be very taxing...

Audric
Member #907
January 2001

The only game I know which uses such a view is the freeware Tapan Kaikki 4. Trying this game would be the easiest way to check if this view is really worth the effort or not.
Note that it will be much more difficult to model rocks, trees, etc. than if you only had to draw square tiles for them.

Wind Scar
Member #9,680
April 2008

I liked a lot that game. Very cool.

I wonder why people don't do it instead of plain 2D, when it's actually just a simple way to make it look better.

count
Member #5,401
January 2005

Quote:

when it's actually just a simple way to make it look better.

Maybe because plain 2d is more simple.

And to be honest I think plain 2d even looks better.

CosmicR
Member #6,889
February 2006
avatar

I think the original GTA did something similar too.

Audric
Member #907
January 2001

Yeah now that I remember, TK4 uses overhead view, so you don't see character faces. Not pretty for RPGs.
In your case, if you're really interested in bringing some depth, I'd rather recommand this kind of view:
{"name":"597843","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/b\/6b043ff95e34c0cb7a7be00004cbac16.gif","w":393,"h":296,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/b\/6b043ff95e34c0cb7a7be00004cbac16"}597843
This is done by projecting slightly the land tiles - I probably overdid it to illustrate, but then the top row shows twice more tiles than the bottom row.
And the houses are then added as flat 2D sprites, stretched according to their Y position.
Here's the work image I used, with emphasis on the separate elements.
{"name":"597842","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/5\/855cba0b17d829f676a405374d255e1d.gif","w":681,"h":353,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/8\/5\/855cba0b17d829f676a405374d255e1d"}597842
The big advantage is you can still use classic RPG sprites, such as ones created with "charas".
A drawback is that it requires a quite sharp resolution, or bililear filtering. The issue is not visible in my mockups as the program I used automatically resampled the houses when I resized them.

Sol Blast
Member #9,655
April 2008
avatar

What Audric is talking about seems similar to Mode 7 graphics.
You can find a great tutorial for implementing a basic Mode 7 effect here (near the bottom).

Thomas Harte
Member #33
April 2000
avatar

Mode 7 graphics are a special case of perspective in which depth from the camera does not change across individual rows of pixels. That makes them a lot cheaper to draw than an arbitrarily oriented textured plane and is why that sort of view was in video games before proper textured 3d was possible.

If you're going to stick with software Allegro then the algorithms in the tutorial provided by Sol Blast is probably the way to go. Allegro's polygon routines are another possibility. In this case you might actually find it a bit more taxing to go with OpenGL because you either need to be rigorous about how the 2d objects exist in the 3d world or you need to use the point sprite extension, which means some mucking about with OpenGL's extension mechanism. The end result will be substantially faster or less power hungry depending on your perspective (as a laptop user, I prefer the latter), but I wouldn't get too concerned about it. I'd still recommend it as a learning experience, but we're definitely into the realm of highly subjective opinions on that one.

Tobias Dammers
Member #2,604
August 2002
avatar

The huge advantage of Mode 7, back then, was not that it would be easier to implement (it is not), but that it's a lot faster than 'real' texture mapping, at least when you need to do it using a clock rate limited general-purpose CPU. Today, with GPUs that outperform even top-end CPUs at interpolating pixels, this is not something to really worry about.
Also, Mode 7 can be modified to support rotation about the up axis and free movement in the ground plane; even free movement in 3-space is possible, as long as you don't move the horizon - in other words, the camera's up axis must always remain aligned with the world's up axis.

Anyway, for now, I'd recommend you try either:
a) A 2D game engine with a top-down or orthogonal view (isometric or similar), using plain allegro; or:
b) A game engine with 2D or 3D mechanics (depending on the genre, but I assume 2D is hard enough for now) and actual 3D graphics using OpenGL (preferably through AllegroGL, since you'll want to keep the rest of allegro's functionality).

---
Me make music: Triofobie
---
"We need Tobias and his awesome trombone, too." - Johan Halmén

count
Member #5,401
January 2005

Quote:

(preferably through AllegroGL, since you'll want to keep the rest of allegro's functionality).

I want to throw in OpenLayer. Because it is easy to use and you can also keep the rest of allegros functionality.
want to point out that is is cpp though which shouldn't be a big problem.

Go to: