Skip to content

aswaroop976/raycast_wolfenstein

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 

Repository files navigation

Table of Contents

  1. Ray cast implementation similar to the game Wolfenstein 3D
  2. Running the code
    1. Untextured
    2. Textured
  3. How it works

Ray cast implementation similar to the game Wolfenstein 3D

Running the code

Untextured

  • navigate to the untextured directory and run “make”
  • next run “./raycast”. To navigate map use arrow keys
  • use “ctrl +” or “ctrl -” to change FOV(zoom in and out)
  • you can also try fisheye mode by running “./raycast fisheye”

Textured

  • still a work in progress

How it works

  • Inspired by: https://lodev.org/cgtutor/raycasting.html (most of the math was from the article here)
  • My implementation is done entirely in C from scratch using only the SDL library
  • The basic idea here is that the map is a 2D square grid, with each square being either 0 (no wall), or a value greater than 0 (a wall with a certain color)
  • The player effectively shoots out a bunch of rays in his FOV(field of vision), tracking how far each ray goes until it hits a wall. Then using that distance, we render a a vertical line, the size of which depends on the distance the ray traveled. Specifically the size of the vertical line is proportional to the inverse of the distance traveled(ie the closer the wall the larger the line drawn). After drawing all the lines we can render a view of the walls.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published