A simple 3D raycasting demo inspired by Minecraft, rendered in the terminal using ASCII characters and color codes.
You need a C compiler (like GCC) and the make utility installed.
- macOS:
- Install Xcode Command Line Tools:
xcode-select --install
- Install Xcode Command Line Tools:
- Windows:
- Install MSYS2.
- From the MSYS2 terminal, install the necessary tools:
pacman -S mingw-w64-x86_64-gcc make
- Linux:
- Use your distribution's package manager, e.g.,
sudo apt update && sudo apt install build-essential(Debian/Ubuntu) orsudo dnf groupinstall "Development Tools"(Fedora).
- Use your distribution's package manager, e.g.,
- Clone the repository (if you haven't already).
- Navigate to the project directory in your terminal (or MSYS2 terminal on Windows).
- Run the
makecommand:This will compile themake
minecraft.csource file and create an executable file namedminecraft(orminecraft.exeon Windows).
After successful compilation, run the executable from your terminal:
- macOS / Linux:
./minecraft
- Windows (MSYS2 terminal):
./minecraft.exe
Make sure your terminal window is large enough to display the output correctly (recommended ~180 rows, ~900 columns, although you can experiment).
w/s: Look up / downa/d: Look left / righti/k: Move forward / backwardj/l: Strafe left / rightx: Break the block you are looking at (highlighted green 'o')space: Place a block ('@') on the face of the block you are looking atq: Quit the game
To remove the compiled object file and executable, run:
make clean