Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

ASCII Raycast Engine

A Wolfenstein 3D–style raycasting engine that renders a first-person 3D view in ASCII, live, in terminal. It does not use any graphics library.

What it does

The engine casts one ray per terminal column using a DDA (Digital Differential Analysis) grid-stepping algorithm — the same core technique used in classic raycasters — to find how far each ray travels before hitting a wall. Distance is then mapped to:

  • Wall height: closer walls fill more of the screen vertically
  • Shading: a density ramp (█▓▒░.: ) picks a denser character for closer surfaces and a lighter one for farther ones, with a subtle dimming applied to one wall orientation so vertical and horizontal surfaces read as visually distinct — a cheap but effective stand-in for directional lighting

A minimap in the corner shows the full map layout and the player's live position, and an on-screen HUD reports position, facing angle, and current FPS.

Controls

Key Action
W / S Move forward / backward
A / D Rotate left / right
Q / E Strafe left / right
Esc / Ctrl-C Quit

Running it

python asciiraycast.py
  • Unix/macOS: uses the built-in curses module — no install needed.
  • Windows: run pip install windows-curses first, then run normally.

The engine adapts to your terminal size at runtime (it'll ask you to resize if the window is too small), and is capped at 60 FPS.

Why I built this

Raycasting is one of the cleanest examples of getting real 3D-feeling perspective out of very cheap 2D math, and doing it in a terminal — with no framebuffer, no textures, just character density as a proxy for depth — makes you work with exactly what information a "3D view" actually needs: distance per column, and nothing else.

About

A first-person raycast engine that runs on terminal.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages