Skip to content

benjdero/RayCaster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RayCaster

Introduction

This was one my favorite school project, so I decided to rebuild it, using C++ and SDL, and add more features such as wall textures and a map editor.

Definition

What is a RayCaster?

Raycasting is a technique used in computer graphics and game development to simulate a 3D perspective by projecting rays from the viewer's point of view into a 2D map. It determines what the viewer sees by detecting the first object each ray hits, allowing for efficient rendering of scenes.

Screenshots

Screenshot 1 Screenshot 2 Screenshot 3 Screenshot 4

Setup

Linux

On Linux, you can simply download the dependencies from your favorite package manager:

sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev

Mac

On Mac, use brew to set up the required dependencies:

brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer

Windows

On Windows, run the provided batch script setup-windows.bat to download and install the dependencies.

Build

cmake . -B cmake-build-debug
cd cmake-build-debug
make

Run

./RayCaster

Options

  • -w 800 Set window width to 800px
  • -h 600 Set window height to 600px
  • -f Enable fullscreen mode
  • m myworld.wld To use world stored in file myworld.wld

Controls

Game

Key Action
ESC Exit
Z Move forward
Q Strafe left
S Move backward
D Strafe right
+ Zoom in
- Zoom out
² Show/Hide fps counter

Editor

Key Action
ESCAPE Exit
0 - 9 Select texture
+ Next texture page
- Previous texture page
Left click Set tile
Right click Remove tile
Shift (hold) Move the map
S Save world

About

Raycasting engine with wall textures and map editor made with C++ and SDL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages