[HN Gopher] rg3d: Rust 3D game engine with an FPS demo game and ...
       ___________________________________________________________________
        
       rg3d: Rust 3D game engine with an FPS demo game and scene editor
        
       Author : adamnemecek
       Score  : 260 points
       Date   : 2020-09-18 15:15 UTC (7 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | BookPage wrote:
       | This is awesome!!!! It would be cool if there were some binary
       | releases, at least for the shooter example. I'm not sure if
       | there's anything huge blocking that though?
       | 
       | Also I'm admittedly not rust-proficient yet but would the cargo
       | run command be cross-platform dependent, or is this a windows-
       | only thing right now?
        
         | TheDesolate0 wrote:
         | `cargo` is like `make` but fancy. so `cargo build` is the same
         | as say running `make`
         | 
         | it is very much cross platform, and actually much easier to get
         | working under GNU/Linux, *nix, or (ick) JobsOS.
         | 
         | https://rustup.rs/ has the install scripts
        
       | meheleventyone wrote:
       | Wow, this is a lovely, pragmatic, no nonsense game engine! And it
       | has a non-trivial example project and an editor! This is such a
       | breath of fresh air for game engine announcements.
       | 
       | I don't know if mrDIMAS is on HN but big congrats to him for this
       | great project.
        
         | adamnemecek wrote:
         | I have alerted him of this post so he'll get your message.
        
         | mrDIMAS wrote:
         | Thanks a lot for the kind words!
        
       | adamnemecek wrote:
       | It's a really impressive project. Also check out the associated
       | scene editor https://github.com/mrDIMAS/rusty-editor
       | 
       | Check out the UI framework that it uses
       | https://github.com/mrDIMAS/rg3d-ui
        
         | angryredblock wrote:
         | Agreed, this feature set looks like an incredible amount of
         | work for a year.
         | 
         | Interestingly it seems it started as a shooter game more than
         | an engine -- explains why the feature set is tailored towards
         | that.
        
           | adamnemecek wrote:
           | I agree. Dmitry used to work on tools at Larian (studio
           | behind Divinity: Original Sin) so he had a decent amount of
           | experience.
        
       | j-james wrote:
       | Particularly relevant: https://arewegameyet.rs/
        
       | sabujp wrote:
       | looking at the actual engine code, it's still all math and it
       | looks like C++. The programming language here doesn't make the
       | math easier to understand, example :
       | https://github.com/mrDIMAS/rg3d/blob/master/src/renderer/sur... .
       | Better to read some books on computer graphics math :
       | https://foundationsofgameenginedev.com/#fged1
        
         | canada_dry wrote:
         | That example code is quite readable though. Are there any
         | languages that make math more readable? Even purpose build code
         | like matlab is about the same.
        
         | detaro wrote:
         | What are you responding to? Better for what?
        
       | TrueDuality wrote:
       | Wow, there are a lot of solid game engines coming out in Rust.
       | Most are still pretty early, but it's really impressive how much
       | of the gamedev community has such an interest in Rust.
        
       | [deleted]
        
       | swalsh wrote:
       | 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 wrote:
         | I agree, it's a really clean codebase.
        
         | Eikon wrote:
         | It'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 wrote:
           | Generics, and also heavy use of traits and macros can make
           | code hard to follow IMO.
        
             | mrec wrote:
             | I 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 wrote:
               | I 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 wrote:
         | That'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 wrote:
           | I think that Rust's features allow for cleaner code bases.
        
             | Thaxll wrote:
             | I don't see why Rust would be cleaner than modern C++
             | codebase.
        
               | adamnemecek wrote:
               | Theoretically yes, practically it's a different story.
               | 
               | Sure you can write clean modern cpp (the act of which is
               | harder than writing clean Rust), but if your dependencies
               | are still "C with classes", you are forced to particular
               | patterns.
        
               | badsectoracula wrote:
               | FWIW some people -e.g. me :-P- consider "C with classes"
               | much more readable than modern C++.
        
               | adamnemecek wrote:
               | I'm somewhere in the middle but then again, that's a Cpp
               | problem.
        
               | pjmlp wrote:
               | While I agree, Rust also suffers from it, where " C with
               | Classes" gets turned into "Rust with unsafe", although
               | not required.
        
               | adamnemecek wrote:
               | Unsafe is not as big of a deal as people make it seem.
        
               | pjmlp wrote:
               | Using C alongside static analysis like Frama-C is also
               | quite safe, one could say.
        
               | adamnemecek wrote:
               | It's not just safety though. It's just...all of it. I
               | legit don't enjoy writing C. Rust is fun to write 90% of
               | the time.
        
               | keldaris wrote:
               | That's a completely fair point, but very subjective.
               | There are lots of people (myself included) who feel
               | exactly the opposite way.
        
               | estebank wrote:
               | It's also not nearly as prevalent as people from outside
               | the ecosystem seem to think it is. I read a lot of "any
               | non-trivial Rust code will _have_ to use unsafe " and I
               | guess that means that all of the code I've worked on is
               | trivial.
        
               | echelon wrote:
               | C++ is incredibly verbose (STL) and carries a lot of
               | baggage and mental overhead. Rust has improved ergonomics
               | in nearly every area except lifetime handling, which is a
               | concern you want to think about and make explicit.
               | 
               | I predict in ten years the gravitas for new projects will
               | have shifted entirely to Rust. C++ is just too much of a
               | burden to write and verify. C++ will still have plenty of
               | healthy projects, but I think it'll be hard to attract
               | new projects when Rust has come so far.
        
               | leetcrew wrote:
               | c++ 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 wrote:
               | Ranges and fold expressions take care of that.
        
               | leetcrew wrote:
               | that'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
        
               | pjmlp wrote:
               | C++ has structured destruction now.
        
               | Rusky wrote:
               | Structured bindings work for simple cases, but Rust's are
               | much simpler and more powerful.
        
               | Rusky wrote:
               | Ranges don't really exist yet.
        
               | adamnemecek wrote:
               | There is a lot more than just those two.
        
               | pjmlp wrote:
               | I was replying to the provided examples, more examples
               | get more counterexamples.
        
         | keldaris wrote:
         | The 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
        
       | mcintyre1994 wrote:
       | This looks really impressive! Given that Rust -> WebAssembly is
       | at least a thing, would it be plausible for someone to make that
       | rusty-shooter demo work in a browser?
        
         | mrDIMAS wrote:
         | There is also a problem with rg3d-sound - it supports only
         | Windows and Linux right now. So there will be no sound on other
         | OSes. I've tried to add at least macOS backend by myself, but I
         | failed all attempts to install macOS on virtual machine :(
        
           | korpiq wrote:
           | Hey what about someone donate a Mac to mrDIMAS? Might pay
           | back =)
        
         | brundolf wrote:
         | The graphics code would have to be ported to WebGL, and then
         | there might be an extra hurdle getting WASM to talk to WebGL
         | directly. But it's doable, yes.
        
           | steveklabnik wrote:
           | https://rustwasm.github.io/wasm-bindgen/examples/webgl.html
        
           | pjmlp wrote:
           | References are almost in, by next year you can probably
           | already talk directly to WebGL.
        
           | kettlecorn wrote:
           | Rust with WebGL is pretty seamless today.
           | 
           | I wrote a game for a gamejam using Rust, Wasm, and WebGL
           | without any engine: https://kettlecorn.itch.io/wonder
           | 
           | It makes use of 'glow', a Rust library that lets you write
           | regular OpenGL code that runs across desktop, mobile, and
           | web: https://github.com/grovesNL/glow
        
       | pjmlp wrote:
       | Quite cool! This is the kind of stuff that might drive adoption
       | among game devs.
        
         | badsectoracula wrote:
         | I doubt projects like this would help. For big developers,
         | 99.99% of the time they are already riding on existing
         | codebases (even when they call it by different names for
         | marketing reasons) - the last two AAA games i worked at have
         | codebases more than a decade old, one actually two decades old.
         | While technically they could add rust as an extra language, in
         | practice this wont happen both because the vast majority of
         | game developers are conservative in terms of languages but also
         | because it creates extra barriers (most people who write C++
         | code in games barely know C++ - the wizkids that everyone has
         | in mind when hearing about high octane game engines are a tiny
         | minority compared to _everyone else_ who touches a game 's
         | codebase) which make it harder to hire new people (unlike other
         | disciplines in gamedev, decent programmers aren't as easy to
         | find). Also everyone hates how slow C++ is to compile and last
         | time i checked rust is even worse.
         | 
         | For smaller developers projects like this still wont help drive
         | adoption since smaller developers have the freedom to decide on
         | their own what language they'd use (assuming they aren't
         | already using an existing codebase, some of the stuff above
         | also apply to smaller developers) and they'd already be using
         | rust if they thought it'd help. In general i believe that
         | developers who have enough knowledge to make their own engine
         | in other languages and be able to make their engine in rust,
         | would be able to tell if rust is a good choice or not.
         | 
         | Or to put it in another way, i doubt projects like this will
         | help drive adoption for rust among game developers because the
         | developers have either already decided what language to use (be
         | it rust or something else) or are not in a position to decide
         | what language to use.
         | 
         | (yeah sure, there might be an exception or two out there, but
         | there are hundreds -if not thousands- of engines... after all
         | Remedy, a AAA studio, used D in their engine yet you do not see
         | much of an uptake of D among game developers even though
         | technically D would be easier to grok by C++ programmers,
         | integrate with existing engines with its C++ interop and even
         | provides features like compile time code evaluation and
         | generation for features that i've seen C++ projects use
         | overcompilated macros and external build time generators that
         | rely on brittle code comments to work)
        
           | adamnemecek wrote:
           | How would it not help? Someone might see this and realize
           | that Rust is a viable game dev option and adopt it for their
           | next game.
           | 
           | In my experience, Rust is relatively fast on recompilation,
           | possibly faster than C++.
           | 
           | Rust is a much younger language so you have to wait.
        
       | eggy wrote:
       | I have started playing with Bevy [1], so I wonder how this
       | compares from an ECS point of view?
       | 
       | I am a beginner at Rust, so any insight would be appreciated.
       | Thanks!
       | 
       | Great to see gamedev taking off on Rust!
       | 
       | [1] https://bevyengine.org/
        
         | adamnemecek wrote:
         | Bevy right now has little to show for itself besides a somewhat
         | clean ECS api.
        
           | eggy wrote:
           | Yes, the full demo of this engine is enticing. Thanks.
        
       | bufferoverflow wrote:
       | The graphics looks like it's from 15-20 years ago. Modern game
       | engines are so far ahead of this, rg3d has a lot of catching up
       | to do.
        
         | moth-fuzz wrote:
         | I think this comment is slightly disingenuous, I think it's
         | more obvious that the aesthetics of any game (let alone engine)
         | will primarily depend on the quality of the Assets. If you
         | loaded up these quake 3-era meshes and textures into Unreal
         | Engine 4 or something else you'd call 'modern', I guarantee you
         | they'd look the same or similar.
         | 
         | The lighting isn't even that bad sans indirect illumination,
         | which unreal only just got recently and Unity is losing due to
         | Enlighten being shut down.
         | 
         | This reminds me of people comparing open source software with
         | proprietary software on account of aesthetics - it's not the
         | licensing model, or the game engine, it's the presence or
         | absence of artists that makes the difference.
        
           | scollet wrote:
           | Not to mention the low-poly and demake trends.
           | 
           | The visual fidelity of a game is a moot argument and the
           | quality of assets is subjective.
        
         | swalsh wrote:
         | I question how much of "modern" graphics (IE things you can get
         | a PHD for) is a manifestation of the engine, and how much is a
         | result of the underlying libraries being used, and the fancy
         | shaders being written. I don't think it's unreasonable to
         | believe an engine like this could catch up.
        
         | smolder wrote:
         | It seems like you're criticising the examples for being less
         | than elaborate and mistaking that for a shortcoming of the
         | engine. It's not some "easy game studio 2020"-type thing that
         | should spit out pretty games with 10 lines of custom code, it's
         | a basic engine that can be built upon.
        
         | surfsvammel wrote:
         | That might be true for the most cutting edge 3D shooters. But
         | nowadays that's not all that matters. I'm sure this can find a
         | niche.
        
           | bufferoverflow wrote:
           | I'm not talking about shooters. I'm talking about what it
           | looks like. The lighting, specifically.
        
             | adamnemecek wrote:
             | That's something that can be improved.
        
               | bufferoverflow wrote:
               | That's an empty platitude. Almost anything can be
               | improved.
        
               | adamnemecek wrote:
               | OK, look at how good of a foundation it is.
        
             | mrDIMAS wrote:
             | To be honest I'm not trying to implement "bleeding edge"
             | renderer, it would just take enormous amount of time which
             | can be put into other more important parts (there are
             | plenty of them).
        
             | cycloptic wrote:
             | Have you considered collaborating with the author to
             | improve the lighting? I'm sure they wouldn't mind help.
        
         | adamnemecek wrote:
         | It's a single person project. I haven't seen a more advanced
         | rust engine. Adding better rendering isn't too bad once you
         | have some engine architecture.
        
           | bufferoverflow wrote:
           | I have nothing against it, and it being a single person
           | project.
           | 
           | But the fact remains, it's far behind Unity, Unreal and
           | Godot.
        
             | adamnemecek wrote:
             | You need to look at this as result/time. Godot has been
             | around for six years, the others for much longer. This has
             | been around for a year and again, it's a one person
             | project. What do you expect?
        
               | bufferoverflow wrote:
               | Well, I'm talking from the point of view of a user. Why
               | would I choose this engine over Godot, Unity, Unreal?
               | Just because it's a single-person project?
        
               | adamnemecek wrote:
               | I don't know what to tell you. Don't? Why did people care
               | about Godot in 2015 when Unity was around? For the same
               | reason.
        
               | badsectoracula wrote:
               | Who asked you to choose this engine over Godot, Unity or
               | Unreal? And why would others make a choice for you? Such
               | a choice would only be up to you based on your own
               | requirements, nobody else can make that choice.
               | 
               | Also this post is really about showing off an engine made
               | in Rust, a "hack" so to speak. You are in Hacker News
               | where people post (usually technical) things that others
               | might find interesting - but not necessarily useful.
               | Consider we get posts about people writing software for
               | retro computers, just for the fun of it.
        
             | bitobserver wrote:
             | With enough time and resources, I wonder if we'll one day
             | see a Rust game engine that can outperform these projects.
        
               | krapp wrote:
               | Maybe, but you can already use Rust with Godot.
        
               | adamnemecek wrote:
               | Not the same.
        
             | fsociety wrote:
             | You're the one comparing it to Unity, Unreal and Godot.
             | Everyone else is talking about game engines on Rust and how
             | cool it is that this person built it.
        
         | Ankhers wrote:
         | Could this not just be a case of using something on hand /
         | creating them relatively quickly and not a limitation of the
         | engine itself?
        
       | adamnemecek wrote:
       | This project is what I would call data oriented, as discussed
       | yesterday on hn https://news.ycombinator.com/item?id=24506744.
       | 
       | It takes some parts of ECS but the UI is OOP-ish. I wonder if
       | there is a good ECS UI architecture. I have been exploring this
       | lately in Rust, and right now I have settled on jquery style
       | selectors (don't laugh) where you have a generic entity builder
       | and associate a selector (id + class list) with each entity. When
       | an event fires, you check what selectors are associated with the
       | focused entity and call the associated callbacks. I also do this
       | for rendering. I'm not too crazy about this though. But I'm
       | having a hard time figuring out how to do behavior composition in
       | Rust.
        
         | the_duke wrote:
         | > I wonder if there is a good ECS UI architecture.
         | 
         | orbtk [1] is based on ECS. I have not used it, so I can't
         | comment on the the quality of the architecture.
         | 
         | [1] https://github.com/redox-os/orbtk
        
           | adamnemecek wrote:
           | I am not crazy about orbtk. I don't think it's not quite ecs,
           | and I'm not crazy about the overuse of macros.
        
             | bronson wrote:
             | Why?
        
       | adamnemecek wrote:
       | If you'd like to support the development of this engine, the
       | author has a patreon https://www.patreon.com/mrdimas
       | 
       | Unfortunately, Github sponsorships is not available in Russia.
       | 
       | Also, there's a discord channel dedicated to the project
       | https://discord.gg/xENF5Uh
        
       | Narann wrote:
       | What I like is that this engine actually have a demo which is
       | more than few cubes and sprite: A full tiny game. Game engine
       | should have more tiny games as it's a good way for newcomers to
       | have something they can start to hack (change
       | gravity/texture/lighting effects) and understand what a game
       | engine is and how it work.
       | 
       | The code is quite clean and it also provide scene editor with
       | dedicated UI widgets.
       | 
       | https://github.com/mrDIMAS/rusty-editor/
       | 
       | https://github.com/mrDIMAS/rg3d-ui
       | 
       | Truly impressive.
        
         | [deleted]
        
         | mrDIMAS wrote:
         | The game and the editor are massively helps to find right
         | approaches in development. All my previous attempts to write
         | engines (in other languages) were bad because all they had is
         | just some very simple demos with some meshes and lights. You
         | never know which features engine should have until you need
         | them. Many engines trying to have best possible graphics and
         | does not pay attention to other very important things, like
         | sound, animation, physics, resource management, save/load,
         | editor, etc.
        
           | submain wrote:
           | As they say, you don't write an engine - you write a game,
           | and the engine comes out of it. Impressive work!
        
             | kleiba wrote:
             | Not if you write Handmade Hero.
        
       | [deleted]
        
       ___________________________________________________________________
       (page generated 2020-09-18 23:00 UTC)