This repository contains a simple demonstration of raycasting implemented in Python using the PyGame CE library. Raycasting is a technique used in computer graphics to render a 3D scene in real-time by simulating the projection of rays from a virtual camera (player's viewpoint) onto a 2D plane (the screen).
Before running the demo, ensure you have the correct dependencies installed in a virtual environment:
pip install -r requirements.txt
To run the demo you just need to execute:
python main.py
Once the demo is running, you can control the player's movement and viewpoint using the WASD for tank-like control and the left and right arrows to rotate.
main.py
: Main script to run the demo. Contains theGame
class.settings.py
: Configuration file containing required constants.map.py
: Defines the map layout and theMap
class.player.py
: Defines the player class and its movement.raycasting.py
: Module containing the raycasting implementation.
This demo is inspired not just by the classic FPS game of the 90s but also by the following videos: