Live data from Hacker News

Zig gamedev project – left my job to build games in Zig lang

github.com

41–50 of 126 posts

Re: Zig gamedev project – left my job to build games in Zig lang

#41
post #28

I think Zig is great and I'm following it with interest. But I think people should be aware that it is not really stable yet, at least in my experience from trying it earlier this year. I ran into a compiler crash: https://github.com/ziglang/zig/issues/7865 . I attempted to fix the compiler crash myself ( https://github.com/ziglang/zig/pull/8372 ), and I found a fix that worked, but apparently it was not the right fi…

Why would they spend the effort on writing the zig compiler in zig?

For all the reasons that Zig is a better language than C++:

* Debugging is easier, faster, and more straightforward

* Fewer bugs due to footguns in the language

* Typical Zig code runs faster than typical C++ code. Part of this is due to Zig's safety features - there are design optimizations for performance that I won't even attempt in C or C++ because it's footgun city. Meanwhile in Zig it's actually completely safe in debug builds; you get a compile error or runtime panic if you mess up something.

* Floating point operations work on f16 and f128 without a dependency on SoftFloat library

* Cross compilation is trivial

* Comptime features make build options feasible and maintainable, such as enabling/disabling logging, whether to link libc, whether to link llvm, whether to enable tracy profiling, etc.

* Zig's error handling makes correct code the default instead of the other way around in C++

* The std lib HashMap, ArrayHashMap, and ArrayList data structures are really nice

* If the compiler is written in Zig, then adding a new target backend to the Zig compiler makes the Zig compiler work on that target. With another language we are stuck only supporting whatever that language supports.

Not only that but the Zig compiler available for download today is already backed by majority of lines of code written in Zig rather than C++; what is available today is already partially self-hosted. For example the following features are already written in Zig, not C++: `zig fmt`, `zig translate-c`, the command line interface, `zig cc`/`zig c++`, `zig build`, the cache system, compiler-rt, the macOS linker, and compile error checks that operate before type checking.

Re: Zig gamedev project – left my job to build games in Zig lang

#42

As a former game developer, I don't get why the people start from scratch by developing their own rendering engines or even game engines. Using Unity, Unreal or even Godot is helping you to launch your game 100x faster. I know it might be fun to develop your own engine but it will take a lot of time and it still won't be as usable as an engine developed by 100x more engineers.

As with everything it would depend on the type of thing you’re making and whether you rather deal with problems of an existing solution or the ones you imposed yourself.

Even ignoring that. I think there is a more fundamental question here as well. What type of maker do you want to be?

Re: Zig gamedev project – left my job to build games in Zig lang

#43

I don't really get the "I Left My Job to write $FOO in $BAR language" reason. I can understand if someone left their job to write $FOO - you see an opportunity and you take a risk on it. What does the language have to do with it? To me, taking such a risk, and then adding further risk (using a language you weren't using daily) seems to be a recipe for disaster. If I were taking a risk (by leaving my job) on a new pro…

As someone who did something similar in my youth my argument was that the new language presented unparalleled productivity opportunities vs the “old”

The real reason was of course that I wanted to play with the new thing.

You are right, Market fit and the idea matter most (when assessing a new company)

But not all ideas should be weighed purely on profit. If op is in a healthy financial state and can shoulder the risk for a year, it’s hard to weigh the opportunity risk for him as a person. It might reinvigorate a love for programming or lead to a job in this new language. And ofc it may also just work ;)

Re: Zig gamedev project – left my job to build games in Zig lang

#44
post #28

Earlier quoted context omitted.

Why would they spend the effort on writing the zig compiler in zig?

For all the reasons that Zig is a better language than C++: * Debugging is easier, faster, and more straightforward * Fewer bugs due to footguns in the language * Typical Zig code runs faster than typical C++ code. Part of this is due to Zig's safety features - there are design optimizations for performance that I won't even attempt in C or C++ because it's footgun city. Meanwhile in Zig it's actually completely safe…

