Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » best method for fake 3d city enviroment level

This thread is locked; no one can reply to it. rss feed Print
best method for fake 3d city enviroment level
PCwizard200
Member #16,127
December 2015
avatar

Hi! I don't think in any way that there is one exact solution to this programming problem I'm having. You see I'm making a Robotech "fake 3d" "2.5d" FPS fan game and it has occurred to me In order to add a level in which the environment is not space but an actual city then I probably need an idea that would enable me to make buildings that not only have depth but have shape. Like a Cube would be your stereotypical city building shape. Now I could simply use sprites or even pre rendered sprites from fragmotion 3d modeler BUT I'm nervous if the shape, not the depth, is going to look downright FLAT. Therefore being a rather unattractive fake 3d level. I would like the player to see different sides of a cube like in Wolfenstein 3d. Do I have to use Raycasting though? is there other ways? like how would I use al_draw_line to draw a moving 3d cube then texture it because I saw a youtube video about that. If anyone has experience with this type of rasterization/fake 3d drawing please do give me some tips/advice.

SOME THINGS THAT SHOULD BE NOTED:

-This game is for myself for now, I don't want to deal with harmony gold deleting my work because my game has there product;)

-The game is going to be basic and will grow from there. arcade like gameplay with basic score keeping and a short space combat level kinda like wing commander, then a city level, only sound will be music for I will only be focusing on coding the fake 3d stuff for now

-I don't want to change my sprite to third person, FP all the way! I drew with a mouse the cockpit sprite from scratch

-I'm using the painters algorithm

-youtube video: https://www.youtube.com/watch?v=6NP-PFRIfpk

-I could use opengl, but I love old 2.5d way to much due to 90s nostalgia. Also I prefer to solve my programming issues with hacks like dividing by Z and so on instead of learning a whole new 3D API. And I make sprites faster than modeling in a 3d modeler, which is another reason why I like fake 3d so much is that it works great with sprites. So I don't want to use opengl.

EDIT:
Replies are still welcome but I found this link which is in a different language but might help.;D
http://www.creativebloq.com/3d/how-create-impressive-3d-graphics-css3-21410672
and this to!: https://docs.microsoft.com/en-us/dotnet/framework/winforms/advanced/how-to-rotate-reflect-and-skew-images

Arthur Kalliokoski
Second in Command
February 2005
avatar

All the old '90's 2.5d stuff used some sort of ray-casting for the easy-to-render walls and buildings etc. Sprites were reserved for irregularly shaped objects that ray casting would have serious trouble with, such as monsters or explosions.

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

PCwizard200
Member #16,127
December 2015
avatar

ok then, I'll try coding a raycast engine then. I was going to make simple textured cubes though by using the two links and perhaps other source material. everything else I need I already have/know how to exactly implement. Raycasting may be better though...

EDIT few hours later:

is there a way I can use opengl commands to draw textured cubes but still be able to use normal allegro 5 drawing commands at the same time with ease? I don't want to draw my sprites with opengl just the cubes perhaps. it would save me time while keeping most of the project that nostalgic feel.

Arthur Kalliokoski
Second in Command
February 2005
avatar

allegro-xxx/examples/ex_gldepth.c has a cube and a pyramid, you might study those.
The cube only has a texture on one side, but that's a mere detail.

“Throughout history, poverty is the normal condition of man. Advances which permit this norm to be exceeded — here and there, now and then — are the work of an extremely small minority, frequently despised, often condemned, and almost always opposed by all right-thinking people. Whenever this tiny minority is kept from creating, or (as sometimes happens) is driven out of a society, the people then slip back into abject poverty. This is known as "bad luck.”

― Robert A. Heinlein

PCwizard200
Member #16,127
December 2015
avatar

Thanks. just to make this post worth reading for others, is there a command in allegro 5 that would skew or shear an image?????

beoran
Member #12,636
March 2011

In allegro 5.2.x you can use the primitives add-on to do real 3d if you set the camera correctly. It can also be used to map a bitmap to a triangle allowing you to shear it. Look at ex_camera.C. or use transformations https://www.allegro.cc/forums/thread/610354

Edgar Reynaldo
Member #8,592
May 2007
avatar

Go to: