Zig raycaster fun
3fd2601a — tslil clingman 2 years ago
Corrected a small bug in colour blending: alpha == 0 is transparent
2463aa73 — tslil clingman 2 years ago
More texture bugs, hoorah
1a00dd23 — tslil clingman 2 years ago
No need to recalculate the index inside each loop


browse  log 



You can also use your local clone with git send-email.


Learning Zig by building a raycasting engine.


An explicit goal of this project is to do as much as possible in software. As such, except for the skyclinder, all of the rendering is done in software and hardware acceleration is only used to scale the resulting image.

In particular alpha blending is implemented in software. This was the result of an interesting diversion into unsigned integer arithmetic approximations of floating point computations.


  • [X] Basic textured raycasting
  • [X] View-bobbing, collision detection with walls, momentum etc
  • [X] Textured floors and ceilings
  • [X] Variable height walls
  • [X] Render tops of walls
  • [X] Static sprite objects
  • [X] Skyclinder*
  • [X] No overdraw (without sprites, skyclinder)
  • [X] Variable height ceilings
  • [X] Walls extending from ceiling instead of floor
  • [ ] Sprites look different from different directions
  • [ ] Animated textures
  • [ ] Fluid-like floors
  • [ ] Procedurally generated textures

*It's topologically a cylinder, not a box; hardware rendered for now


Ensure you have a recent version of Zig (tested on 0.9.0-dev.866+6a6e2cd64), and the csfml library somewhere we your linker can find it. Then run

zig build -Drelease-fast run

The default keybinds are FRST for Forward, Left Strafe, Backward, Right Strafe and the arrow keys for similar but turn instead of strafe. Escape exits.


The code is GPLv3+, the artwork is CC-BY-SA 4.0

I make use of the zig-sfml library, which is Copyright (C) 2021 Guigui220D under the terms of the MIT license. For details see src/sfml/LICENCE