Live data from Hacker News

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

github.com

61–70 of 126 posts

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

#61
post #54

Earlier quoted context omitted.

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.

I believe Zig takes a more nuanced and balanced approach to memory safety as a spectrum, rather than the extremes you present of either GC or borrow checker. For example, Zig offers spatial memory safety, and provides test allocators to catch temporal memory safety issues. That's already an order of magnitude improvement over C. Memory safety is also just one aspect of safety, whereas sometimes programmers conflate t…

Ada, Modula-2 and Object Pascal, minus compile time execution that they lack, and you have Zig almost 40 years ago.

Sad that we have to go in circles to keep programming fashion going, instead of adopting best practices from the get go.

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

#62
post #61
post #54

Earlier quoted context omitted.

I believe Zig takes a more nuanced and balanced approach to memory safety as a spectrum, rather than the extremes you present of either GC or borrow checker. For example, Zig offers spatial memory safety, and provides test allocators to catch temporal memory safety issues. That's already an order of magnitude improvement over C. Memory safety is also just one aspect of safety, whereas sometimes programmers conflate t…

Ada, Modula-2 and Object Pascal, minus compile time execution that they lack, and you have Zig almost 40 years ago. Sad that we have to go in circles to keep programming fashion going, instead of adopting best practices from the get go.

[deleted]

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

#63
post #5
post #3

Earlier quoted context omitted.

Why Zig?

Why not Zig? Its a pretty fun language...

Personally I dislike the @ love, feels a bit like being in Objective-C land, imports feel like JavaScript AMD modules, and still use-after-free issues.

Otherwise it is pretty much Modula-2, with C flavoured syntax and compile time execution.

Overall, the use-after-free is what irks me.

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

#64
post #61
post #54

Earlier quoted context omitted.

I believe Zig takes a more nuanced and balanced approach to memory safety as a spectrum, rather than the extremes you present of either GC or borrow checker. For example, Zig offers spatial memory safety, and provides test allocators to catch temporal memory safety issues. That's already an order of magnitude improvement over C. Memory safety is also just one aspect of safety, whereas sometimes programmers conflate t…

Ada, Modula-2 and Object Pascal, minus compile time execution that they lack, and you have Zig almost 40 years ago. Sad that we have to go in circles to keep programming fashion going, instead of adopting best practices from the get go.

A language isn't just a compiler and a spec. I don't know the full history of all these projects, but IIRC Ada's compiler wasn't free for a long time.

How you structure the financials and the community around the language has also a gigantic impact on the final result, and this is an area where Zig bringing to the table something completely new.

https://ziglang.org/zsf/

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

#65
post #29

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…

I tried, and enjoyed, Zig. My enjoyment rapidly fell off a cliff when I started getting deeper into the stdlib. It feels like (this may not be true) that people contributed random stuff into it, a bit like C++ prior to Boost. The inconsistency hampered my enjoyment, and I headed back to Rust.

I think that's ok for being so early in the development cycle. Currently the Zig stdlib seems to be mostly stuff that's needed by the compiler and build system. At least it's already much more useful than the C stdlib.

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

#66

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.

[deleted]

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

#67

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.

Zig fixes many more memory safety issues than C or C++ though, simply by being less "sloppy" and enforcing more correctness (e.g. no implicit type conversions, no over/underflows, proper range-checked arrays and slices etc...) - IME most memory corruption issues in C and C++ are actually secondary effects of such simple correctness issues. Zig just isn't quite as "extremist" as Rust (also, Rust is a great language for writing a sandbox, but if a memory-safe language must be used inside the sandbox to prevent damage outside the sandbox, then it simply isn't a sandbox.

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

#69

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.

This really depends on the game and your personal goals. Engines like Unity, Unreal or Godot must cover the entire game development landscape, but the 'engine feature slice' needed for one specific game may be so small that such generalist engines don't provide much help or are even actively harmful because they force you into building the game in a certain way. The most useful engine-part in such cases might be the tiny platform abstraction layer to work around driver- and OS-API bugs - but usually this platform abstraction layer can't be used alone, and alternatives like SDL also have accumulated lots of such fixes and workarounds over the decades.

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

#70
post #61

Earlier quoted context omitted.

Ada, Modula-2 and Object Pascal, minus compile time execution that they lack, and you have Zig almost 40 years ago. Sad that we have to go in circles to keep programming fashion going, instead of adopting best practices from the get go.

A language isn't just a compiler and a spec. I don't know the full history of all these projects, but IIRC Ada's compiler wasn't free for a long time. How you structure the financials and the community around the language has also a gigantic impact on the final result, and this is an area where Zig bringing to the table something completely new. https://ziglang.org/zsf/

Although most people associate Object Pascal to Borland due to the Turbo Pascal branding done by them, the language was originally created to write Lisa OS (Clascal), and then when the project got replaced by Mac OS, with the help of Niklaus Wirth input, Clascal became Object Pascal and was the main language until the C++ rewrite that took place in the early 90's.

Outside Apple computers, the dialects created by Borland gained such following, specially in Europe, that Turbo Pascal became the official Pascal dialect, even though Extended Pascal fixed most of the original design flaws.

Naturally they going enterpreisy lost the crowd to VB and VC++ folks (later .NET).

Modula-2 did have some nice offerings, specially on Amiga, but on the PC and Mac, Turbo/Object Pascal made it irrelevant as it offered all the improvements Modula-2 brought to the table (no one cared about co-routines on home computers back then).

Ada was the only one from those that yeah, actually quite expensive, and I think only SGI and SUN had UNIX compilers for them, with HP having BASIC and Pascal compilers for their OSes.

Then there was the Amsterdam Compiler Kit, the "LLVM" for the 1980's, which had support for C, Pascal, Modula-2, Occam, and BASIC.

Looking forward to see how Zig evolves, specially regarding issues like #2301.

Post reply on HN