3 ms·
If anyone is interested, I'm using Zig full-time. I switched from C# to C++ for game development but I had immense difficulty accepting the language, so when I
by unique_id 8y ago
If anyone is interested, I'm using Zig full-time. I switched from C# to C++ for game development but I had immense difficulty accepting the language, so when I heard of Zig I gave it a go and I've been very happy with it.
This is a serious project that I'm working on. The 'engine' uses the Vulkan graphics API, cache efficient design, scales to the number of cores, game logic is multithreaded, AVX is used, and so on.
I only mention this to hopefully get people interested in Zig. I'm not ready to share screenshots yet and I'm certainly not going to be advertising my game here.
- azhenley 8y agoAny particular reason why you chose Zig over Nim? Or Go or Crystal? I've been trying out all of these languages but haven't decided which one to dive into completely.
- TurboHaskal 8y agoNim, Go and Crystal are garbage collected.
- eggy 8y agoI tried, and really liked Nim, and I believe the custom GC settings would allow for game dev for the types of games I try and make, however, I am biased against the sort of Python syntax and prefer Lisps or standard C-style syntax. This is totally subjective. I can't speak to Go or Crystal, although Go looks like C to me!
- dom96 8y agoNim has a soft real-time GC designed for game development. https://nim-lang.org/docs/gc.html https://nim-lang.org/docs/gc.html I'd also be curious why the OP decided not to use Rust.
- keldaris 8y agoI've followed Zig's progress with some enthusiasm, but would have considered it too immature for a serious project at this point. In that vein, a few questions about your experience: 1) What's your workflow like in terms of tooling? Coming from C# and C++ people are typically used to great IDE support, debugging and profiling tools, etc. Zig doesn't have any of that. How do you work around it and do you find the experience reasonably productive? 2) How do you deal with the language still rapidly evolving? Do you run the latest nightlies or freeze a particular compiler version and update periodically? 3) What are the most important things Zig gets you over the traditional gamedev approach of using a restricted subset of C++ (in some cases literally just C with function/operator overloading for basic math and a few other convenience features)?
- unique_id 8y ago1) When I programmed in C++ I was using Vim and the YouCompleteMe plugin for IDE-like features. Now I use Vim + CTags. For CTags I use the following which uses the Zig standard library to parse Zig code: https://github.com/isaachier/ztags https://github.com/isaachier/ztags. In the future there will be support for the Language Server Protocol. 2) I git pull every few days to run on the latest compiler. The bugs that I've hit have been minor inconveniences, nothing serious. I think Andrew would agree with you though that Zig is probably too immature for a serious project at this point. The transition to the self-hosted compiler has yet to take place, that compiler is in its infancy. 3) I'm afraid that my verbal inability will never do Zig justice. The built in slices and optionals are really nice. Pointers are non-null by default (but can be undefined). Stack traces on crashes. Much better casting in my opinion (once I got used to it). Error handling that's similar to Herb's C++ deterministic exception proposal. No headers. Not having to decide between fast compile times and comfortable printing. Defer statements instead of destructors or nothing work really well in my opinion. Built in testing (maybe not something you use much in gamedev). +% means add with overflow, + means overflow is undefined. Everything feels nicer, that's as good as I can put it. edit: You can Ctrl+F "pub fn" to browse all public functions. Great when browsing Github. It's easy to grep for the definition of anything. Overflow and other undefined behavior is detected in debug mode, this saves me so much time. Guaranteed inline is nice. No more make/cmake and manually listing which files to compile.
- eggy 8y agoI am very interested. I support Zig on Patreon, because I really believe Andrew has hit the sweet spot when you are looking at staying with C, or C++, or moving on to Rust, but can't quite get it. I have been playing recently with Lua/Terra for game dev stuff (scriptable and low-level, but no big user base yet), but I am really a Lisp guy. Zig may help me to bridge a few of my toy program ideas and aspirations to go bigger as you have.
- techntoke 8y agoPlease PM or share with me some more info. I am interested in possibly using Zig for a UI Vulkan framework.