13 ms·
Are we game yet? – A guide to the Rust game development ecosystem
- pizza234 6y agoIt'd be very interesting to read real-world experiences of experienced game programmers with the language itself; all the discussions around the net are purely academic. Long ago I've read on Reddit a programmer posted his detailed experience of the problems they've found on a non-trivial game, but I can't find it. I also wonder if anything changed.
- yagizdegirmenci 6y agoEmbark Studio has a great blog post about this. Inside Rust at Embark: https://medium.com/embarkstudios/inside-rust-at-embark-b82c06d1d9f4 https://medium.com/embarkstudios/inside-rust-at-embark-b82c0...
- hectorlorenzo 6y agoI just recently came across these two videos. Using Rust For Game Development by Catherine West: https://www.youtube.com/watch?v=aKLntZcp27M https://www.youtube.com/watch?v=aKLntZcp27M Counter-rant from Jonathan Blow: https://www.youtube.com/watch?v=4t1K66dMhWk https://www.youtube.com/watch?v=4t1K66dMhWk
- beigeoak 6y agoIdk who that guy is in the counter-rant portion, but if he can make a 1-hour long video against a language, why doesn't he make his own language instead or write his own game engine in his own language or something like that? I highly doubt he would get sub 1-second compile times, like he claims at 1:03:52. Talk is cheap, SAD!
- adwn 6y ago> Counter-rant from Jonathan Blow I've just watched the first 20 minutes of that video. So far, it's all "yeah, she's basically right". When does he get to the point? I.e., what does he actually object to?
- gameswithgo 6y agotldnr is that Rust guides the programmer only halfway to the solid engineering solution, the programmer is on their own to make the arena solution safe. its a pedantic nitpick, as is his way. also keep in mind that of late Blows focus has been single player video games made by very small very talented teams. A domain where the benefits of Rust are very small, possibly even a net loss compared to the fast compiling language they use now.
- deleted 6y ago[deleted]
- indy 6y agoAn issue that Jonathan Blow had was that one of the touted benefits of Rust is it's ownership semantics, yet the ECS (Entity Component System) that the talk demonstrated was effectively bypassing that.
- adwn 6y ago> ownership semantics, yet the ECS (Entity Component System) that the talk demonstrated was effectively bypassing that. I don't see how that's the case [1]. The entities are owned by the ECS (or the game state, or whatever), not by each other. Entities can conceptually reference each other, but not own each other. The only time this is problematic, is when one entity is destroyed while another one is still holding a reference to it. At the beginning of the video, he discussed basically all approaches to solve that problem: 1) Raw pointers. Bad for obvious reasons. 2) Smart pointers which keep the referenced object alive. No good, he says, because one entity should not keep another one alive, if the game logic says it should be removed. 3) Weak pointers which are safely invalidated when the referenced entity is removed. No good, he says, because keeping track of back-references is inefficient. 4) Weak pointers which check whether the referenced entity is still alive before accessing it. Which is exactly what the ECS does. Rust's ownership semantics still help here, because entities are unambiguously owned by the ECS, which returns a type-safe None value when you try to access a deleted entity. [1] I'm not arguing against you, indy; I understand that you paraphrased Blow's argument.
- badsectoracula 6y agoI'm not sure if it was that first video or i saw/read about this approach somewhere else (i'm almost certain that i heard about it years before that video though), but my reaction was pretty much the same as Jon Blow's (though not so long winded :-P): aren't you just working around the borrow checker and making your own allocator with its own faux pointers via indices? Sure, it wont crash the game if your index is invalid, but you'll still access the wrong data - which can end up with hard or weird bugs and corrupted state (e.g. in savegames and/or editor).
- andrewflnr 6y agoYeah, that's pretty much working as intended. The first priority of Rust's safety is crashes and security. Any other bugs that get squashed are a bonus, and you can't expect it to get all of them (whatever any overly enthusiastic evangelists might say).
- Thaxll 6y agoThe sutdio Catherine West worked for stopped using Rust and went back to C++ fyi. https://www.reddit.com/r/programming/comments/atyzz4/halley_a_lightweight_game_engine_written_in_c14/eh69lz7/ https://www.reddit.com/r/programming/comments/atyzz4/halley_...
- ImprobableTruth 6y ago... because Catherine West left for personal reasons and so it was easier to shift the project over to their existing and already working C++ engine (that they were continuously developing and using, so they didn't really 'go back').
- meheleventyone 6y agoYou might be thinking of Chucklefish who’ve done some talks and write ups about using Rust for their projects. IIRC they’ve since stopped. Catherine West their TD did a talk a few years ago. Also: https://prev.rust-lang.org/pdfs/Rust-Chucklefish-Whitepaper.pdf https://prev.rust-lang.org/pdfs/Rust-Chucklefish-Whitepaper....
- yrgulation 6y agoI suppose the question is what problems is rust aiming to solve in game development. From my experience languages are rarely the issue in game dev.
- pol4ko 6y agoAccording to this study [0] you are correct. The problems related are mostly management while the technical ones rarely cite language issues. [0] https://arxiv.org/abs/2009.02440 https://arxiv.org/abs/2009.02440
- MaulingMonkey 6y agohttps://michaelfairley.com/blog/i-made-a-game-in-rust/ https://michaelfairley.com/blog/i-made-a-game-in-rust/ perhaps?
- Impossible 6y agoRust roguelike tutorial https://bfnightly.bracketproductions.com/ https://bfnightly.bracketproductions.com/ walks through building a small roguelike in Rust. The author has an upcoming book on Rust 2D game development that's in beta https://pragprog.com/titles/hwrust/hands-on-rust/ https://pragprog.com/titles/hwrust/hands-on-rust/ that seems to be a more fleshed out version of the original tutorial
- worldsayshi 6y agoSome of the libraries seem stale. libovr is "Last Updated almost 5 years ago" so I guess it's abandoned? Maybe the last updated status could be brought to the arewegameyet page?
- Tade0 6y agoTo me a metric of "last time an actual human being responded to an issue" is much more informative.
- zaarn 6y agoDoesn't help if the response was "closed, I don't care about this project anymore".
- colejohnson66 6y agoAren’t these websites manually created though? In which case, a simple check every month for “new issues with responses, and if so, are they not abandoned” would be nice
- zaarn 6y agoThey are, but information about if a project is still actively maintained or if it's simply feature complete (data structures come to mind), should be automated in some way, otherwise information becomes stale if the maintainer of that site isn't actively maintaining it (ironically). From what I've experienced, these sites largely go via passive maintainance, ie, based on pull requests and issues, not actively developing or updating things.
- acje 6y agoI'd love to see some kind of metric on crates.io to designate the quality of a crate. I appreciate that creating such a metric could lead to freak economics, so this is obviously not a trivial task, and the metric(s) may have to be mixed up every now and then to avoid to much gaming. Also it might be useful if such metrics are a geometric mean of the crates own score and all its dependencies.
- pansa2 6y agoI assume most game development (or, at least, game engine development) is still in C++? How easy would it be to start moving parts of it to Rust? For example, if I were to write a library (e.g. a physics engine) in Rust, how easy is it for game developers to incorporate it into their C++ games? Would they need to set up a separate Rust toolchain alongside their existing C++ one? It seems it would be much harder to for them to include my library compared to a competing one that’s written in C++ - especially if the competing library is available as a single header file.
- girvo 6y agoThe rise of Unity (C#) and Godot (GDScript or C#) would make me think that most game code is starting to move away from raw C++ — but of course the core engine code is still C++ indeed.
- mqp 6y agoUnity has a c# scripting api, layered on the core c++ foundation. Unreal, on the hand, is C++ top and bottom.
- slezyr 6y ago> Unreal, on the hand, is C++ top and bottom. They have Blueprints[1] (visual scripting) and had a scripting language. However, they have removed it since then. 1: https://docs.unrealengine.com/en-US/ProgrammingAndScripting/Blueprints/GettingStarted/index.html https://docs.unrealengine.com/en-US/ProgrammingAndScripting/...
- lfowles 6y agoA runtime scripting language is coming back in some form or another thanks to Epic acquiring the SkookumScript team.
- Thaxll 6y ago"would make me think that most game code is starting to move away from raw C++" Godot is talked about on Hacker News but it's nowhere in the industry, as for C++ it's the default language for games and it will be the case for the foreseeable future. I feel that there is a real disconnect between hacker news and people working in the industry. Most people here don't seem to understand how different it is from your regular CRUD app compagny.
- adamnemecek 6y agoPeep rg3d https://github.com/mrDIMAS/rg3d https://github.com/mrDIMAS/rg3d and join the discord https://discord.gg/xENF5Uh https://discord.gg/xENF5Uh Only tangentially related but if you are looking for a 2d graphics crate peep femtovg https://github.com/femtovg/femtovg https://github.com/femtovg/femtovg And join the discord https://discord.gg/V69VdVu https://discord.gg/V69VdVu
- offtop5 6y agoGood work! I'm still waiting on Rust to mature a bit, but I might experiment with building a game in something aside from Unity for my next project.
- adamnemecek 6y agoYou should check out wgpu for rendering https://github.com/gfx-rs/wgpu https://github.com/gfx-rs/wgpu.
- TheHideout 6y agoTangentially related - if anyone is new to Rust and wants to see some simple mini text game examples, I've been working on a bunch [0]. It also includes some more complicated text games: Asylum - Choose your own adventure style interactive narrative Knights and Barbarians - Simple turned based strategy game Legend of the Rusty Dragon - Simple adventure game inspired by Legend of the Red Dragon [0] https://github.com/Syn-Nine/rust-mini-games https://github.com/Syn-Nine/rust-mini-games
- Mscottpaper 6y agoThe hobo got me
- MaulingMonkey 6y agoNeat! I used these as an excuse to play with / work on WASM build tools / WASI interop. I've uploaded a built version to github so you can play them directly in your browser: https://github.com/MaulingMonkey/cargo-html/wiki/Examples#rust-mini-games https://github.com/MaulingMonkey/cargo-html/wiki/Examples#ru... I've sent a couple of PRs for things I found useful - feel free to ignore them if they're not to your liking ;)
- TheHideout 6y agoGreat, thanks!
- faeyanpiraat 6y agoCan you make Rust in Rust?
- gameswithgo 6y agoYes
- deleted 6y ago[deleted]
- nindalf 6y agoRust is implemented in Rust (https://github.com/rust-lang/rust https://github.com/rust-lang/rust)
- steveklabnik 6y ago(They are making a joke about the game named “Rust”)
- nindalf 6y agoCan't believe I wooshed that one after years of telling lost redditors on /r/rust "you're probably looking for /r/playrust"
- steveklabnik 6y ago:D (A few months ago, I actually gave the game a try. I had a good time and it was very funny to post about.)
- 3PS 6y agoStrictly speaking rustc has a dependency on LLVM, which is in C++, but you could use the rustc_codegen_cranelift backend [1] and get pretty much everything to be pure Rust. Unless you count the libc dependency, in which case, um, I guess you could use relibc [2]? And if you think relying on OS syscalls implemented in not-Rust is cheating, then you could just use Redox directly ;) [1] https://github.com/bjorn3/rustc_codegen_cranelift https://github.com/bjorn3/rustc_codegen_cranelift [2] https://github.com/redox-os/relibc https://github.com/redox-os/relibc
- FpUser 6y agoNot deeply familiar with Rust but with its memory management concept does it allow for something like arena allocator?
- ibraheemdev 6y agoYup: https://docs.rs/typed_arena https://docs.rs/typed_arena
- whateveracct 6y agoThat just has allocation, but no way to reset the arena & reclaim its memory. But then again, you'd have to make it so no allocations from the arena are alive & in use when you reset the arena. Definitely a downside :/ On a side-note: I'm fairly sure the ST trick + -XLinearTypes will allow a better & still type-safe arena allocator to be written in Haskell than is currently possible in Rust.
- gpm 6y ago> but no way to reset the arena & reclaim its memory. But then again, you'd have to make it so no allocations from the arena are alive & in use when you reset the arena Looks like that implementation doesn't, but the borrow checker can definitely specify that sort of constraint (it looks `fn foo(self) -> Self`). I think it's not exposed because the code assumes that all but the last chunk are completely filled - but it could also just be that no one asked for that.
- pornel 6y agoBorrows are scope based, so if you limit arena usage to a scope (e.g. inside your frame loop), then it should be fairly trivial to reset it. Reclaiming should theoretically be possible too via a method that takes ownership of the arena (the borrow checker prevents moves while an object is borrowed).
- whateveracct 6y agohm interesting - so basically, the blocks you borrow from the arena can be scoped to be <= the scope of the arena itself, which will then make them respect a reset?
- throwaway894345 6y agoAre there any resources for developing 2D game graphics, especially for hobbyists? It seems like game development articles focus so much on frameworks and just assume everyone knows where to find / how to make graphics, audio, etc. I would be especially interested in a high level "how to make a game" that didn't go so in-depth into the programming details but which did include procuring the assets and perhaps some standard patterns/strategies for managing them in your code. Also, even the general approach for game development--presumably there's some white boarding phase followed by a wireframe phase etc like you have with app dev? What does that look like in game dev land, what are some reasonable tools for hobbyists for each stage, etc?
- bluejekyll 6y agoYou might want to look at bevy, there are some great tutorials available for it: https://bevyengine.org/ https://bevyengine.org/
- slmjkdbtl 6y agoECS is not for beginners who just want to get a quick game out, or anyone who has <500 entities in a scene
- bluejekyll 6y agoSince no one has directly said it, I think bevy hides a significant amount of the ECS from the developer in a really elegant way. I agree with Weebs assessment as well. But in particular, bevy has an extremely simple ECS api. (Though, I will admit, I’ve only dabbled in this space and mainly followed some tutorials, so your mileage may vary)
- Weebs 6y agoI've gotta say though as a beginner, I found ECS more approachable than the Actor/Object systems common in engines. Granted, I do a lot of FP and digesting data, so a series of systems to operate on data is sort of home turf. In the end though, I've been using the traditional OO systems in Unity because most educational resources + documentation are so focused around that
- farisjarrah 6y agoPart of me worries about all of the awesome speedrunning people do in games written in more memory unsafe languages(like doom 2) and it makes me a bit sad that there could potentially be less broken games that people can take advantage of for speedrunning.
- Tuna-Fish 6y agoDon't worry, logic errors will be with us always.
- Weebs 6y agoThank goodness for air strafing
- imtringued 6y agohttps://youtu.be/8oM_UTdfaPc?t=1256 https://youtu.be/8oM_UTdfaPc?t=1256 This is just a UI glitch. No memory shenanigans needed.
- cobalt 6y agoI'm gonna guess 90% those are physics errors either in logic (bunny hopping) or issues with floating point/bad geometry/overlooked design (doors that push you out of the world) if you stand behind them as they ope
- Arelius 6y agoSince I don't see it mentioned, Embark uses a lot of Rust, and has started to create a community around Rust Games Development: https://www.embark.dev/ https://www.embark.dev/ and their Discord: https://discord.com/invite/8TW9nfF https://discord.com/invite/8TW9nfF
- erlend_sh 6y agoFor getting started with Rust gamedev, I recommend the following resources: https://sokoban.iolivia.me https://sokoban.iolivia.me https://bfnightly.bracketproductions.com/rustbook/chapter_0.html https://bfnightly.bracketproductions.com/rustbook/chapter_0.... https://pragprog.com/titles/hwrust/hands-on-rust/ https://pragprog.com/titles/hwrust/hands-on-rust/ If you’re looking for a simple project to start with, adding new Items or Leaders to Shotcaller (my game) should be quite straightforward after perusing some of the above resources. https://github.com/amethyst/shotcaller https://github.com/amethyst/shotcaller We’re happy to help any newcomers along on our Discord: https://discord.gg/qvJyTYM https://discord.gg/qvJyTYM
- stolen_biscuit 6y agoSince I haven't seen it mentioned in the comments, Veloren is a FOSS cube world inspired game that's developed entirely in Rust. Looks simply stunning and I have high hopes for it. https://veloren.net/ https://veloren.net/ https://gitlab.com/veloren/veloren https://gitlab.com/veloren/veloren
- bavell 6y agoInstantly recognized my favorite CSS framework being used - SemanticUI. Love it! XD