How to make a First Person Dungeon Crawler - The basics

The 7th Circle and its sequel are modern example of old-school dungeon crawler. Despite what some people may think, they aren't 3D games, cause we used 2D engines to develop them.

So, how are they made? Regardless of the engine used, the theory is the same. I will try to explain it in this post.

First of all, you have to imagine a grid. Imagine to put it on the floor and to see it on a perspective.

enter image description here

This is your point of view. Every square on the floor is the base of a hypothetical "polygon" with 4 faces (we ignore the top and the bottom). You can only see one or two faces of these polygons. To see the other faces, you have to move around them.

For every block, you have an attribute. You can store these attributes on a simple table or on an array. For example: 0 is an empty block and 1 is a wall.

Now, you have to consider these variables for the PG: Direction, Position X,Position Y.

For every block, you have to create an object that can have a value of 0 or 1 and every time you move (X or Y) or change direction, you have to update the corresponding value of every block according to the table/array. This calculation can be a little tricky, but is based on the position of the PG on the table/array and on the difference of x or y between the PG and every visible block. Also, you have to repeat this procedure for every direction.

E.G. : You are facing north. The block that lies one step in ahed of you and one step on your left has the value of "1", so is a wall. Let's call this "block number 2" and let's assume that is the only "wall" block in the field of view.

enter image description here

As we said, it is a wall, so if we are facing north and if we are in the correct position, we will see something like this.

enter image description here

If we take a step back, the block 3 is now "the wall", while the block 2 is empty. If you change direction, another block will change is value to "1" and will appear as a wall.

enter image description here

Using more values for every block can give you infinite possibilities while creating your dungeon. You can also have different values for every face of the polygon.

This is a really basic explanation of the theory behind a first person dungeon crawler. It's not the only way to do it, but it's suitable for most game engines.