Live data from Hacker News

Mach v0.1: Cross-platform Zig graphics

devlog.hexops.com

21–30 of 48 posts

Re: Mach v0.1: Cross-platform Zig graphics

#21

Earlier quoted context omitted.

How does it hande openssl ?

What do you mean? It can link against OpenSSL just like any other library. I don’t know if OpenSSL supports static builds, but if it does you can link it statically as well.

For cross compilation with dynamic linking I mean.

Openssl is typically one you want to be kept up to date with OS updates.

Like libc, it can be a pain.

Re: Mach v0.1: Cross-platform Zig graphics

#22
post #15

Earlier quoted context omitted.

raylib is awesome and a great source of inspiration for me. It's definitely way more complete & comprehensive today than Mach is, too. Longer term, I think you'll find raylib to be better for simpler applications, and Mach looking a little more like an Unreal/Unity/Godot & geared towards more complex applications. All speculation, though, they're both improving rather quickly! The other obvious difference would be la…

> Mach looking a little more like an Unreal/Unity/Godot Right now, Mach is probably something more like Bevy, Magnum.Graphics or BGFX. ie: a _framework_. But your post alludes that that is not the goal. That Mach seeks to build asset importing, animation tools, navigation system, etc? ie: A FULL GAME ENGINE!?

Yes. I don't think we need more frameworks, there are already great options there.

The interesting thing to work on in this space is tooling, so that's where we're headed: full game engine.

Re: Mach v0.1: Cross-platform Zig graphics

#23
post #2

i'm following zig's project from HN and i often see cross-compilation and c/c++ mentionned. Why is zig often mentionned in that context ? it seems that cross-compilation and C can be achieved using llvm/clang without a lot of problem ? What is zig accomplishing in that matter that makes it so special ?

Do you have experience cross compiling? If so, you’re likely familiar with the headache: getting the right tool chains, sysroots, compiler flags, libraries, etc. There are entire businesses and open source tools whose raison d'être is providing these tool chains and making the process simpler. With Zig, that all goes away. It’s as simple as saying `zig build -Dtarget=aarch64-linux-gnu` or `zig build -Dtarget=riscv32-…

Huh. From what you said and then a quick peek at the docs Zig does seem great in that regard, but in my own experience I’ve definitely found Rust to be equally competent.

What about Zig would you say makes it better? Rust has `cargo build --target `

Re: Mach v0.1: Cross-platform Zig graphics

#24
post #11

Author here, thanks for posting! Happy to answer any questions about Mach (or my experience working with Zig.)

> There are few things in life that I am more serious about than this. I dedicate ~48 hours/week to my dayjob, and ~50h/week to Zig building Mach and running zigmonthly.org. After three years of aggressively pushing for progress in this exact way, I have no plans to slow down anytime soon.

This is really awesome work, and if keeping this pace works for you all the better. But I just wanted to encourage you to keep any eye on that, and to make sure that you're not pushing yourself beyond what you're able or willing to put into it. I know many members of the open source community can struggle with that balance, and that many of those people would also rather you building stuff like this for 1/5n hours a week for the next 25 years than n hours a week for 5 years and burn out your interest or capacity. Thanks again for building this project, really cool to see!

Re: Mach v0.1: Cross-platform Zig graphics

#25

Earlier quoted context omitted.

Do you have experience cross compiling? If so, you’re likely familiar with the headache: getting the right tool chains, sysroots, compiler flags, libraries, etc. There are entire businesses and open source tools whose raison d'être is providing these tool chains and making the process simpler. With Zig, that all goes away. It’s as simple as saying `zig build -Dtarget=aarch64-linux-gnu` or `zig build -Dtarget=riscv32-…

Huh. From what you said and then a quick peek at the docs Zig does seem great in that regard, but in my own experience I’ve definitely found Rust to be equally competent. What about Zig would you say makes it better? Rust has `cargo build --target `

From what I've heard, for Rust the difficulty comes in when you're using a Rust wrapper of a C/C++ library and you need to crosscompile both into the binary.

Re: Mach v0.1: Cross-platform Zig graphics

#26
post #24
post #11

Author here, thanks for posting! Happy to answer any questions about Mach (or my experience working with Zig.)

