7 ms·
What I love about this engine, is that I can really easily read the code and reason what it does. I'd guess that given an hour or so of study I would feel reas
by swalsh 6y ago
What I love about this engine, is that I can really easily read the code and reason what it does. I'd guess that given an hour or so of study I would feel reasonably confident in trying to modify it.
- adamnemecek 6y agoI agree, it's a really clean codebase.
- Eikon 6y agoIt's indeed very pleasing to read. I love rust but one pet peeve of mine is that projects can unfortunately get very hard to follow / libraries very hard to use once too much generics start to get poured into.
- skohan 6y agoGenerics, and also heavy use of traits and macros can make code hard to follow IMO.
- mrec 6y agoI can't quantify it, but I get the impression that the Rust community is starting to turn against unnecessary use of generics and proc macros of late, albeit largely because of their impact on compile/link times rather than readability.
- skohan 6y agoI think macros are incredibly powerful when used parsimoniously, but can make code completely inscrutable and surprising when overused. There's probably an unavoidable trade-off between the flexibility and expressiveness of a language and readability (and possibly compile times). It's part of the reason I would recommend a more restrictive language like Go in a professional setting, even if I would rather program in Rust at home.
- Thaxll 6y agoThat's the case for most engine side project, they're a lot of C++ example like that. Once you start adding a lot of features its another story ...
- adamnemecek 6y agoI think that Rust's features allow for cleaner code bases.
- Thaxll 6y agoI don't see why Rust would be cleaner than modern C++ codebase.
- leetcrew 6y agoc++ is a bit more verbose than rust. think about all the stdlib functions that take begin and end iterators for containers. there's an overload for std::set_difference that takes six arguments, five of them being iterators.
- pjmlp 6y agoRanges and fold expressions take care of that.
- adamnemecek 6y agoThere is a lot more than just those two.
- pjmlp 6y agoI was replying to the provided examples, more examples get more counterexamples.
- leetcrew 6y agothat's true and I am very excited for ranges. sadly I am still waiting for c++17 to be switched on in my build system :/ still there's lots of other stuff that's more verbose in c++ than rust, often because it was bolted on much later. think about getting individual elements out of a tuple. in c++: `std::get<0>(tuple)` for each desired element or `std::tie(elt0, std::ignore, elt2) = tuple;` in rust: `tuple.0`, not sure if there's an equivalent to the std::ignore/std::tie combo
- keldaris 6y agoThe same is also true of the author's previous engine [1], written in C99. Would love to get the author's take on the costs and benefits of switching to Rust on the basis of what's effectively a reasonably sized real world case study, at least as far as individual projects go. [1] https://github.com/mrDIMAS/DmitrysEngine https://github.com/mrDIMAS/DmitrysEngine
- eggy 6y agoThanks for the link! I am going to look more into rg3d, but the C99 engine is interesting to me, because I use Raylib[0] for my C gamedev explorations. I will never fully leave C, because I will be dead before C is fully, or largely, displaced by the likes of Rust or another PL. I have also been playing with Zig, and there is a Tetris demo done by Andrew Kelley the creator of Zig, but no game engine I know of yet [1,2]. [0] https://www.raylib.com/ https://www.raylib.com/ [1] https://ziglang.org/ https://ziglang.org/ [2] https://github.com/andrewrk/tetris/blob/master/build.zig https://github.com/andrewrk/tetris/blob/master/build.zig