9 ms·
That's a good article. He's right about many things. I've been writing a metaverse client in Rust for several years now. Works with Second Life and Open Simula
by Animats 3y ago
That's a good article. He's right about many things.
I've been writing a metaverse client in Rust for several years now. Works with Second Life and Open Simulator servers. Here's some video.[1] It's about 45,000 lines of safe Rust.
Notes:
* There are very few people doing serious 3D game work in Rust. There's Veloren, and my stuff, and maybe a few others. No big, popular titles. I'd expected some AAA title to be written in Rust by now. That hasn't happened, and it's probably not going to happen, for the reasons the author gives.
* He's right about the pain of refactoring and the difficulties of interconnecting different parts of the program. It's quite common for some change to require extensive plumbing work. If the client that talks to the servers needs to talk to the 2D GUI, it has to queue an event.
* The rendering situation is almost adequate, but the stack isn't finished and reliable yet. The 2D GUI systems are weak and require too much code per dialog box.
* I tend to agree about the "async contamination" problem. The "async" system is optimized for someone who needs to run a very large web server, with a huge number of clients sending in requests. I've been pushing back against it creeping into areas that don't really need it.
* I have less trouble with compile times than he does, because the metaverse client has no built-in "gameplay". A metaverse client is more like a 3D web browser than a game.
All the objects and their behaviors come from the server.
I can edit my part of the world from inside the live world. If the color or behavior or model of something needs to be changed, that's not something that requires a client recompile.
The people using C# and Unity on the same problem are making much faster progress.
[1] https://video.hardlimit.com/w/7usCE3v2RrWK6nuoSr4NHJ https://video.hardlimit.com/w/7usCE3v2RrWK6nuoSr4NHJ
- int0x29 3y ago> * There are very few people doing serious 3D game work in Rust. There's Veloren, and my stuff, and maybe a few others. No big, popular titles. I'd expected some AAA title to be written in Rust by now. That hasn't happened, and it's probably not going to happen, for the reasons the author gives. At one point the studio behind the Finals was writing game server code in Rust with an Unreal engine client. Not sure if that's true still
- droopyEyelids 3y agoBackend 3d code?
- ReleaseCandidat 3y agoServer side rendering for games.
- internetter 3y agoThat's a thing?
- chris37879 3y agoAbsolutely! Any sort of multiplayer game needs a source of authority if you want to prevent cheats like a hacked client lying about its position, and a really good way to do that is load the geometry of your level and run physics checks server side at a lower frequency than once per frame. Godot and Unity both support headless builds for exactly this reason, it's basically the whole game engine, minus the renderer, audio, and UI systems, usually.
- dj_mc_merlin 3y agoThat is not server side rendering. Per your own comment: > minus the renderer (Otherwise you are completely correct.) Closest I can think of is server side ragdolls that are rendered the same on all screens and similar stuff.
- pjmlp 3y agoYep, Stadia might have failed, but GeForce Now and XBox Cloud Gaming have enough customers to keep them going.
- spiderice 3y agoThat’s complete different. They are rendering the client and streaming it to users. That doesn’t make the client side code “server side” any more than you streaming Fortnite on Twitch does.
- kibwen 3y ago> I'd expected some AAA title to be written in Rust by now. I'm disinclined to believe that any AAA game will be written in Rust (one is free to insert "because Rust's gamedev ecosystem is immature" or "because AAA game development is increasingly conservative and risk-averse" at their discretion), yet I'm curious what led you to believe this. C++ became available in 1985, and didn't become popular for gamedev until the turn of the millenium, in the wake of Quake 3 (buoyed by the new features of C++98).
- hot_gril 3y agoExactly, it's all about the ecosystem and very little about the language features
- meheleventyone 3y agoDisagree the adoption of C++ was more about Moore's law than ecosystem, although having compilers that were beginning to not be completely rubbish also helped.
- pavlov 3y agoAlso C++ could be adopted incrementally by C developers. You could use it as “C with classes”, or just use operator overloading to make vector math more tolerable, or whatever subset that you happened to like. So there’s really three forces at play in making C++ the standard: 1) The Microsoft ecosystem. They literally stopped supporting C by not adopting the C99 standard in their compiler. If you wanted any modern convenience, you had to compile in C++ mode. New APIs like Direct3D were theoretically accessible from C (via COM) but in practice designed for C++. 2) Better compilers and more CPU cycles to spare. You could actually count on the compiler to do the right thing often enough. 3) Seamless gradual adoption for C developers. Rust has a good compiler, but it lacks that big ticket ecosystem push and is not entirely trivial for C++ developers to adopt.
- pcwalton 3y agoI'd say Rust does have that big ticket ecosystem push. Microsoft has been embracing Rust lately, with things like official Windows bindings [1]. The bigger problem is just inertia: large game engines are enormous. [1]: https://github.com/microsoft/windows-rs https://github.com/microsoft/windows-rs
- duped 3y ago> The "async" system is optimized for someone who needs to run a very large web server, Even there it's very problematic at scale unless you know what you're doing. async/await isn't zero cost, regardless of what people will tell you.
- zamalek 3y agoAbsolutely. Async/await typically improves headroom (scalability) at the cost of latency and throughput. It may also make code easier to reason about.
- littlestymaar 3y ago> at the cost of latency and throughput. Compared to what? Doing epoll manually?
- jvanderbot 3y agoThreading, probably.
- eddd-ddde 3y agoThreading is compatible with async
- jvanderbot 3y ago"threading alone" as in a thread per request.
- littlestymaar 3y agoI don't think so, because there isn't a performance drawback compared to threads when using async. In fact there's literally nothing preventing you from using a thread per task as your future runtime and just blocking on `.await` (and implementing something like that is a common introduction to how async executors run under the hood so it's not particularly convoluted). Sure there's no reason to do that, because non-blocking syscalls are just better, but you can…
- pcwalton 3y ago> I'd expected some AAA title to be written in Rust by now. Why? Those kinds of game engines are enormous amounts of code, and there's little incentive to rewrite. I do strongly disagree that we aren't ever going to see large-scale game development in Rust; it just takes time. Whether games adopt an engine is largely about that engine's maturity rather than anything about the language. Bevy is quite young; 0.13 doesn't even have support for animation blending yet (I landed that for 0.14).
- VelesDude 3y agoIt was a few years back that the question came up to the developers of a Call of Duty title. "Is there still code from Quake 3 in COD?". They dodge around it by saying something like "we cannot deny this but e use the most appropriate tech where needed". While not confirmation, I wouldn't be surprised if there is a few nuggets of Q3 in that code base still doing some of the basics. That would be really cool if it is true. It seems like unless you are someone like John Carmack or most of Nintendo, game dev tools are about what can get the best results quickest rather than any sort of technical specifics. It is a business after all.
- scruple 3y agoIf that's the question... Let me assure you that there are decades-old pieces of code inside of, and used to assemble, many modern AAA games coming out of mature studios. The systems and tooling is typically carried forward. I don't think this is some big secret and you've intuited exactly the reason why: > game dev tools are about what can get the best results quickest rather than any sort of technical specifics. It is a business after all.
- VelesDude 3y agoNot surprised at all that this stuff sticks around. I find it very endearing actually. Ain't broke, don't fix it!
- meheleventyone 3y agoA lot of big projects have amazing longevity to their older architectural decisions. Unreal still has a lot of stuff in it people that used UE1 would recognize, I did most of my professional development on UE3 and a bunch of that is still pretty recognizable. Similarly Chrome is a product of the time it was first created. And looking into the Windows source is probably like staring into the stygian abyss. There is a lot of legacy and tech debt out there!
- matheusmoreira 3y ago> The "async" system is optimized for someone who needs to run a very large web server, with a huge number of clients sending in requests. Can you please elaborate on this? I see a lot of similar concerns in other contexts too. Linux kernel's scheduler for example. Is it a throughput/latency tradeoff?
- cmrdporcupine 3y agoThe current popularity of the async stuff has its roots in the classic "c10k" problem. (https://en.wikipedia.org/wiki/C10k_problem https://en.wikipedia.org/wiki/C10k_problem) A perception among some that threads are expensive, especially when "wasted" on blocking I/O. And that using them in that domain "won't scale." Putting aside that not all of use are building web applications (heterodox here in HN, I know)... Most people in the real world with real applications will not hit the limits of what is possible and efficient and totally fine with thread-based architectures. Plus the kernel has gotten more efficient with threads over the years. Plus hardware has gotten way better, and better at handling concurrent access. Plus async involves other trade-offs -- running a state machine behind the scenes that's doing the kinds of context switching the kernel & hardware already potentially does for threads, but in user space. If you ever pull up a debugger and step through an async Rust/tokio codebase, you'll get a good sense for what the overhead here we're talking about is. That overhead is fine if you're sitting there blocking on your database server, or some HTTP socket, or some filesystem. It's ... probably... not what you want if you're building a game or an operating system or an embedded device of some kind. An additional problem with async in Rust right now is that it involves bringing in an async runtime, and giving it control over execution of async functions... but various things like thread spawning, channels, async locks, etc. are not standardized, and are specific per runtime. Which in the real world is always tokio. So some piece of code you bring in in a crate, uses async, now you're having to fire up a tokio runtime. Even though you were potentially not building something that has anything to do with the kinds of things that tokio is targeted for ("scalable" network services.) So even if you find an async runtime that's optimized in some other domain, etc (like glommio or smol or whatever) -- you're unlikely to even be able to use it with whatever famous upstream crate you want, which will have explicit dependencies into tokio.
- cmrdporcupine 3y ago"I tend to agree about the "async contamination" problem. The "async" system is optimized for someone who needs to run a very large web server, with a huge number of clients sending in requests. I've been pushing back against it creeping into areas that don't really need it." 100% this. As I say elsewhere in these threads: Rust is the language that Tokio ate. It isn't even just async viral-chain-effect, it's that on the whole crates for one async runtime are not even compatible with those of another, and so it's all really just about tokio. Which sucks, if you're doing, y'know, systems programming or embedded (or games). Because tokio has no business in those domains.
- dboreham 3y agoDisappointing to hear this after battling the same nonsense in JS for years.
- cmrdporcupine 3y agoIt's just endemic to the industry. Framework-itis
- otabdeveloper4 3y agoRust is a language made and used by Dunning-Kruger people who violently react to having to learn the prior art. What did you really expect?
- vacuity 3y agoRust's async/await design makes a lot of sense when you consider its primary goals (C interop, low level control, zero cost abstractions, etc.). Sure, perhaps most of us should be using a language with different constraints as opposed to Rust.
- hgomersall 3y agoIt does in my domain of systems programming with async data handling. Tokio works like a dream - slipping into the background and just working so I can concentrate on the business logic.
- andersa 3y ago> I'd expected some AAA title to be written in Rust by now. That hasn't happened, and it's probably not going to happen, for the reasons the author gives. The main reason is that you can't ship that Rust code on PS5 in a sensible manner. People have tried, got useless toys to compile, but in the end even Embark gave up. I remember seeing something from them that they had moved Rust to server-only.
- FridgeSeal 3y ago> The main reason is that you can't ship that Rust code on PS5 in a sensible manner. Really - why’s that?
- tormeh 3y agoSony requires that you use their tooling, which you can only get under NDA.
- justinhj 3y agoIf there was significant pressure from developers Sony would allow Rust. I doubt there is any.
- andersa 3y agoIt's a catch 22 - you can't deploy Rust so no one uses Rust for anything, no one uses Rust for anything so there is no reason for Sony to work on Rust deployment. I think it would be a really good fit for certain parts of the engine - serialization code especially. We have massively complicated C++ code parsing network packets and all sorts of similar sketchy things, always scares me when I see it.
- vintermann 3y agoReally a shame that there's that sort of thing going on in 2024 too.
- lowbloodsugar 3y ago
- retrocryptid 3y agoI'm happy to see someone still doing some work in second life.
- Animats 3y agoThere's a lot going on. Someone is doing a new third party viewer, Crystal Frost, in Unity. Linden Lab has a mobile viewer in alpha test. Rendering is PBR now for new objects. There are mirrors! Content upload is moving to glTF, to be compatible with everybody else. Voice is switching from Vivox to WebRTC. Game controller support is in test. New users get better avatars. The dev staff is larger. None of this is yet increasing Second Life usership much, but it remains the best metaverse around. I thought the metaverse thing was going to be bigger. Meta spent so much money to produce so little.
- vaylian 3y ago> There's a lot going on. I'd like to use the opportunity to ask: What happened during the covid pandemic? I haven't heard/read anything about second life during the pandemic even though this was probably a once-in-a-lifetime opportunity? Are there any news sources that you can recommend to keep an eye on second life, because it doesn't seem that it gets that much press coverage?
- Animats 3y ago> What happened during the COVID pandemic? Usage went up about 10%, and then leveled off. Logged in right now, at 0020 PDT: 32084 users. Varies between 30,000 and 50,000 around the clock. > News sources * https://modemworld.me/ https://modemworld.me/ * https://ryanschultz.com/ https://ryanschultz.com/
- rr808 3y ago> I tend to agree about the "async contamination" problem. Argh I have the same issue. Sure if you write JS or Python you probably need async. My current Java back end that has like 5 concurrent users does not need async everything making 10x the complexity.
- masfoobar 3y ago> I'd expected some AAA titles to be written in Rust by now. "AAA" titles are huge and/or high dev budgets. Even if a game is "starting from scratch" the engine development team are still likely taking code from previous projects to get started. Of course there are other factors. It could be a BIG RISK to move to another programming language when the team, despite frustrations, are already familiar with something else... like the perks C++ brings (you learn from trial-and-error) Could you imagine learning Rust as-you-go... building a AAA title... and fighting the compiler? To me it is a huge risk! That is my opinion.. but I am sure others will disagree. If there is anyone on (or did) a AAA title with Rust... I would be happy to hear more about it. I am not saying it will never happen. Maybe a AAA title is currently in development in Rust. I honestly dont know. However, game developers... if they are looking into Rust... are also looking at Odin, Jai, or Zig. For gaming, I think they are better alternatives than Rust but (again) that is my opinion. Now for smaller, indie games - the possibility of moving to Rust (or another language) is more likely. Likely a fair percentage have moved away from C++ now.