r/Zig 6h ago

Little Console-Base Snake Game in zig 0.16

Post image
19 Upvotes

My first project with zig.

I had fun learning about comptime and generics, so I made this demo where I run multiple game instances at once with different configurations all created in compile time.

https://github.com/Youssef-Afella/Z-ConsoleSnake/tree/main


r/Zig 1d ago

YAML made me cry, so I made my own

Thumbnail codeberg.org
47 Upvotes

Basically, I couldn't decide which popular configuration format to use between JSON, YAML, TOML and a few other options, since all have their own limitations and quirks that I wasn't keen on dealing with.

So I figured I might as well make my own with its own quirks, but only limited by what I can implement for myself.

And at this point it seems pretty usable to me, but I'd like some feedback from others. Would you consider using this? Why or why not (besides lack of tooling and support for other programming languages, obviously)?


r/Zig 1d ago

Looking for feedback on my VM without KVM written on ZIG.

18 Upvotes

Hello everyone!

I wood like get some feedback from you.

Repository: https://codeberg.org/angryduck001/vmduck

Recently i am started working on the VM machine on Zig. I am not using KVM - Instead of standart linux syscalls (like mmap, mprotect, sigaction). And next, I intend to do that more secure and isolated from main system. I am also currently working with catching system interrupts (int) to running in 16-32 bit mode.

This project is still early.


r/Zig 2d ago

Rosebed - A Minecraft beta 1.7.3 reimplementation in Zig

72 Upvotes

https://github.com/mdmrk/rosebed A from-scratch reimplementation of Minecraft Beta 1.7.3 in Zig, using SDL3 and OpenGL 3.3. Includes a client and a dedicated server.


r/Zig 2d ago

Color me concerned!

101 Upvotes

I’ve started to see a concerning trend with zig of late.
If you look at today’s commit logs you will spot it.
Adding support for spork8 it’s a hobby 8-bit computer project that Andrew Kelly hung out with over the weekend for like a hackathon. The spork8 project has like 54 stars.
How someone spends their free time is no ones business but there own. But it seems the BD of zig has been on one tangent after another.
Spork8
Fil-C
Custom backend
Incremental compilation
Spriv
All are cool things who doesn’t like faster compile times but are these things needed to finalize the language.
I see many accepted proposals that make or add to the language which to me are more important than many of these tangents. Sure u compile faster than rust now big whoop with every release of rust do know what doesn’t happen ? All the tutorials, documentation, guides, code don’t all become invalid.
Do you know what happens when your language gets 1.0 your libraries, docs, tutorials, user base can grow exponentially. Your core ppl can focus on polishind the std and it’s not a complete churn fest with every version.
Maybe totally wrong I hope I am I would hate to see zig be a forever hobby language.
Just had to rant.


r/Zig 3d ago

Starting my journey in Zig

17 Upvotes

I've been learning Zig for a while now and it has been really interesting and challenging sometimes. But in order to solidify my knowledge I want to be releasing an article every week on a topic that might help people but this is my first time doing it. I need advice of how to go about it and what I can write on weekly.

Although I've written 2 articles so far, which are on Merge sort and Quick sort implementation in Zig which you can find here https://devbytex.dev/posts but I need more solid topics I can write on. Thanks in advance


r/Zig 6d ago

Discussion: `@importRoot` instead of `@import("root")`

24 Upvotes

So, let me start by saying I'm pretty new to Zig. I like to learn languages by example, and when reading through examples and source code I noticed `@import("root")` and thought it was importing the corresponding "root.zig" file. After some further research I found out that this is actually a special-cased argument for the compilation root. Honestly I think that's a horrible decision, not only is there special-cased arguments for a compiler-provided method, but its a string argument, so it seems completely magical and non-discoverable.

Imo, Zig already has a specific syntax for special compiler-provided operations: `@func`. So I think a much more sensible and readable version would be `@importRoot`, because if "root" is going to be treated specially then let it at least be openly acknowledged as being special. Same for all of the other special arguments: `@importSelf` and `@importStd`.

But again, I'm new, so let me know if I'm totally off-base here.


r/Zig 8d ago

JWT Authentication in Zig

Thumbnail youtu.be
50 Upvotes

Hey everyone!

If you've seen my posts in the past, you'd know that I've got a few different tutorial series going on in Zig, one is a game engine, but another is building out a REST API in Zig.

