Skip to content

luna7111/turtledove-RC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

102 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Turtledove-RC

Turtledove-RC is a lightweight ray-casting engine that renders 3D enviroments from 2D text based-maps, similar to Wolfenstein 3D's.

Overview

The program renders a real-time 3D representation of a 2D map defined in a text-based input file. You can move freely through an environment with solid walls.



image

image

Map info is contained in .cub files which contains texture paths for each wall orientation, RGB colors for floor and ceiling and a 2D map layout using ASCII characters.

Building

To compile the project yourself simply clone the repository and run make inside the root directory of the repository.

git clone https://github.com/luna7111/turtledove-RC
cd turtledove-RC
make

Note

This project depends on MiniLibX, which requires the following system requirements:

  • MinilibX only supports TrueColor visual type (8,15,16,24 or 32 bits depth)
  • gcc
  • make
  • X11 include files (package xorg)
  • XShm extension must be present (package libxext-dev)
  • Utility functions from BSD systems - development files (package libbsd-dev)
  • e.g. sudo apt-get install gcc make xorg libxext-dev libbsd-dev (Debian/Ubuntu)

Running

To run the program execute the binary and use a valid .cub map as an argument, some test maps are listed on the maps/valid/ directory, but feel free to create your own, be creative!

./cub3D maps/valid/example.cub

Tip

Use the WASD keys to move around the map. Use the left and right arrow keys to rotate the camera.

The ray-casting algorithm

For each frame, walls are scanned from left to right across the player's field of view by casting one ray per vertical screen column.


sweep image

To avoid iterating over a large number of small steps along the ray's path, we used a Digital Differential Analyzer (DDA) algorithm to progress from cell to cell in discrete steps rather than continuous increments. It calculates the distance to the next grid boundary along both the X and Y axes independently, and uses the smallest one of them.


raycast-ray


image

Made with love by caroldmg and luna7111 <3

About

Ray casting engine, similar to Wolfenstein 3D's.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors