This course includes

(updated Jan 2021)

  • 18 hours of on-demand video

  • Downloadable resources and exercises

  • Lifetime access

  • Access on mobile and desktop

  • Certificate of completion

  • 14 day money back guarantee

  • Secure checkout through Credit Card or PayPal


Before taking this course, you must have:

  • Some experience with coding (variables, if-else, loops, functions).

  • Some familiarity with either Linux, Windows, or macOS.

Is this course for you?

This course will teach you how to create a complete raycasting engine from scratch, with wall projection, textures, sprites, and many optimizations using the C programming language. We'll use a similar technique used by Wolfenstein 3D and discuss the mathematics that underpin any raycasting implementation.
Buy $34.99
Is this course for you?
Watch Intro Video

Introduction & Learning Outcomes

Focus on the fundamentals

We'll learn a similar technique used in the Wolfenstein 3D source code. We'll review all the required trigonometry, the projection formulas, and we'll also implement a very simple prototype using JavaScript to get the math out of the way before we dive into the C section of the course.
Buy $34.99
Focus on the fundamentals
Watch Intro Video

An Overview of the Raycasting Algorithm

Kicking things up a notch!

We'll proceed to learn how we can use the C programming language to implement all the basic elements of a raycasting engine. We'll learn how to draw textured walls, render sprites, enemies, while also learning how to structure and polish our C code.
Buy $34.99
Kicking things up a notch!

  • Lifetime access

    Enroll now and get lifetime access to the course content

  • Access to discussion forum

    Discuss course topics and engage with other students using the discussion board

  • Money back guarantee

    We offer a 14 day money back guarantee for all our courses. No questions asked.

Course Content

  • 2
    Trigonometry Review
    • A Review of Degrees and Radians
    • A Review of Sine Cosine and Tangent
    • Quiz: Trigonometric Functions
    • A Note on Different Raycasting Techniques
  • 3
    2D Map and Player Movement
    • Defining the 2D Map Grid
    • Coding the Map Class
    • Player Movement
    • Coding the Player Movement
    • Exercise: Map Collision
    • Coding the Map Collision
  • 4
    Ray Casting
    • Defining the Field of View
    • Coding the Field of View Ray Increments
    • Finding Wall Hit
    • Finding Horizontal Intersections
    • Finding Vertical Intersections
    • DDA Algorithm
    • Finding the Intersection with the Grid Cells
    • Coding the Horizontal Wall Intersection
    • Coding the Vertical Intersection
    • Fixing the Intersection Offset Error
    • Careful with JavaScript Ternary Operator
    • Orientation as Angles or Vectors?
  • 5
    Rendering Walls
    • Wall Projection
    • Finding the Wall Strip Height
    • Visualizing the Minimap
    • Coding the Wall Rendering
    • Fixing the Fishbowl Distortion
    • Spherical-Linear Distortions
    • Exercise: Wall Shading by Depth
    • Implementing Wall Shading by Depth
    • Bright/Dark Wall Sides
    • Exercise: Colored Walls
    • Coding Walls with Different Colors
  • 6
    Starting our C Project
    • First Steps in C
    • A Quick Note for Windows Users
    • Working with Makefile
    • Installing Visual Studio and SDL on Windows
    • Creating a SDL Window
    • SDL Rendering and Event Polling
    • Rendering SDL Rectangles
  • 7
    Creating a Game Loop
    • Game Loop Overview
    • Coding a Fixed Time Step Game Loop
    • SDL Delay
  • 8
    Map and Player Movement
    • Drawing the Map with SDL
    • Player Movement and SDL Events
    • Exercise: Wall Collision in C
    • Implementing Wall Collision in C
  • 9
    Casting Rays in our C Project
    • Ray Struct and FOV
    • Translating the Horizontal Intersection to C
    • Translating the Vertical Intersection to C
    • Rendering Rays
  • 10
    Color Buffer
    • The Color Buffer
    • Color Buffer Implementation
    • Freeing Allocated Resources
  • 11
    Wall Projection
    • Creating the Wall Projection
    • Exercise: Ceiling & Floor Solid Colors
    • Ceiling & Floor Solid Color Implementation
  • 12
    Wall Textures
    • Representing Textures
    • Creating a Texture Programmatically
    • Mapping Textures to Wall
    • Implementing Wall Texturing
    • Multiple Textures
    • Multiple Texture Code
    • Fixed Size Data Types
    • Using Fixed Size Integer Types
    • The Operator Sizeof
    • Libraries to Decode PNG Files
    • Loading External PNG Files
    • Using upng with Visual Studio
  • 13
    Fixing the Angle Increment Distortion
    • Activity: Field of View Distortion
    • Understanding the Angle Increment Distortion
    • Coding the Angle Increment Distortion Fix
  • 14
    Refactoring Project Files
    • Full Screen Window
    • Refactoring the Graphics File
    • Exercise: Drawing Rectangle
    • Drawing Filled Rectangles
    • Refactoring the Map File
    • Refactoring the Ray and Player File
  • 15
    Rendering Lines
    • The Line Equation
    • Rasterizing Lines
    • Coding the DDA Line Algorithm
  • 16
    Refactoring our Code
    • Refactoring the Wall Projection File
    • Creating a Type Definition for Color Values
    • Sending Parameters by Reference
    • Refactoring the Ray-Facing Code
    • Wall Texture Color Intensity
    • Coding the Texture Color Intensity
  • 17
    • Raycasting Sprites
    • Sprite Type Definition
    • Coding the Sprite Typedef
    • Rendering Sprites in the Minimap
    • Identifying Visible Sprites
    • Coding the Visible Sprites
    • Visible Sprites in Wolfenstein3D
    • Finding the Sprite Distance
    • Normalizing Player Rotation Angle
    • Calculating the Sprite Projection Height
    • Calculating the Sprite X Position
    • Sprite Rectangle Position in the Screen
    • Displaying Textured Sprites
    • Activity: Sorting Sprites
    • Sorting Sprites by Distance
    • Sprites Behind Walls
    • Fixing the Sprite Fishbowl Distortion
    • Concluding our Raycasting Implementation
    • Sprite Animation & Enemies
  • 18
    Conclusion & Moving Forward
    • Notes on Look-up Tables
    • Conclusion & Next Steps
    • Copyright & Content Distribution
    • Similar Courses


  • Gustavo Pezzi

    Senior Lecturer

    Gustavo Pezzi

    Gustavo teaches computer science and mathematics at BPP University, London. He studies how teaching game programming can help enhance awareness and understanding of basic mathematics and physics. He is also a professional programmer with several years of experience in the computing industry. His academic path includes institutions such as Pittsburg State University, City University of London, and University of Oxford.