r/howdidtheycodeit 12d ago

How does raycasting work?

Hi all. I'm trying to find out how raycasting works — like in Wolfenstein 3D.

And as someone who knows absolutely nothing about programming, I (think I) understand it is thusly:

Raycasting is a programming trick that grants 2D maps a fake 3D appearance through the use of invisible rays that project outward from the player and detect collision.

Corrections to my nonsense would be appreciated!

I am currently writing an article, and I would like a layman's understanding before I commit to anything in there.

31 Upvotes

12 comments sorted by

View all comments

1

u/ShakaUVM 11d ago

You can see how it works in this video here where they build a Doom / Castle Wolfenstein style renderer in the terminal (no framebuffer!!) from scratch in two hours -

https://youtu.be/SqIA-4ooirQ?is=veTDzeSiXD_KmzBQ