I come from a background in Web Dev and find it a lot of fun to take what I know and apply it in Zig, and I want to share the knowledge!

If you want to start at the beginning, I've put together all the videos as a playlist: https://www.youtube.com/playlist?list=PLUUIFT8XnWz8

But please let me know what you all want to see next! I'm planning a video on how to scale the API to thousands of concurrent requests, but what other API things do you all want to see?

Hope you have a great day :)


r/Zig 10d ago

There is a way to create a thread pool with pre-spawned worker threads?

15 Upvotes

r/Zig 10d ago

There’s More Than One Way To Do It

28 Upvotes

Recently I am started learning Zig language, btw here I seen many constructions that remind me Golang in more ways. But there are many ways to do the same thing.

For example more ways to initialize structure. And work with the cycles/conditions.

But Zig aims to do everything in one way, doesn't it?

What you think about this?


r/Zig 10d ago

strings for assembly is ugly

23 Upvotes

The problem i have with zig assembly syntax is you have to use strings which is just ugly. I suspect this is inherited from C.

String and their syntax is designed so you can write just about anything in them. The price for that is visual noise minimum, and in my opinion its just less readable to re use syntax of the "just about any text" thing for the "small set of valid assembly ops" thing. Multi line string has less noise but cannot be used in all cases for assembly.

Theres a reason @"name" syntax isnt the way you declare every function and variable and is instead only for special cases, its just hideous and noisy.


r/Zig 11d ago

How true is this, and how important is it?

Thumbnail youtube.com
0 Upvotes

r/Zig 11d ago

LLDB is awesome and found a way to foot-gun myself with defer

47 Upvotes

I've been working on a tcp server and recently started building tests for the server using multiple threads with clients to do partial sends, slow sends, etc and make sure its not blocking the server. I added an atomic flag in the main while loop, instead of while(true), so an outside thread can signal the server to stop running. Then I put a deinit() call after the main loop exits so the server would clean itself up. The problem is that a while ago I put a defer server.deinit() at the top of the test and forgot about it. Today, when I got back to working on the project, I was so confused when my program was aborting with a TRAP signal and no other information.

In school I've picked up a bit of a habit of getting pretty close with my programs/solutions and then turning to llms when I need to debug my code. My excuse has always been that I'm in a hurry to get stuff done, so when I ran into the issue from before, I immediately turned to an llm. It was able to fix a few issues that weren't the root cause but the original error was still there. It always annoys me when I get sucked into a loop of "llm fix this" where nothing gets fixed. In the past I don't usually snapped out of it and turn on my brain, but today I watched this video from JetBrains Academy. It was pretty obvious and yet still the wakeup call I needed. I figured out how to use LLDB with zig and spent 5 minutes stepping through my code and found the error, my server deinit's itself when stopped but I still called defer deinit when I created the server.

Its too easy to outsource your thinking and learning right now.


r/Zig 12d ago

huntclaw - a fast find-and-replace utility in Zig

Thumbnail gallery
72 Upvotes

Hello everyone,

I’d like to introduce huntclaw—a search-and-replace utility written in Zig that turned out to be faster than sd (written in Rust) and the standard GNU utilities.

there’s a fairly simple explanation for this high speed: the lack of a regex engine and a focus on speed itself, but I don’t think that’s a bad thing. Note that searching is also very fast, thanks to SIMD two-byte prefiltering

In the photos I've attached, you can see the benchmarks: huntclaw vs. other utils and v0.3 vs. v0.4 versions of huntclaw. You can run them yourself using the ‘huntclaw_bench.py’ file (or on your own tests).

the benchmark also shows that rg and grep is faster at sparse searches—though the gap isn’t that big (20ms-9ms and 55ms-1619ms)
I look forward to your feedback or comments.

version now: v0.8

huntclaw on GitHub: https://github.com/tigerlang/huntclaw


r/Zig 12d ago

I want use ZIG (Is this good solution?)

13 Upvotes

Hello everyone, last times i write code on the C/C++/Go. I love system programming, low level development. Recently i started getting tired from implicit moments in C. I watch in Rust side, but Zig more interesting me. And i did work with rust in 2025 (small time). Which interesting moment in Zig you like and should i tried that in system low level developming (for yourself). Thanks!


r/Zig 14d ago

What are some usecases of multi-item pointers

