Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I'm interested in creating a 2.5D first-person shooter (like Doom) and I currently don't understand how to implement the player moving forward. The player will also be able to browse around the world (left, right, up, down) via gyroscope control. I plan to only use 2D sprites and no 3D models.

My first attempt was to increase the scale of layers to make it appear as if the player was moving toward the objects but I'm not sure how to make it seem as if the player is passing around the objects (instead of running into them).

If there are extensions that I should take a look at (like Cocos3D), please let me know. Thanks for the help!

share|improve this question
    
One can use 2d images in a 3d world (a.k.a billboards). I'd just go 3d if I were you [but I know nothing of cocos3d]. –  Willem Dec 9 '12 at 6:34
    
Here you can find some info on how to build a game like that cocos2d-iphone.org/forum/topic/21050 –  Setrio Dec 13 '12 at 11:50
    
After a little more research, I think you'll probably (two years ago) use Cocos3D and some type of billboard. I followed the preceding link and, being a forum, it seems to be littered with information. Although a pointed search could return useful results, I thought an "official" link would be superior: github.com/cocos3d/cocos3d/wiki#Learning –  Jon Feb 12 at 10:11

1 Answer 1

Your solution, thus-far, implies you are already calculating depth to determine the scale factor needed to simulate perspective. To make objects move "behind" the camera, test that same depth when you draw them and do not draw objects whose depth indicates they should be behind the camera.

 if (object.sceneDepth >= 0) object.Draw();


Re:

(like Doom)

I recommend going 3D, although I can't recommend any specific extensions. I would not avoid using 3D because of a perceived learning curve.

Doom and many other games use animated "billboards" to quickly approximate 3D. A billboard is simply a textured quad that always faces the camera. As the billboard rotates, the texture displayed on it can be animated to reflect the camera's new location and perspective. This allows you to render in "3D" while only actually rendering 4 vertices.

So, to answer your question, while you are able to render 2D sprites at different depths into the screen, it would be complicated, at best, to splice that together into something "like Doom".

If you look at the textures for Doom, you will find that every pose, for every creature was pre-rendered. When you move "behind a monster", the billboard is turned to face you, and the front-view monster texture is replaced with the rear-view monster texture. They were all 2D textures, drawn on 2D squares, oriented in 3D space.

Grass and trees are sometimes rendered with only one texture, but it is obvious because the trees can be easily noticed turning to face you. Their use is also evident in games where the grass becomes visible and appears to "stand up" when the camera gets close.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.