Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: 2D First Person Dungeon Crawler  (Read 8309 times)

0 Members and 1 Guest are viewing this topic.

Moonkis

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
2D First Person Dungeon Crawler
« on: November 26, 2012, 01:00:49 am »
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:


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?

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 10846
    • View Profile
    • development blog
    • Email
Re: 2D First Person Dungeon Crawler
« Reply #1 on: November 26, 2012, 01:46:26 am »
I'm not at all familiar with the topic either, but I've come up with quite a few more or less useful links and more important terms (Googling is all about finding the best terms).

But before I post them let me say that the 'old methods' where mostly used because there was no other way and most of them are very hacked or use some special mode (e.g. on the NES 'model 7'). So if you want to enter this area, good luck. ;)
As second side note, you could always write your own software 3D renderer, but let me tell you it's not easy and would kind of defeat your purpose... :)

With the term 'fake 3d' I came across this, which also lists different ways of doing things and links to other sites.
With the same term I also found this, which is kind of short and the source is down...
While searching for 'model 7', I came across the well known and often used term '2.5D' and covers mostly all ways to fake some depth, see this wiki article.
That article should give you quite a few other things to read and look into. ;)

As addition maybe you can hope for an answer from Groogy, who's been doing something similar (but in Ruby), see here.

Btw. if the scene is quite static and simply, you could also just use an image and scale the player as he moves and introduce some 'fake' boundaries. This is probably the easiest way to achieve a fake depth feeling and has been used in mostly all adventure games (King/Police/Space Quest but also Runaway (afaik) etc.). ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Moonkis

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Re: 2D First Person Dungeon Crawler
« Reply #2 on: November 26, 2012, 09:04:16 am »
After reading your post, I feel that maybe fixed 3D is the way to go ( I have been suggested this elsewhere also ), maybe it's time to actually take my time to do some fancy 3D OpenGL + SFML stuff?

Don't want to be a hassle but, maybe you know some good sources online? Sounds like it's just easier to textureize.

I'll look into both options! Thanks for such a quick and informative reply!

gyscos

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: 2D First Person Dungeon Crawler
« Reply #3 on: November 26, 2012, 12:17:17 pm »
Note that you don't need 3D though, many dongeon crawler similar to the one you mentioned successfully used 2.5d, and this can often result in very beautiful environments for a fraction of the work needed for a 3d scene. Shin Megami Tensei or Arcana on SNES comes to mind, but examples are too numerous to know them all.

The idea is to have tiles for each position of walls and floor / ceiling.

The "3D" view is split in floor, ceil and wall ; each is then split for each "depth" layer (1st layer, 2nd layer, maybe 3rd layer... I think most games stop at 5 layers or less).
Now, there are a few more tricks if you want to be able to see through openings in the walls.
This also means moves aren't easy to smooth, the basic approach will be to move a whole cell at a time.

In the end, it's a lot of little tricks, so it's far from easy, but it's definitely possible, and can be quite fun too.

Moonkis

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Re: 2D First Person Dungeon Crawler
« Reply #4 on: November 26, 2012, 12:51:21 pm »
Note that you don't need 3D though, many dongeon crawler similar to the one you mentioned successfully used 2.5d, and this can often result in very beautiful environments for a fraction of the work needed for a 3d scene. Shin Megami Tensei or Arcana on SNES comes to mind, but examples are too numerous to know them all.

The idea is to have tiles for each position of walls and floor / ceiling.

The "3D" view is split in floor, ceil and wall ; each is then split for each "depth" layer (1st layer, 2nd layer, maybe 3rd layer... I think most games stop at 5 layers or less).
Now, there are a few more tricks if you want to be able to see through openings in the walls.
This also means moves aren't easy to smooth, the basic approach will be to move a whole cell at a time.

In the end, it's a lot of little tricks, so it's far from easy, but it's definitely possible, and can be quite fun too.

I figured that is probably how you do it, have some sort of max view, which represents how far into the dungeon you can see in a straight line ( say if you were to stand in a long corridor ). From the screenshots of other games I think maybe 3-4 cells then if it's not a wall in the 4rth cell, use a black image to represent to corridor continuing.

But the real problem is positioning the graphics of the ceiling, walls and floors. I'm utterly bad of positioning GUI and stuff without an editor, but I'm guessing experimentation with values is the way to start?

gyscos

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
Re: 2D First Person Dungeon Crawler
« Reply #5 on: November 26, 2012, 01:38:18 pm »
The position are fixed, they'll always be the same. Perspective is easy, lines are radial and converge on a single point.

So first, make a picture of a blank endless corridor : that is, 4 converging lines. Then, slice them into "Z-levels".
If you want, you can first render a real 3D-computed corridor with the Z-level separations. POV-Ray is quite a handy tools for that. Here is an example :
http://gyscos.fr/povray/corridor.pov
http://gyscos.fr/povray/corridor.png

You now have polygons for each section. Paint on them to make beautiful tiles, split them into individual images (with alpha transparency around them), then draw them where they were on the original perspective.
« Last Edit: November 26, 2012, 03:47:33 pm by gyscos »

Moonkis

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Re: 2D First Person Dungeon Crawler
« Reply #6 on: November 26, 2012, 02:59:18 pm »
The position are fixed, they'll always be the same. Perspective is easy, lines are radial and converge on a single point.

So first, make a picture of a blank endless corridor : that is, 4 converging lines. Then, slice them into "Z-levels".
If you want, you can first render a real 3D-computed corridor with the Z-level separations. POV-Ray is quite a handy tools for that. Here is an example :
http://gyscos.fr/povray/corridor.pov
http://gyscos.fr/povray/corridor.png

You know have polygons for each section. Paint on them to make beautiful tiles, split them into individual images (with alpha transparency around them), then draw them where they were on the original perspective.
Awesome! Thanks man!
I'm also looking into the possibility of "Ray Casting", apparently a lot of the old school dungeon crawlers used it for their 3D-look.