> There are few things in life that I am more serious about than this. I dedicate ~48 hours/week to my dayjob, and ~50h/week to Zig building Mach and running zigmonthly.org. After three years of aggressively pushing for progress in this exact way, I have no plans to slow down anytime soon. This is really awesome work, and if keeping this pace works for you all the better. But I just wanted to encourage you to keep an…

Thanks :) I'm in this for the long haul and will keep this in mind.

Re: Mach v0.1: Cross-platform Zig graphics

#27
post #19

Earlier quoted context omitted.

Apparently, the OP’s issue was ABI incompatibility between VC++ (also used by Windows SDK and everything built on top, including Direct3D 12), and System V (used on Linux, also MinGW on Windows). VC++ documentation says structures are returned through a caller-allocated pointer. Pretty sure modern VC++ optimizes that thing when it can, especially with link time code generation enabled, but for functions and COM metho…

System V is only a C ABI, not a C++ ABI, so of course it wouldn't cover C++-only details. What C++ ABI does MinGW use on Windows?

That thing is COM, which is a small subset of C++ ABI. Technically it’s about the same as on Windows, i.e. C ABI with extra first argument for this pointer.

Once upon a time I made this library https://github.com/const-me/comlightInterop/ The native side of the interop is idiomatic C++, here’s an example https://github.com/Const-me/ComLightInterop/blob/master/Demo... The C# side of the interop is implemented through the built-in C interop, here’s the relevant part of the library https://github.com/Const-me/ComLightInterop/blob/master/ComL... I’ve tested Linux version of that library on AMD64, ARMv7, and ARM64 CPUs, but only with gcc compiler on the native side.

Re: Mach v0.1: Cross-platform Zig graphics

#28
post #11

Author here, thanks for posting! Happy to answer any questions about Mach (or my experience working with Zig.)

What do you think of Zig so far? How do you recommend people get into it, especially those who don't have systems programming experience? Should you learn C first?

I'm super productive in Zig, I really like the language.

Documentation is lacking, so you're going to be reading the stdlib code. There are bugs. The current focus is on building the new stage2 compiler (going from C++ -> Zig implementation) so there are things that need attention that don't get it, yet.

I would not suggest anyone learn C first if they don't have systems programming experience. I'd go for Zig, Rust (or Go, if you just want to dip your toes into the land of pointers) and depending on how comfortable you feel. If you start with one and find it super frustrating, try another, the difference between them is huge. You might personally feel more productive in one, leading to you learning more.

Re: Mach v0.1: Cross-platform Zig graphics

#29
post #28

Earlier quoted context omitted.

What do you think of Zig so far? How do you recommend people get into it, especially those who don't have systems programming experience? Should you learn C first?

I'm super productive in Zig, I really like the language. Documentation is lacking, so you're going to be reading the stdlib code. There are bugs. The current focus is on building the new stage2 compiler (going from C++ -> Zig implementation) so there are things that need attention that don't get it, yet. I would not suggest anyone learn C first if they don't have systems programming experience. I'd go for Zig, Rust (…

Same here. As a compiled language, I find Zig super productive.

There's neither "magic" nor an accumulation of abstraction layers. As a result, when there's a bug in my code, I can quickly understand what's going on and how to fix it. This is very refreshing.

Re: Mach v0.1: Cross-platform Zig graphics

#30
post #15

Earlier quoted context omitted.

raylib is awesome and a great source of inspiration for me. It's definitely way more complete & comprehensive today than Mach is, too. Longer term, I think you'll find raylib to be better for simpler applications, and Mach looking a little more like an Unreal/Unity/Godot & geared towards more complex applications. All speculation, though, they're both improving rather quickly! The other obvious difference would be la…

> Mach looking a little more like an Unreal/Unity/Godot Right now, Mach is probably something more like Bevy, Magnum.Graphics or BGFX. ie: a _framework_. But your post alludes that that is not the goal. That Mach seeks to build asset importing, animation tools, navigation system, etc? ie: A FULL GAME ENGINE!?

I'm kind of new to game dev and I'm a little confused about the terminology you're using. You called Bevy a framework to differentiate it from an engine, but on the Bevy website they call themselves an engine. What would you say is differentiation between a framework and an engine?
Post reply on HN