Suffering: The First Two Weeks Of Zig

Suffering: The First Two Weeks Of Zig

Tags
ZigCDev Log
Owner
Justin Nearing
‼️
This is finished as of @April 15, 2024, even though the project still incomplete. I’ve figured out what a string is (5 days) and wrote a detailed explanation of *const [5:0]u8 means. I put that all in 🧵Strings, Actually, Do Not Exist Reddit had no chill in on the comments on that one. I’ve struggled with the package manager, then abandoned using external packages to and “just use std”. Currently I’m struggling with std.fs.dir The problem I’ve run into now is that I’ve kinda lost the plot for this article. The original intent was to be a first impressions kind of thing, but those impressions are old now. This is mainly due to having a bunch of tech interviews running deep, soaking up the mental bandwidth to work on this project. So I think I will finish the project, with this article, but not publish it out like I had originally intended to.
🎶
This is part of a ongoing series called Building A Music EngineBuilding A Music Engine

It’s basically me documenting the process of smashing my head against the keyboard as I build a game prototype called LETSGOLETSGO

It’s gotten long enough to break into several sections:

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++