By Martin Lehner (@anotherlehner)
12/2025: I have restarted this project this year with the hope of finally finishing a full implementation of the tutorial using libtcod and the latest version of Zig! So far I have fixed all the parts so they once again build on linux and osx and should run without major issues.
To run each part cd into the folder and execute zig build run. To do this make sure you’ve installed the libtcod headers and the library itself, along with SDL2, on your system – see part-0 for some details on that.
Part 1 - Drawing the ‘@’ symbol and moving it around
Part 2 - The generic Entity, the render functions, and the map
Part 5 - Placing enemies and kicking them (harmlessly)
Part 6 - Doing (and taking) some damage
Part 7 - Creating the interface (IN PROGRESS)
Part 8 - Items and inventory (TODO)
Part 9 - Ranged scrolls and targeting (TODO)
Part 10 - Saving and loading (TODO)
Part 11 - Delving into the dungeon (TODO)
Part 12 - Increasing difficulty (TODO)
Part 13 - Gearing up (TODO)
A more “Traditional look (TODO)
Note: I have tried to roughly keep the parts of my tutorial the same as the parts of the typical python tcod tutorial so the content can be compared more easily and the flow is similar.
Each folder in this repository contains the full code to a part of the roguelike tutorial translated for Zig.
Disclaimer: This is my first Zig project so please do not consider anything here as idiomatic or a demonstration of how Zig programs should be written. This is simply a fun project to explore, try Zig out, and see how it feels. Consider it an anecdata point.
To create this project the following commands were executed:
mkdir zig-roguelike
cd zig-roguelike/
git init
The .gitignore file was setup with some initial folders. We want to ignore the zig cache and build folders so they’re not committed to git.
zig-out/
zig-cache/
See each part folder for a readme explanation of how that part was written, what issues I encountered, how I solved problems, and what I was thinking.
Enjoy!
The Roguelike Tutorials https://rogueliketutorials.com/
The roguelike tutorial in python https://rogueliketutorials.com/tutorials/tcod/v2/
Roguelike dev subreddit https://www.reddit.com/r/roguelikedev/
Note: I started this project in 2022 using a different username on gitlab.com (clockworkmartian) and have since come back to github and reclaimed my old anotherlehner account.
AI disclaimer: None of the code in this repository was written with generative AI. I do consult Gemini, ChatGPT, or whatever for finding documentation and helping solve a problem but I never copy and paste that code here. This is a personal project on my own time and as such I want to understand as much as possible about what I’m doing, how it feels to write code in Zig, and experiencing all parts of the process. This also includes my own tutorial narrative text, which is solely written by myself with no input from AI.