From 20f5efa71715ff0378d27001b0084f238127c56a Mon Sep 17 00:00:00 2001 From: Edvin Jakobsson Date: Tue, 8 Sep 2026 19:12:07 +0200 Subject: Added README --- README.md | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..bb1ffb9 --- /dev/null +++ b/README.md @@ -0,0 +1,37 @@ +# SDL Raycaster + +A Wolfenstein 3D-style raycasting renderer in C, chasing the same trick old engines like Wolfenstein 3D and early Doom builds used to fake 3D on hardware that couldn't really do 3D: cast one ray per screen column into a 2D grid map, and draw a vertical wall strip whose height depends on how far that ray traveled before hitting something. No GPU pipeline, no triangles — just trigonometry and a grid. + +Getting the ray-casting step right was most of the project. It walks a ray outward along vertical and horizontal grid-line crossings separately, picking whichever hits a wall first, and has to correct the returned distance for the fisheye effect you'd otherwise get from measuring along the ray angle instead of straight ahead. A 2D minimap drawn alongside the 3D view, showing the map grid with every cast ray overlaid on it, made that math dramatically easier to debug — you could actually watch the rays fan out and see exactly where one was going wrong. + +There's also a separate little map editor (`maker.c`) for painting out wall layouts by hand instead of hardcoding a test map into the renderer — click tiles, pick a wall type with the number keys, save it out as a plaintext `.map` file. + +Movement, collision, and a working minimap all came together; enemies and weapons were the natural next step. + +## Controls + +Renderer (`doom`): + +- `W` / `S` — move forward/back +- `A` / `D` — strafe +- `Q` / `E` — turn +- Mouse — look + +Map maker (`maker`): + +- Number keys — pick a wall type +- Click — paint the hovered tile +- Saves the layout to a `.map` file for the renderer to load + +## Building + +Needs SDL2, SDL2_ttf, and libm. + +```sh +make # builds the renderer -> ./doom +make maker # builds the map editor -> ./maker +``` + +## License + +GPLv3 — see `LICENSE`. -- cgit v1.2.3