Skip to content

JatinChopra/2D-Raycasting-Renderer

Repository files navigation

⚙️ 2D-Raycasting-Renderer

I made this 2D raycasting renderer that generates a pseudo 3D prespective for a simple doom/wolfenstein3d like game.

Run : https://2-d-raycasting-renderer.vercel.app/
View related post on Twitter , LinkedIn.

The player cast multiple rays from its position within the grid detecting walls and generating the scene based on ray intersections. In the 3D-like world the walls are made up of very thin vertical rectangle strips - a strip for each ray - the height of the strip is inversely proportional to the distance covered by the ray. Added Quake IV texture on the walls to make it look cool.

Here is how it works

  • The player moves around a 2D grid-based world.
  • Rays are cast at regular angular intervals within the player's field of view.
  • Each ray uses the DDA (Digital Differential Analyzer) algorithm to efficiently step through the grid and detect wall collisions.
  • Vertical strips are rendered for each ray, with height inversely proportional to the ray's distance.
  • A Quake IV wall texture is applied to enhance visual appeal.

Screenshots

image

image

image

Resources

3D Sage Raycasting Series
DDA explanation by javidx9

About

=> This is a 2D raycasting renderer that generates a pseudo 3D prespective for a simple doom/wolfenstein3d like game.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published