First person 2D Dungeon Crawler

Started by
8 comments, last by PureSnowX 11 years, 5 months ago
I'm inspired to make a 2D FPV Dungeon Crawler like Arcana, Eye of the Beholder.
You know when you see a psuedo 3D dungeon in a first person perspective like this:
Eye-of-the-Beholder.jpg

Now, I'm note sure that SNES supported 3D so I suppose it was all done in 2D, I know that all tiles are drawn to look 3D when pieced together.

It's just that I have no idea on how to code this, at all, not even the simplest clue. I have done 2D top-down and side-scrolling but not a 3D-looking 2D dungeon with "depth". I know this can be achieved through 3D-programming with z-depth and all that fancy stuff, but I'd REALLY just like to do it in 2D, the classical way.

I figured some of you old foxes might know how to code this, and might nudge me in or explain it. I'v tried googling it but I came up with 0 topics around first person view in 2D.

The harders part I can imagine is scaling and positioning the walls, floors and ceilings that's further away so it looks like a complete hallway that you can see a defined amount of "cells" into.

Items, Monsters and other stuff is just plain scaling and not much piecing together with the other tiles so it shouldn't be hard to do.

So how do you do a 2D first person view for a Dungeon Crawler using strictly 2D?

I'm going to use SFML and C++ and I'd like to avoid 3D programming as much as possible, strictly using 2D skills.
So anyone got any ideas on how to achive this?
Advertisement
Hello Moonkis,
I'm assuming you want smooth scrolling like Wolfenstien 3d correct? You might be able to find someone to help you build a basic 3d engine for this purpose. If you do not allow the person to spin, so he can only move forward and back:
For this solution your field of view is 90 degrees, facing a wall would cover the entire screen at depth 0. At depth 1, the wall would be half the size, at depth 2 a fourth,... The distances from the center would also shrink in this manner.

Also, if you don't allow the person to move forward and back, you could precompute the shapes like and old school rpg and have the player jump forward or back.
What you're describing sounds very much like Legend of Grimrock.

From what I've gathered, SFML has a window package that integrates with OpenGL, so all your 3D graphics needs should be covered. Unfortunately there is some level of 3D graphics programming and knowledge required to get even the most basic scene up and running, regardless of whether or not all the gameplay itself takes place on a 2D plane.

The best online resource I know of for learning OpenGL (and 3D graphics along the way) is NeHe. The first dozen or so legacy tutorials should give you enough information to get started. There are also a bunch of other links and references you can follow from there for advanced topics.
The old 8-bit games used bitmaps representing a wall from every different view. The image on screen is then pasted together, using these pre-drawn walls, to give a 3d image. Enemies, items etc are scaled depending on how far away they are from the player. More modern games use a 3d engine which just replicates the view, but in real 3d.
My own game uses 3d blocks which are placed within a level to make a maze. However movement is restricted to 1 unit 'steps' and the view is restricted to 90 degree views, making it 'feel' like an old-school game, even though there is no reason why you couldn't run around the maze and view it from any angle.

http://www.deepfall.moonfruit.com

eob3.png
2.jpg

The old 8-bit games used bitmaps representing a wall from every different view. The image on screen is then pasted together, using these pre-drawn walls, to give a 3d image. Enemies, items etc are scaled depending on how far away they are from the player. More modern games use a 3d engine which just replicates the view, but in real 3d.

This is exactly what I want to do, and I know how it's represented just not how to achieve it, and I really don't want to do it with a modern approach using 3D ( After all that is what I asked in my first post ). Since the old games didn't use 3D ( Did they? Did SNES support 3D? ) it must be possible without using 3D strictly using 2D? If so, then how would you achieve that code-wise? Think Eye of the Beholder and Arcania for SNES.
There are two ways to go at this within the SNES-constraints.
1) Create a lot of pretransformed versions of your sprite. So for example <sprite>_frontal_distance0, <sprite>_frontal_distance1, ..., <sprite>_left_distance0, <sprite>_left_distance1, ..., <sprite>_right_distance0, <sprite>_right_distance1. Then you just have to blit the right sprites in.
Advantages: can take the non-planar nature of the sprites into account if the sprites are prerendered instead of just pretransformed.
Disadvantage: you will need a lot of space for each sprite; need to write/find/buy a tool to automate the sprite creation or it is a real lot of work.
2) Have one sprite and do a perspective projection on the fly (just a simple blit from a 2d rectangle to a 2d trapezoid). I'm unfamiliar with the exact capabilities of the SNES but I remember it had a lot of fancy 2d blitting implemented in hardware, if it can do something like that you get a (very) reduced version of modern 3d graphics.
Advantages: does not require extra work doing asset creation.
Disadvantages: might not look very good; math to be implemented probably requires a decent understanding of how 3d graphics work.
Try this link: www.permadi.com/tutorial/raycast/

...or search using the terms "ray casting", "2.5d".

(Posted from mobile - apologies for the brevity and any errors.)

- Jason Astle-Adams

This technique is know as "Ray Casting". Will make it easier for you to search for tutorials and whatnot. smile.png

Edit: Woops, was beaten to it!
You might also look at the doom-engine (sources are available). It doesn't have the limitation of "90° walls" and there are tons of rersources for it, e.g. editors which you could use to create your own worlds. And there are different ports of "doom" with using OpenGL.
WOW awesome guys thank you so much!
I'll look into it! You are all so very helpful! Damn! :D

This topic is closed to new replies.

Advertisement