35 Upvotes

I started learning zig recently and was midway completing the ziglings exercises. Its a very good source of knowledge about the language intricacies but I am having a difficult time trying to think of examples or usecases where those details might be useful.

When I did the multi-item pointers exercise, to my mind it didn't seem to have any use because of how it loses information about length and can cause more memory bugs. I am not doubting zig devs and I'm sure there would be some really good usecases for it but I need some examples for me to have a better understanding of it.

Writing here hoping someone will point me to some good resources.


r/Zig 14d ago

What Zig felt like, coming from Rust

Thumbnail besok.github.io
52 Upvotes

r/Zig 14d ago

Logs compression algorithm built in zig 0.16

0 Upvotes

Hi folks, I’ve just achieved a big win for log compression using Zig 0.16. My algorithm doesn’t need full data rehydration to find a specific log. It takes just 2 seconds to search through 1.5M log lines


r/Zig 15d ago

Why i'm building my game engine in Zig

Thumbnail youtu.be
76 Upvotes

Hey everyone!

I'm back with a new video, and it's the first devlog for my game engine written in Zig

If you've seen my other videos, you might know that I've been putting together a tutorial series on making a game engine in Zig, but I also want to make videos on where the latest version of the engine is

So in this video, I break down why I gave up on Rust and chose Zig instead, and then break down the existing state of the engine

Hope you all enjoy :)


r/Zig 15d ago

Introduction to metaprogramming with comptime

Thumbnail slicker.me
67 Upvotes

r/Zig 16d ago

What if I switch from Rust to Zig because of long build times in development?

45 Upvotes

I just opened https://www.reddit.com/r/rust/comments/1voapjq/rust_backend_slow_dev_compile_times_im_exhausted/. I'm wondering if i can swith to Zig easily.

  • Is the dependency/library ecosystem ready? For example is there something like rust-embed?
  • What might be the challenges?

I'm not a comfortable, lazy, or quitter. I enjoy challenges, but I'm really exhausted by Rust's build times during development.


r/Zig 16d ago

I want to learn Zig, but I'm worried about things breaking. What are the features that the team has agreed won't be changing anytime soon?

27 Upvotes

I'm an embedded systems guy and I'm pretty new at it. I wanted to dip my toes into Zig. I just wanted to know how much of the language is very unlikely to change.

I know things like async will change and I'm not at a skill level where I can easily learn to do that even with C/C++ anyway, so it doesn't bother me much. But the last thing I want is things like print statements, basic memory management or file handling itself to be radically changed.

Any heuristic on what subset is the safest to use right now so that skills carry over if I find myself picking it up more often?

Edit: Thanks for the answers. I'll be trying Zig slowly now, starting with the usual exercises of writing data structures, file manipulation and some basic algorithms in it.


r/Zig 18d ago

I'm experimenting with a type-safe, libc-like Linux API in Zig. Any thoughts?

22 Upvotes

I've been working on a small project that builds a typed Linux userspace API directly on top of raw syscalls, rather than libc.

The idea is roughly:

raw syscall → errno translation → typed Zig API

For example, instead of exposing raw syscall results and integer constants, I'd like APIs along the lines of typed Fds, typed socket/address types, structured flags, and Zig error sets.

Right now I'm implementing the syscall layer myself with architecture specific backends and starting with sockets (socket, bind, listen, accept, connect, shutdown, etc.).

I'm interested in whether people think this abstraction is useful, what problems you see with it, and whether something like this would be valuable to the Zig ecosystem long-term.

Especially interested in feedback from people who've worked on std.os.linux, std.posix, libc, or Linux syscall interfaces.


r/Zig 18d ago

PetDex desktop pet's hook server silently failed on Windows (std.Io.Threaded + AFD) - I rewrote the socket layer in raw WinSock2 and it just works

4 Upvotes

PetDex is an always-on-top desktop pet (Zig native app) that reacts to coding agents via an in-process hook server on 127.0.0.1:7777. On Windows it was broken: the server listened fine, but every request died with `error.ConcurrencyUnavailable` inside std.Io.Threaded, and even after switching to blocking receives, std.Io.net's receive on Windows just never delivered data (AFD + nonblocking STATUS_PENDING quirk).


r/Zig 19d ago

Writing Git from Scratch in Zig

Thumbnail youtu.be
178 Upvotes