DEV Community

Chig Beef
Chig Beef

Posted on

Wolfenstein 3D Raycaster (Cosplore3D Pt:1)

Intro

This is a new series following Cosplore3D, a raycaster game to learn 3D graphics. This project is part of 12 Months 12 Projects, a challenge I set myself.

What Is The Game?

Cosplore3D Will be a space exploration and action game. There will be planets, spaceships, aliens, etc (although simple due to the raycasting nature of the graphics).

Why A Raycaster?

I think a raycaster is a great first step into the 3D graphics world, and really, if I can't make a raycaster, how could I expect to make a working full 3D engine. We're starting simple and working our way up, and I'll be showing this progress along the way here so you can follow along, make your own raycaster or space game.

Plan For The Month

Last month I made Pogo, which was a Python to Golang transpiler for the month of January. The issue with this project was that I only had 15 days on it, since I started halfway through the month. This led to some parts of the compiler being omitted. We have an entire month for this project (although it's the smallest month), and we need to make sure we work in each of the important sections.

  1. Programming Game Logic
  2. Art
  3. Audio
  4. These Posts

Outlining The Code

I'm a programmer, not an artist. This means when I think of a game, I start off by thinking about the actual code. Not even how it will look (other than what graphical style). I don't think about how it will sound either. Audio, visuals, and code each make or break a game, but since I'm learning the programming principles it's more important for me to really work hard on the code, so that will always take priority over slightly better art, or a better soundtrack.

I Hate Raycasting

I've been working on a bit of code and I already hate raycasting. My first issue is that I thought I was smart enough to implement one on my own without looking up anything. If you know anything about raycasters you would already know I got hit with the fish-eye effect.

This is an example of the fish-eye effect.

Now I've actually tried to work on raycasters beforehand, so I knew I would get caught by this, however, I knew the cosine trick. So I used the cosine trick and, well, I still had fish-eye. I searched up what my issue could be and found out I was still getting this effect because I was spacing my rays out evenly, which would be as if I projected an image onto a cylinder then flattened the cylinder. I fixed this issue and I still had fish-eye, I had a massive skill issue. It was very demotivating because I had no idea what was wrong, I was so sure that my code was right that I didn't even know how to fix what had happened.

Re-implementation

Now, I'm obviously going to have to work on re-implementing the code to actually work. I will have to do that in the next post since I spent so long trying to work out my method, and I need to get this post out.

After Fixing The Code

I will eventually fix the code, and after that we need a plan. Firstly, I think it would be a good idea to leave images out (at least raycasted images) until further into development. However, I would love to add colors to the game, and also work on the story, so that will be the main focus for the next posts.

Next

I'm sorry that this post is kind of missing anything really important, I've just spent so much time trying to fix this one issue, literally staring at a blank screen (': And don't worry, I'll try to add as much detail as I can about my mistakes, so hopefully you don't fall into the same thinking and end up stuck like me.

Top comments (0)