My first attempt at writing a videogame. Written in C, using Raylib.
  • C 80.2%
  • Zig 18.4%
  • Nix 1.1%
  • Just 0.3%
Find a file
2026-04-10 11:15:44 +00:00
assets/sounds audio: refactor audio asset loading, add crit sound 2026-04-06 17:51:07 -04:00
docs docs: move README to docs/; reword most sections 2026-04-09 09:36:18 +03:00
libs/combat combat: buff status effects 2026-04-05 22:36:34 +03:00
nix nix: apply a source filter to the main package 2026-04-08 15:34:19 +03:00
src various: persist seed display; fix seed 0 handling 2026-04-10 14:15:20 +03:00
.clang-format chore: setup clang-format for formatting 2026-04-03 15:45:13 +03:00
.editorconfig build: migrate from Make to Zig build system + Just 2026-04-05 20:29:11 +03:00
.envrc nix: add direnv manifest 2026-04-03 15:45:17 +03:00
.gitignore build: migrate from Make to Zig build system + Just 2026-04-05 20:29:11 +03:00
build.zig movement: generalize; use vectors (#16) 2026-04-09 14:11:46 +00:00
build.zig.zon build: 'lock' zig build setup 2026-04-08 15:38:19 +03:00
flake.lock nix: bump nixpkgs 2026-04-05 00:18:50 +03:00
flake.nix nix: add a package alias 'rogged' in flake outputs 2026-04-08 15:34:20 +03:00
Justfile meta: look for zig files only in libs/ 2026-04-05 22:36:35 +03:00

Rogged

Turn-based, infinite roguelike dungeon crawler built with C99 and with a dash of Zig. Meant to serve primarily, but not exclusively, as a learning opportunity. Rogged is basically a classic roguelike where you descend through floors of a procedurally generated dungeon, fighting enemies, managing inventory, and trying to reach the bottom alive or die chasing a highscore!

The game itself, be it the code or mechanics, is heavily in development. For now, a non-exhaustive list of its (current) features are as follows:

  • Turn-based combat with damage variance, critical hits, dodge, and block mechanics
  • Damage classes (Slash, Impact, Pierce, Fire, and Poison)
  • Status effects (Poison, Bleed, Stun, Weaken, and Burn)
  • Various enemy classes (Goblin, Skeleton, Orc) with distinct resistance profiles
  • Procedural dungeon generation with rooms and corridors, seeded per floor
  • Inventory and equipment system (weapons, armor, potions)
  • Procedural audio via raylib
  • ASCII-inspired tile rendering, with HP bars and floating damage text

There are still some features lacking polish, or lacking any kind of attention to be viable. For a semi-complete list of things that need to be done, see the future plans section.

Build Instructions

Rogged is built on a relatively simple stack. It uses C99 for the main game logic, and Zig for the combat library. Besides raylib and pkg-config, you only need the core Zig tooling. For now the required Zig version is 0.15.2, but this might change in the future. Additionally, you will need clang-format and just for common development tasks in the case you plan to contribute. For building, Zig is enough.

The recommended way of developing this project is using Nix and relying on devshells for pure, reproducible developer environment across all machines.

If you are a Direnv user, you may simply run direnv allow or you may use nix develop to enter the default shell.

# Enter the development shell
$ nix develop

# Build and run
$ just dev

Manual Build

If you are allergic to good tooling and would rather use your system Zig, you may simply invoke zig build after acquiring Zig 0.15.2.

# Full build
$ zig build

# Build and run
$ zig build run

# or
$ just dev

The Justfile provides commands that work across both methods.

Task Runner Commands

There's a Justfile designed to make common tasks somewhat easier. For now, they are as follows:

just build       # zig build
just dev         # zig build run
just clean       # remove zig-out/ and .zig-cache/
just fmt         # format all C and Zig source files
just fmt-check   # check formatting

If the project gets more complicated, new tasks might be added.

Future Plans

The game is currently playable end-to-end, but it lacks a fair bit of polish to claim its place as a fun, engaging roguelike you can just boot up and play. Some of the features that are planned for the future, in no particular order, are as follows:

  • Better enemy AI - The current AI is very simple.
  • Fog of War - Instead of loading the entire map, let the player discover the rooms
  • Save / Load system - Persist and restore game state between sessions
  • More enemy variety - Additional enemy types with unique abilities
  • More item variety - Rings, wands, scrolls, and cursed items
  • Multiple floors beyond 5 - Endless or configurable depth
  • Test suite - Unit tests for combat math, dungeon generation, and RNG
  • Field of view - Fog of war and line-of-sight mechanics
  • Level transitions - Upward stairs and floor teleportation
  • Achievements / death log - Track runs and causes of death with a leaderboard
  • UI polish - Better message log history, item descriptions, death screen

Later down the line it might be an interesting choice to provide a scripting API, likely with Lua, to allow customizing the game state and events. Though, that is for much later.

Attributions

This project draws a fair bit of inspiration from Shattered Pixel Dungeon. While the mechanics are generally different, and commit to remain as such, I cannot deny the amount of inspiration & ideas Shattered Pixel Dungeon has given me. It's a GPL licensed project, and no code was borrowed. Still, some resemblance may occur.

Additionally, huge thanks to Raylib for how easy it made graphics and audio. This was perhaps my best experience in developing a graphical application, and CERTAINLY the most ergonomic when it comes to writing a game.


I got rogged :/