Home

2024

Worklog

LETSGO Game

Suffering: The First Two Weeks Of Zig

Suffering: The First Two Weeks Of Zig

Tags
ZigCDev Log
Owner
J
Justin Nearing
💡
In the long dark of Winter 2024, I went down a programming rabbit hole. It wasn’t at optimal mental health, I don’t think this particularly helped, but I learned a lot.

This is the story of one programmer Quietly Going Insane With Tools & Automation:

🌋Quietly Going Insane With Tools & Automation🧵Strings, Actually, Do Not ExistSuffering: The First Two Weeks Of Zig

Using Zig for the Memes and other bad choices.

In interviews, I usually joke that I'm equally bad coding in all languages.

It sometimes lands.

Most languages are pretty easy to grok.

Once you learn one loosely typed language, the others are just syntactic differences and particular idiosyncrasies with the language/dev ecosystem.

Same is true for strongly typed languages, C# and Java are actually the same.

It was this line of thinking where I thought writing a thing in Zig would be fast, and good for a laugh.

It has been good for a laugh.

It has not been fast.

🔑
The mistake I made was equating higher level languages with lower level ones. Learning each “level” the first time is the hard part. Learning a loosely typed language like JS the first time is hard. Learning a strongly typed language like Java the first time is hard. Learning a memory constrained language like C the first time is hard.

So the jokes on me, because I’m too stubborn to give up on learning Zig for the lulz, which means going through the painful process of learning memory management for the first time.

Some of that means teaching myself CompSci 101 level concepts like 🧵Strings, Actually, Do Not Exist

Courses not required to get my certificate in “Game Art & Design” from a for-profit college over 15 years ago.

I’ve made great choices in life.

Building World of Warcraft in Zig

Have you ever wanted to build a game?

Thought incessantly about that grand MMORPG that would fundamentally change the nature of the games industry?

Yeah, that’s not going to be your first game.

This is incredibly difficult to pull off as your first game, let alone WoW2: MechaDragonBoogaloo
This is incredibly difficult to pull off as your first game, let alone WoW2: MechaDragonBoogaloo

Defining the appropriate scope for a project is so freaking important.

I want to say something outrageous, like 80% of a projects success is determined by whether its scoped appropriately.

So instead of using Zig to build World of Warcraft, my first project using low level programming will be a bit more realistic.

This whole thing started with me 🌋Quietly Going Insane With Tools & Automation

I wanted a script to delete four directories from an Unreal game project.

But then I wanted a “real” executable to do it using a “real” programming language.

I decided to use Zig because I thought it’d be funny.

Spec:

  • Take an directory as an argument
  • Shallow walk the dir, match any subdir with an array of dirs to delete
  • Delete those dirs

Easy right?

Getting bamboozled by the Package Manager

Simple problems require standard solutions

Stacked Heaps and Fat Allocators

😴
Too exhausting. After nearly a month of this, I’m moving on. I technically built working code:

Buuut I’m not building it into an executable that updates the registry. Maybe I’ll poke at it again in the future with Wix or something, but as of right now this fun distraction has taken me away from the actual project I’m working on: LETSGOLETSGO

So I’m circling back to Unreal development, with:

➡️Unreal Blueprints to C++