English | MP4 | AVC 1920×1080 | AAC 44KHz 2ch | 96 Lessons (18h 13m) | 3.65 GB
Learn the theory and the implementation of a raycasting engine similar to the one used by Wolfenstein 3D with JavaScript and C.
This course will teach you how to create a complete raycasting engine from scratch. We’ll use an algorithm similar to the one used in Wolfenstein 3D. The final project will be coded using both JavaScript and C. It will implement player movement, 2D map view, 3D wall projection, textured walls, sprites, and other optimization techniques.
This course will be divided in two important parts:
1. The first part of the course uses JavaScript to cover the theory and the math behind the raycasting algorithm. JavaScript is a simple high-level scripting language that helps us not get too distracted with implementation details.
2. The second part of the course uses the C programming language to implement a compiled version of our raycaster, including textured walls and sprites. We’ll also use C to discuss important optimization and performance aspects of our code.
The tools you’ll need
You’ll need a web browser that can run JavaScript and a small C compiler. All these tools are cross-platform, so you can follow along with either Windows, macOS, or Linux!
The Wolfenstein 3D raycasting algorithm we’ll learn is heavily based on trigonometry, so make sure you have pen and paper ready for the lectures. I will make sure we review and understand every formula we find along the way!
Is this course for you?
This course has no prerequisites. We’ll cover all the math and the code as we go along, so even beginners with no prior experience are welcome to join!
There are faster raycasting algorithms out there, but we’ll try to stay faithful to the Wolfenstein 3D technique.
Table of Contents
1 Introduction and Learning Outcomes
2 How to Take this Course
3 An Overview of the Raycasting Algorithm
4 Raycasting or Raytracing
5 Raycasting Limitations
6 A Review of Degrees and Radians
7 A Review of Sine Cosine and Tangent
8 Defining the 2D Map Grid
9 Coding the Map Class
10 Player Movement
11 Coding the Player Movement
12 Coding the Map Collision
13 Defining the Field of View
14 Coding the Field of View Ray Increments
15 Finding Wall Hit
16 Finding Horizontal Intersections
17 Finding Vertical Intersections
18 Coding X-intercept and Y-intercept
19 Coding the Horizontal Wall Intersection
20 Coding the Vertical Intersection
21 Fixing the Intersection Offset Error
22 Orientation as Angles or Vectors
23 Wall Projection
24 Finding the Wall Strip Height
25 Visualizing the Minimap
26 Coding the Wall Rendering
27 Fixing the Fishbowl Distortion
28 Implementing Wall Shading by Depth
29 BrightDark Wall Sides
30 First Steps in C
31 Working with Makefile
32 Installing Visual Studio and SDL on Windows
33 Creating a SDL Window
34 SDL Rendering and Event Polling
35 Rendering SDL Rectangles
36 Game Loop Overview
37 Coding a Fixed Time Step Game Loop
38 SDL Delay
39 Drawing the Map with SDL
40 Player Movement and SDL Events
41 Implementing Wall Collision in C
42 Ray Struct and FOV
43 Translating the Horizontal Intersection to C
44 Translating the Vertical Intersection to C
45 Rendering Rays
46 The Color Buffer
47 Color Buffer Implementation
48 Freeing Allocated Resources
49 Creating the Wall Projection
50 Exercise Ceiling & Floor Solid Colors
51 Ceiling & Floor Solid Color Implementation
52 Representing Textures
53 Creating a Texture Programmatically
54 Mapping Textures to Wall
55 Implementing Wall Texturing
56 Multiple Textures
57 Multiple Texture Code
58 Fixed Size Data Types
59 Using Fixed Size Integer Types
60 Libraries to Decode PNG Files
61 Loading External PNG Files
62 Activity Field of View Distortion
63 Understanding the Angle Increment Distortion
64 Coding the Angle Increment Distortion Fix
65 Full Screen Window
66 Refactoring the Graphics File
67 Drawing Filled Rectangles
68 Refactoring the Map File
69 Refactoring the Ray and Player File
70 The Line Equation
71 Rasterizing Lines
72 Coding the DDA Line Algorithm
73 Refactoring the Wall Projection File
74 Creating a Type Definition for Color Values
75 Sending Parameters by Reference
76 Refactoring the Ray-Facing Code
77 Wall Texture Color Intensity
78 Coding the Texture Color Intensity
79 Raycasting Sprites
80 Sprite Type Definition
81 Coding the Sprite Typedef
82 Rendering Sprites in the Minimap
83 Identifying Visible Sprites
84 Coding the Visible Sprites
85 Finding the Sprite Distance
86 Normalizing Player Rotation Angle
87 Calculating the Sprite Projection Height
88 Calculating the Sprite X Position
89 Sprite Rectangle Position in the Screen
90 Displaying Textured Sprites
91 Activity Sorting Sprites
92 Sorting Sprites by Distance
93 Sprites Behind Walls
94 Fixing the Sprite Fishbowl Distortion
95 Concluding our Raycasting Implementation
96 Notes on Look-up Tables
Resolve the captcha to access the links!