Odin or Rust
-
[email protected]replied to [email protected] last edited by
I thought I would give my experiences with odin and zig. Maybe it will be of use to op.
Odin:
I used Odin about 6 months ago.
I found Odin to be a very easy language to use. It also has wrappers for popular third party c libraries (called vendors) built in (glfw, sdl2, etc.). The vendor libraries are mostly focused on multimedia. Odin also has an extensive standard library.
My problem with Odin is that it is still not finished. They say the language features are done and will not change but they are still working on the standard library. When last I used it they were rewriting the OS part of the standard library, so anything you wrote using the OS module could change and you would need to rewrite parts of your code.
My second problem with Odin is the documentation. They do have a large source file with lots of examples in it which is very helpful but documentation for the standard library is seriously lacking. You often have to read the source code to figure out what the standard library functions do. Another documentation resource is their discord but, because of the changing standard library, answers you find via search in Discord are often old. So, you will need to ask and hope someone answers. I will say that the creator of Odin is very active on Discord and does answer a lot of questions.
I am waiting for a full Odin release before I try it again.
Zig:
I used zig about 8 months ago.
I found zig a bit more difficult to learn. The syntax is a bit different than what I was used to (especially around error handling). But, after I got my head around some of the strange syntax it made sense and worked fairly well.
My big problem with zig was using c libraries. Zig is good at generating a wrapper for c libraries but the wrapper will feel very c and not zig. So, ideally, someone would have manually tweaked the wrapper to be more zig like and release it as a library. I had issues with zig versions and libraries. Libraries are built against a specific version of zig. Some target the latest in development build and some target a specific release build (and then some have abandoned their libraries and it targets old versions). When you want to use 2 libraries that target different versions it is a nightmare. This brings me on to the build system.
My second problem is the build system. It is powerful but with power comes complication. I struggled terribly to use the build system to bring in libraries. What did not help is that the build system is constantly evolving so the documentation on forums and in the libraries "how to use" sections was often out of date. This was painful to try to use.
Another thing with zig that worries me is that they say the syntax is not finalized and it could change forcing you to rewrite your code.
My conclusion:
Odin is easy to use especially if you want to use it for graphical programs but have the speed/power of c. Just the documentation is a problem. Also, it is not that popular so the community is quite small.
Zig is much more popular with a larger community than Odin. More applications are being written and released in zig. It looks like zig may one day become a c replacement. Using it now requires a lot of effort to keep up with its changes.
Rust... I tried it once but I did not have the energy to learn the borrow checker (or I am just to stupid).
This is all just my experiences. Your mileage may vary.
-
[email protected]replied to [email protected] last edited by
Odin might be better because it has built in vendor libraries like glfw/sdl2 for windowing and events and box2d if you need physics.
-
[email protected]replied to [email protected] last edited by
I've never heard of
Odin
, and I don't know anyone being paid to write code inRust
. -
[email protected]replied to [email protected] last edited by
I'm paid to write rust. It's better than writing C, Java or Cyton.
-
[email protected]replied to [email protected] last edited by
everyone i work with is paid to write rust code
-
[email protected]replied to [email protected] last edited by
For any other use case, I would have recommended Rust, but for making a hobby game engine, I would advise not using either rust or Odin and instead use C and C++.
The graphics drivers have a primary C Abi and you would spend a really long time debugging C to Odin/Rust translation layer bugs than actually working on he engine.I would suggest write a C rendering library, wrap it in safe Rust and move on from there.
-
[email protected]replied to [email protected] last edited by
One of my acquaintances has actually made a small game in Odin (Cat and Onion) and after that written a book about the language (Understanding the Odin Programming Language). I don't know much about Odin myself but from what I've gathered there isn't that much quality documentation or that many good tutorials etc. so it can be a bit hard to get in to the language, which is why he decided to write the book.
-
[email protected]replied to [email protected] last edited by
You're already considering it; try it out.
Exploration and prototyping is not a life-commitment that excludes other options later (like going back to Rust after all).
-
[email protected]replied to [email protected] last edited by
Cat & Onion looks cute. Thanks for letting us know it's written in Odin.
-
[email protected]replied to [email protected] last edited by
For a language constantly voted as most desired for x number if years in a row (stackoverflow survey), there are now quite a few developers actively working with Rust full-time and paid. I think it's in top 20 languages by now.
-
[email protected]replied to [email protected] last edited by
It's certainly growing fast. And yeah, tops the desired charts.
Python did that for years, and is now at number 4 (after the big three JavaScript, SQL and HTML).
I agree, Rust is likely top 20, but there's a massive drop off in real world use after the top 8 or 10.
-
[email protected]replied to [email protected] last edited by
It's better than writing C, Java or Cyton.
I believe you!
-
[email protected]replied to [email protected] last edited by
Thanks for the counterpoint.
I always worry about the kids breaking in running after the next hot thing, and then not landing a job, because I've talked to folks who did so.
I was needlessly worried, as they're picking for a hobby project, anyway.
And as someone else pointed out, Rust is on its way up. I just wouldn't recommend Rust to a newbie as their first language to land their first job, today.
-
[email protected]replied to [email protected] last edited by
there are now quite a few developers actively working with Rust full-time and paid.
Yeah. I didn't mean to imply otherwise. But
quite a few
doesn't always cut it to break into the field.But my concern was entirely misplaced as they're picking for a hobby project anyway.
-
[email protected]replied to [email protected] last edited by
As someone who's used both, I'd have a strong preference for Odin over Rust if it were at a stable 1.0 release. As it stands now (or, at least, when I used it), Odin is very much in flux. Spend enough time with the language, and you'll either find a bug with the compiler or the semantics will change after you update.
That said, it would be my favorite without those problems. It is a really simple language in a good way. There's no fancy language features that are just syntax sugar (well except maybe context, but I find that to be actually convenient). You can understand everything in an afternoon if you are already familiar with programming in other languages. Rust is pretty much the opposite in all of these reguards.
Rust also has the benefit of being pretty recognizable at this point, so if you say your project is in Rust then people will know what that means, unlike Odin. More "resume-able" in a way.
So, in short:
- Odin if you're doing it as a hobby
- Rust if you want something "real"
-
[email protected]replied to [email protected] last edited by
You should seriously consider using Odin if you happen to be writing code on a Wednesday and you want additional divine blessing.
-
[email protected]replied to [email protected] last edited by
Game engines seem to be explicitly what Odin was built do. I'm just reading their website for the first time but they make that clear.
My impression of Odin is that its explicitly made to enable you to write unsafe code. But that's good if you want to get some crazy optimizations going through.
-
[email protected]replied to [email protected] last edited by
I agree Odin is simple which is why I’m drawn to it, after all i know computer science so really i don't need a prescribed away to do something like in Rust. Rust is amazing, but it can be slow to develop in, the points is in the compiler as for a solo dev, it reduces my need for a code quality team. Odin just gets out the way and let's you get going, it's also Go like which i'm familiar with. I've been slowly planning to stick with Rust, i might help my son learn Odin though
-
[email protected]replied to [email protected] last edited by
I'm reading his book to get up to speed on Odin as we speak
-
[email protected]replied to [email protected] last edited by
I already know C/C++, I love them but I never use them again. Rust's borrow checker is still active in unsafe Rust, combined with Miri it detects most UB, leaks and various other problems. For instance I’m building a allocator now in Rust and i know it compiles and Miri didn't complain, sure i can do it in C and use Valgrind but Rust makes it a dream.
I know for Odin there are 3 tools i was looking at which could validate it for UB and leaks at runtime, but what attracts me to Odin is the fact it's not OOP and simple. I'm considering using it because i will be more debugging my game, rather than the language (to quote Zig).
But all that being said I’m good with Rust and it's tooling, so I’m probably going to remain with Rust. But yours and everyone's opinions is helping me form this so thank you!!