> * The std lib HashMap, ArrayHashMap, and ArrayList data structures are really nice

Reading Zig's std lib HashMap code the first time was an unforgettable experience for me.

I've spent literally months on some state of the art hash table papers, implementations and tons of hash functions, and Zig's HashMap implementation has got to be right up there with some of the best and most performant out of the box.

However, what impressed me most was just the level of control offered by the interface, and how clean and readable the code is.

Re: Zig gamedev project – left my job to build games in Zig lang

#45
post #39

Earlier quoted context omitted.

There are a couple of reasons why creating a self-hosting compiler can be good idea: 1. Shows to others that your language is capable of a project of moderate complexity, as well as display what an "idiomatic" version of writing code is 2. Remove dependencies on parts you can't control (once you rewrite it in Zig, rather than C++, you don't need to worry about new C++ features or deprecations between versions) 3. Wri…

Contributions are another one I think. Both the authors and potential collaborators might find it more attractive to use their language of choice. Compilers also tend to pose a variety of challenges that force one to really dig into a language.

Yep.

I know it's entirely other end of the language spectrum, but I think that's why Typescript got successful while Flow did not; Typescript is in Typescript, while Flow is in OCaml. And nobody knows OCaml.

OTOH, eslint is making waves now and it's in golang, so. Who knows.

Re: Zig gamedev project – left my job to build games in Zig lang

#46

I don't really get the "I Left My Job to write $FOO in $BAR language" reason. I can understand if someone left their job to write $FOO - you see an opportunity and you take a risk on it. What does the language have to do with it? To me, taking such a risk, and then adding further risk (using a language you weren't using daily) seems to be a recipe for disaster. If I were taking a risk (by leaving my job) on a new pro…

You're not factoring in the fairly huge opportunity cost of missing out on a major technological wave, not being one of the early domain experts, not to mention all the benefits that come with riding the wave.

Zig is perfect for game developers, and being one of the first in the space is going to be an advantage.

Also, the product here is actually defined as "Building gamedev ecosystem for @ziglang!" — Zig itself is part of the strategy here.

Re: Zig gamedev project – left my job to build games in Zig lang

#47

Earlier quoted context omitted.

Zig is like C but better. It fixes all the pain points of C without adding any extra complications (Rust - borrow checker, Go - GC, C++ - everything).

Memory safety is a pain point of C, and Zig doesn't fix that. There is no free lunch: you either accept garbage collection or deal with something that resembles the borrow checker.

From my point of view in terms of memory safety with Zig, we could just use Modula-2 or FreePascal/Delphi instead, but they aren't as fashionable.

Re: Zig gamedev project – left my job to build games in Zig lang

#48

As a former game developer, I don't get why the people start from scratch by developing their own rendering engines or even game engines. Using Unity, Unreal or even Godot is helping you to launch your game 100x faster. I know it might be fun to develop your own engine but it will take a lot of time and it still won't be as usable as an engine developed by 100x more engineers.

It depends, writing a very targeted engine for your game isn’t necessarily that much slower than using a general purpose engine off the shelf.

The problems usually start when people are more interested in writing the engine than making a game. Then they gravitate towards all sorts of fun technical problems that would be useful in a general purpose engine but not really for their specific set of problems. I’ve also seen this tinkering trap with general purpose engines but quite technical projects.

Re: Zig gamedev project – left my job to build games in Zig lang

#49

I don't really get the "I Left My Job to write $FOO in $BAR language" reason. I can understand if someone left their job to write $FOO - you see an opportunity and you take a risk on it. What does the language have to do with it? To me, taking such a risk, and then adding further risk (using a language you weren't using daily) seems to be a recipe for disaster. If I were taking a risk (by leaving my job) on a new pro…

Sometimes you just need to do something different then working for a boss. We are in a privileged position that some can work 1 month and use it to live 2 comfortable months off it. Why not take some risks in life.
Post reply on HN