Sign up ×
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 – 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: – Jon Feb 12 at 10:11

3 Answers 3

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();


(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

I know this is kind of a cop-out, but I bet you can get a lot out of the Doom source code on github:

It has spurred more than a couple Doom-likes and at the very least is maintained well enough that you could emulate a lot of the implementation there and still be very original. Even if you don't have linux to compile it on, it's a great starting point for this kind of project.

share|improve this answer

If you're really reluctant to go into full-on 3D programming, I would suggest looking into raycasting. A very good explanation of this technique (coded in Javascript) can be found on this webpage.

Raycasting is pretty simple, mathematically. A raycaster's in-game camera will send out abstract "rays" that are meant to collide with solid objects in the environment. Upon collision, the engine receives the distance from the camera to the collision point, then renders a vertical subslice of the target texture, scaled down in proportion to how far away it was.

Due to the nature of a raycasting renderer, the camera / player itself can have full 360-degree motion and floating-point positional coordinates, even if your environment is defined as a discrete 2D array. This can help you with your need for the player to feel like he/she is moving around objects, rather than into them.

share|improve this answer

Your Answer


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.