https://github.com/dnlzrgz/pytracer
A dead simple raycasting demo implemented in Python using PyGame-CE.
https://github.com/dnlzrgz/pytracer
demonstration pygame pygame-ce python python3 raytracer raytracing
Last synced: about 1 year ago
JSON representation
A dead simple raycasting demo implemented in Python using PyGame-CE.
- Host: GitHub
- URL: https://github.com/dnlzrgz/pytracer
- Owner: dnlzrgz
- Created: 2024-02-24T21:08:34.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-03-02T15:53:55.000Z (over 2 years ago)
- Last Synced: 2025-02-15T14:24:24.361Z (over 1 year ago)
- Topics: demonstration, pygame, pygame-ce, python, python3, raytracer, raytracing
- Language: Python
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PyTracer - A Dead simple Raycasting Demo
This repository contains a simple demonstration of raycasting implemented in Python using the [PyGame CE](https://pyga.me/docs/index.html) 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).

## Setup
Before running the demo, ensure you have the correct dependencies installed in a virtual environment:
```bash
pip install -r requirements.txt
```
# Running
To run the demo you just need to execute:
```bash
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.
## Demo Structure
- `main.py`: Main script to run the demo. Contains the `Game` class.
- `settings.py`: Configuration file containing required constants.
- `map.py`: Defines the map layout and the `Map` class.
- `player.py`: Defines the player class and its movement.
- `raycasting.py`: Module containing the raycasting implementation.
## Acknowledgments
This demo is inspired not just by the classic FPS game of the 90s but also by the following videos:
- [Building a Raycasting Engine in Python](https://www.youtube.com/watch?v=O_J8jRq6lBw)
- [Creating a DOOM (Wolfenstein) - style 3D Game in Python](https://www.youtube.com/watch?v=ECqUrT7IdqQ)
- [Make Your Own Raycaster Part 1](https://www.youtube.com/watch?v=gYRrGTC7GtA)
- [Make Your Own Raycaster Part 2](https://www.youtube.com/watch?v=PC1RaETIx3Y)