0
\$\begingroup\$

I'm trying to make a first person, pseudo-3D game similar to those of the '80s, where you walk around on a grid, and where all the walls can be the same height. Generally speaking, how would I create a 3D effect like this without actually making the game 3D?

Example: The original Might and Magic.

\$\endgroup\$
7
  • \$\begingroup\$ Do you have a concrete reference to a game that uses the effect you're after? \$\endgroup\$
    – Thomas
    Commented Feb 27, 2017 at 22:09
  • \$\begingroup\$ Maybe reference this? gamedev.stackexchange.com/questions/17504/… \$\endgroup\$
    – House
    Commented Feb 27, 2017 at 22:49
  • \$\begingroup\$ Very broad topic! 2d Isometric gamedev.stackexchange.com/questions/28396/… or parallax would be good, but you should really do that kind of peeking around before asking the question! \$\endgroup\$
    – user10968
    Commented Feb 27, 2017 at 23:08
  • 1
    \$\begingroup\$ It seems like you're looking for actual 3D, with Sprites to display enemies. Well known examples are all of the first 3D shooters. \$\endgroup\$
    – Peter
    Commented Feb 27, 2017 at 23:30
  • 1
    \$\begingroup\$ This seems too broad, and possibly even opinion based, especially when giving us the guidelines of "like those of the '80s". \$\endgroup\$
    – Gnemlock
    Commented Feb 28, 2017 at 5:13

2 Answers 2

2
\$\begingroup\$

One way to do this is to have each possible wall element drawn (offline, ie., at compile-time) in perspective and stored as an image. Your grid then needs to store for each cell which sides of the cell have which wall type (if any). Since you're presumably not handling any depth information, you can simply use the painter's algorithm to draw all walls from the furthest to the closest. Here, "drawing" means: selecting the correct image containing the wall element in perspective and blitting it to the screen.

For instance, in order to draw the following grid:

enter image description here

you would use the following wall images (here aggregated into a single texture sheet):

enter image description here

(Note that this sheet is not complete: for instance, the third wall element has no right-hand counterpart. In order to draw arbitrary scenes, you would have to have all possible wall elements available.)

Note that special items such as the torch would probably be separate images drawn on top of empty wall images at run time, unlike in the crude example I'm presenting here.

\$\endgroup\$
0
\$\begingroup\$

You're probably looking for raycasting. It can fake 3D with a 2D array of numbers and generate walls of all the same width/depth/height (giant blocks), but with different textures depending on what the number is. To actually do the raycasting, if you're using a game engine such as Unity, it might have built-in raycasting functions otherwise I would recommend using a library for it. At the player's 2D position you then send out a raycast from the player to where he's looking (think like this is a 2D top-down game, because it technically is) and then (usually) software render the wall bigger or smaller based on the distance.

See: http://lodev.org/cgtutor/raycasting.html

\$\endgroup\$
1
  • \$\begingroup\$ Please describe how this would be done, as link-only answers are deleted. This would fit more as a comment. \$\endgroup\$
    – Vaillancourt
    Commented Feb 28, 2017 at 0:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .