[HN Gopher] Are we game yet? - A guide to the Rust game developm...
       ___________________________________________________________________
        
       Are we game yet? - A guide to the Rust game development ecosystem
        
       Author : lnyan
       Score  : 261 points
       Date   : 2021-02-10 11:36 UTC (11 hours ago)
        
 (HTM) web link (arewegameyet.rs)
 (TXT) w3m dump (arewegameyet.rs)
        
       | worldsayshi wrote:
       | Some 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 wrote:
         | To me a metric of "last time an actual human being responded to
         | an issue" is much more informative.
        
           | zaarn wrote:
           | Doesn't help if the response was "closed, I don't care about
           | this project anymore".
        
             | colejohnson66 wrote:
             | Aren'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 wrote:
               | They 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 wrote:
               | I'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.
        
               | turminal wrote:
               | I feel like this would do more bad than good no matter
               | how complicated the metric would be.
        
               | acje wrote:
               | I agree that there be dragons, but maybe simpler metrics
               | would be better? As an example; what if I could easily
               | filter by crates supported by a team rather than a
               | individual included in all its dependencies. That could
               | be a way of doing risk mitigation. The metric would also
               | work as incentive to create a more connected community.
        
               | mattgreenrocks wrote:
               | The quality of a crate is based on how well it solves the
               | goal it set out to do.
               | 
               | To assess that, users need to skim the code and
               | documentation to gauge for themselves. There is no
               | universal score. This is a feature, not a bug.
        
       | FpUser wrote:
       | Not deeply familiar with Rust but with its memory management
       | concept does it allow for something like arena allocator?
        
         | the_duke wrote:
         | Yes, but for now only if you use custom data structures.
         | 
         | Custom allocator support for the std types (Vec, HashMap, etc)
         | is coming, but at a snails pace.
        
         | ibraheemdev wrote:
         | Yup: https://docs.rs/typed_arena
        
           | whateveracct wrote:
           | That 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.
        
             | pornel wrote:
             | Borrows 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 wrote:
               | hm 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?
        
             | gpm wrote:
             | > 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.
        
       | TheHideout wrote:
       | Tangentially 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
        
         | Mscottpaper wrote:
         | The hobo got me
        
       | farisjarrah wrote:
       | Part 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 wrote:
         | Don't worry, logic errors will be with us always.
        
           | Weebs wrote:
           | Thank goodness for air strafing
        
             | imtringued wrote:
             | https://youtu.be/8oM_UTdfaPc?t=1256
             | 
             | This is just a UI glitch. No memory shenanigans needed.
        
       | stolen_biscuit wrote:
       | Since 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://gitlab.com/veloren/veloren
        
       | pizza234 wrote:
       | It'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.
        
         | yrgulation wrote:
         | I 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 wrote:
           | According 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
        
         | Impossible wrote:
         | Rust roguelike tutorial
         | 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/ that seems to
         | be a more fleshed out version of the original tutorial
        
         | yagizdegirmenci wrote:
         | Embark Studio has a great blog post about this.
         | 
         | Inside Rust at Embark: https://medium.com/embarkstudios/inside-
         | rust-at-embark-b82c0...
        
         | MaulingMonkey wrote:
         | https://michaelfairley.com/blog/i-made-a-game-in-rust/ perhaps?
        
         | hectorlorenzo wrote:
         | I just recently came across these two videos.
         | 
         | Using Rust For Game Development by Catherine West:
         | https://www.youtube.com/watch?v=aKLntZcp27M
         | 
         | Counter-rant from Jonathan Blow:
         | https://www.youtube.com/watch?v=4t1K66dMhWk
        
           | badsectoracula wrote:
           | I'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 wrote:
             | Yeah, 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).
        
           | adwn wrote:
           | > _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?
        
             | neutronicus wrote:
             | Her talk is basically "Introduction to Entity Component
             | Systems for Rust Programmers," and it has an implicit
             | secondary thesis that implementing the ECS in Rust adds
             | value vs implementing it in e.g. C++.
             | 
             | He seems to disagree with that secondary thesis. He thinks
             | she did a good job implementing a toy ECS, but that Rust
             | itself wasn't particularly helpful to her.
        
             | indy wrote:
             | An 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 wrote:
               | > _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.
        
               | meheleventyone wrote:
               | Yeah the confusion comes because entities are no longer a
               | concrete element of the program but a concept tying
               | components together. It's just as valid to look at a
               | subset of the components that are referenced by an entity
               | id as a view as it is to look at them all. Like a
               | relational database.
               | 
               | And by breaking things into components the granularity of
               | ownership is increased compared with the equivalent
               | concrete representation of the same data. So whilst you
               | can't reason about ownership of an entity as it primarily
               | exists conceptually the ownership of its constituent
               | parts is well defined.
        
             | gameswithgo wrote:
             | tldnr 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]
        
           | beigeoak wrote:
           | Idk 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!
        
           | Thaxll wrote:
           | The sutdio Catherine West worked for stopped using Rust and
           | went back to C++ fyi.
           | 
           | https://www.reddit.com/r/programming/comments/atyzz4/halley_.
           | ..
        
             | ImprobableTruth wrote:
             | ... 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 wrote:
         | You 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....
        
       | faeyanpiraat wrote:
       | Can you make Rust in Rust?
        
         | [deleted]
        
         | gameswithgo wrote:
         | Yes
        
         | nindalf wrote:
         | Rust is implemented in Rust (https://github.com/rust-lang/rust)
        
           | steveklabnik wrote:
           | (They are making a joke about the game named "Rust")
        
             | nindalf wrote:
             | Can't believe I wooshed that one after years of telling
             | lost redditors on /r/rust "you're probably looking for
             | /r/playrust"
        
               | steveklabnik wrote:
               | :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 wrote:
           | Strictly 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
           | 
           | [2] https://github.com/redox-os/relibc
        
             | gpm wrote:
             | > And if you think relying on OS syscalls implemented in
             | not-Rust is cheating, then you could just use Redox
             | directly ;)
             | 
             | There's a problem though, the hard-drive firmware isn't
             | written in rust, which is _definitely_ cheating :P
             | 
             | I mean someone even managed to run linux _on_ the
             | harddrive, it 's practically a whole extra computer we are
             | using to build rust and it is undoubtedly programmed in C.
        
               | 3PS wrote:
               | > someone even managed to run linux _on_ the harddrive
               | 
               | I had to look this up because I could hardly believe it.
               | 
               | http://spritesmods.com/?art=hddhack&page=1
               | 
               | Wat.
        
       | Arelius wrote:
       | Since 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/ and their Discord:
       | https://discord.com/invite/8TW9nfF
        
       | throwaway894345 wrote:
       | Are 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?
        
         | jakelazaroff wrote:
         | If you're looking for higher-level patterns, this book is
         | great: https://gameprogrammingpatterns.com
        
         | slmjkdbtl wrote:
         | If you want to experience the high level game dev fun, DON'T
         | use Rust, I recommend look at
         | 
         | - love2d (https://love2d.org/)
         | 
         | - PICO-8 (https://www.lexaloffle.com/pico-8.php)
         | 
         | - Clickteam Fusion (https://www.clickteam.com/clickteam-
         | fusion-2-5)
         | 
         | - Godot (https://godotengine.org/)
         | 
         | - Stencyl (http://www.stencyl.com/)
         | 
         | - pygame (https://www.pygame.org/)
        
           | Narishma wrote:
           | That's not what they're asking.
        
             | patrec wrote:
             | I don't know -- Pico-8 seems to be the perfect answer to
             | what the author is asking for: it's a great environment to
             | learn about these things, and there is a large and useful
             | community and pool of resources around it which will tell
             | you exactly how to develop 2D games (including the pico-
             | zines, https://sectordub.itch.io/pico-8-fanzine-1, wiki
             | etc). The0 "cartverse" and the already included games also
             | provide plenty of examples of games that are both easy to
             | learn from and actually fun.
        
           | [deleted]
        
           | jamesgeck0 wrote:
           | Some more fun high level frameworks:
           | 
           | - HaxeFlixel (https://haxeflixel.com/) (Extremely portable)
           | 
           | - Phaser (https://phaser.io/) (HTML5 framework)
           | 
           | - Nico (https://github.com/ftsf/nico) (The PICO-8 API in Nim)
           | 
           | - Pixel Vision 8
           | (https://pixelvision8.github.io/PixelVision8Website/)
           | (Another fantasy console)
        
           | helicalspiral wrote:
           | There's also https://github.com/ggez/ggez for Rust
           | specifically.
        
             | helltone wrote:
             | does it support webasm/html5?
        
               | sanxiyn wrote:
               | README says, "Work in progress: WebAssembly".
        
             | slmjkdbtl wrote:
             | Writing high level game logic in Rust is not fun, you spend
             | more time waiting for compilation and dealing with language
             | problems than real game dev fun.
        
               | spartanatreyu wrote:
               | Rust doesn't have to be slow, look at the Bevy engine for
               | example
        
         | Impossible wrote:
         | For 2D art https://2dgameartguru.com/ might be good. It started
         | as a set of tutorials for game programmers struggling with
         | making art. It specifically focuses on vector art, and pixel
         | art might be more suitable, for that https://lospec.com/ links
         | to many tutorials.
         | 
         | For game design process Game Design Workshop and Challenges for
         | Game Designers are good books that cover process
         | comprehensively (TLDR is quick concept, prototype, play test,
         | refine).
        
         | phaedryx wrote:
         | I've found the DragonRuby Discord channel to be a great
         | resource: http://discord.dragonruby.org/
         | 
         | There are friendly veterans there who will answer all kinds of
         | game questions (not just about DragonRuby).
        
         | anchpop wrote:
         | > 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?
         | 
         | If you're interested in learning more about this, I can't
         | recommend enough The Art of Game Design: A Book of Lenses. The
         | gist is that it's hard to make an actually fun game by working
         | "from first principles", you need to iterate tens if not
         | hundreds of times just to get a solid game idea down (more
         | subtle aspects like balance may require thousands of
         | iterations). So a lot of the work of a game designer is coming
         | up with ways to iterate extremely fast, e.g. by making a
         | prototype of the game using paper figurines and writing the
         | rules in a google doc.
        
           | jkarneges wrote:
           | > it's hard to make an actually fun game
           | 
           | A zillion years ago I used to do hobby games as a solo dev,
           | and it took me a long time to understand this. I was always
           | interested in game engine elements (sprites, tilemaps, input,
           | menus, audio, pathfinding, etc), and I could put those
           | elements together to make halfway decent games (usually by
           | copying existing genres). But assembling those elements is a
           | skill of its own, and this is easy to overlook if you're a
           | programmer who thinks programming is the only challenge to
           | making a game (or making anything :)).
           | 
           | I didn't truly appreciate game design as a skill until I
           | worked with a separate game designer on a project. He made
           | decisions on things that would have never crossed my mind.
           | From that point on, I started seeing game design everywhere.
           | Notably, I started seeing it in older games, ones I had
           | played many times and that inspired me to get into game dev
           | in the first place. I hadn't realized how well thought out
           | the classics were.
        
         | bluejekyll wrote:
         | You might want to look at bevy, there are some great tutorials
         | available for it: https://bevyengine.org/
        
           | slmjkdbtl wrote:
           | ECS is not for beginners who just want to get a quick game
           | out, or anyone who has <500 entities in a scene
        
             | pornel wrote:
             | The basic OOP solution relies on _mutable aliasing_ being
             | available, where any entity can reference any other entity.
             | 
             | Rust won't let you have arbitrary mutable aliasing or risk
             | dangling pointers, so you'd end up fighting the language.
             | In Rust ECS is actually easier, and it's a better fit for
             | the single ownership, shared XOR mutable model.
        
               | slmjkdbtl wrote:
               | That's also why I don't recommend Rust for game dev
               | beginners, I think the most important thing for beginner
               | is to experience the fun of game dev, which is making
               | game logic and making the actual game, even if you go
               | Rust with ECS, you'll still spend most of the time
               | learning ECS, solving compile errors and waiting
               | compilation, stuff that does not have any game dev fun.
        
             | bluejekyll wrote:
             | Since 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)
        
             | AnIdiotOnTheNet wrote:
             | I contend that ECS is overengineering in any game that
             | isn't an immersive sim. It is certainly overengineering for
             | beginners working on relatively simple 2D games.
        
             | Weebs wrote:
             | I'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
        
               | slmjkdbtl wrote:
               | Interesting, the idea of ECS is intuitive to me but
               | actually doing it is kinda hard, mainly because the scope
               | of ECS is kinda vague there're some stuff that you aren't
               | supposed to do with ECS, if you try to do every single
               | aspect of your game in ECS that might result in some
               | messier code. I actually think the Unity way is not bad,
               | it's also a series of components compose an entity, the
               | only difference is not separating data and logic which I
               | found easy to work with and not bad at all.
        
         | throwaway77384 wrote:
         | It might seem tangential to what you're asking, but I felt I
         | learned more about 2d indie gsme dev from Yahtzee's Dev Diary,
         | than most other resources out there:
         | https://www.escapistmagazine.com/v2/category/yahtzees-dev-di...
        
         | jayd16 wrote:
         | If you can splurge, the GDC Vault has a lot of good talks with
         | devs from every discipline.
         | 
         | The median quality of the talks is a fair bit higher than
         | random blogs. There are some amazing gems and duds too.
        
           | Jare wrote:
           | Their YouTube channel is an immense resource, and IIRC all
           | their talks are made public after 2 years (many also before
           | that). So there's plenty to listen before you need to pay for
           | the most recent stuff.
        
         | Tossrock wrote:
         | > 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?
         | 
         | This is called "greyboxing" in game dev, where you build
         | functionality (often levels) with plain grey boxes rather than
         | actual art assets to test whether a concept is fun, playable,
         | etc.
        
         | ducaale wrote:
         | I found these two resources helpful when I needed to do some 2d
         | game development in C++.
         | 
         | - [Remaking Cavestory in c++](https://www.youtube.com/playlist?
         | list=PLNOBk_id22bw6LXhrGfhV...)
         | 
         | - [Dive into C++11/14](https://www.youtube.com/playlist?list=PL
         | TEcWGdSiQenl4YRPvSqW...)
        
         | dmwallin wrote:
         | This is hard to do in a one-size-fits-all fashion because
         | there's a wide range of 2d techniques, tools, and processes
         | available, depending on a multitude of factors, some example
         | ones being:
         | 
         | - Game genre / mechanics
         | 
         | - Your team size/skill sets/experience
         | 
         | - Game engine
         | 
         | - Target platform(s)
         | 
         | - Monetization strategy
         | 
         | 2d games in particular support a wide variety possibilities. If
         | you narrow it down I can more easily point you in the direction
         | of specific helpful resources.
        
           | mattgreenrocks wrote:
           | For me, I'm interested in static typing, ECS-ish, fast
           | feedback loops, and 2D games.
           | 
           | I've used Unity in the past and mostly liked it, but it is
           | infuriating that they haven't fully solved the problem of
           | feedback loops (slow refresh times in the Unity editor with a
           | small project after code changes) given that they're
           | operating in a fully managed context.
        
           | throwaway894345 wrote:
           | Yeah, I guess I'm thinking "hobbyist", so team size of 1 and
           | no monetization strategy. Simple game engine (preferably in
           | Go or Rust or some similarly approachable language; my hobby
           | time is to precious to be writing C/C++ again), but maybe
           | getting into the nitty gritty of game engine is too low-level
           | for the write-up that I'm thinking about. I don't have a
           | specific idea for a game, but I'd probably like to putz
           | around with top-down tilers a la Pokemon or Zelda.
        
             | yumaikas wrote:
             | So, for that, I can _easily_ recommend Godot /GDScript and
             | using Asperite for Pixel art, if that's the aesthetic
             | you're going for.
             | 
             | Godot has a little bit of a learning curve, but easily
             | justifies it. I've made some games in it:
             | https://yumaikas.itch.io/. Godot, for 2D games, for me, has
             | been a force multiplier in terms of what I can get done in
             | X hours. For Hobbyist work, that just means you can take on
             | more ambitious projects without having to do as much
             | groundwork.
             | 
             | Barring that, you could look into bindings in your language
             | of choice to Raylib. I've used a tiny bit of it with Janet
             | via Jaylib.
             | 
             | If Lua or Fennel aren't hateful to you, there's always
             | Love2D, TIC-80, or PICO-8. But, tbh, I really recommend
             | learning Godot.
        
               | [deleted]
        
         | pjungwir wrote:
         | The book _Game Engine Architecture_ by Jason Gregory might be
         | more detailed than you 'd like, but it still covers a lot of
         | those issues (for both 2D and 3D). As a programmer-but-not-a-
         | game-programmer, I was fascinated to read about the different
         | modules within a game and how they interact. Before reading, if
         | I ever did write a game, I probably would have ignored the
         | "don't write your own engine" advice. Maybe I still would. :-)
         | But at least I have a taste of the awesome amount an engine
         | gives you.
        
       | pansa2 wrote:
       | I 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.
        
         | hn8788 wrote:
         | Godot is written in C++, but it has a stable C ABI, so it's
         | pretty straightforward to include functionality written in
         | Rust.
        
           | slezyr wrote:
           | They have [semi?]official bindings for Rust
           | https://github.com/godot-rust/godot-rust
        
             | worble wrote:
             | I don't think there's anything official about it? Anyone
             | can create bindings from their language of choice to
             | GDNative.
             | 
             | Unless the maintainer is directly involved in godot or
             | something (I couldn't see any evidence of this from quickly
             | checking their profile), it looks like a community effort
             | to me.
        
         | nullcat wrote:
         | There's something called a foreign function interface that
         | allows rust to access compiled c++ or c primitives.
        
         | datalus wrote:
         | Rust has good C interoperability. So from C++ it'd look like a
         | C library. You can either write your own glue code or use
         | something like cbindgen to autogen the header file.
        
           | pizza234 wrote:
           | Interestingly, somebody pointed out in a previous discussion
           | that a potentially significant interoperability hurdle (which
           | is the case for the Qt libraries) is that, if a library makes
           | use of multiple inheritance levels, it translates poorly into
           | any language not supporting inheritance.
        
           | gmueckl wrote:
           | Many interesting SDKs come with C++ APIs that aren't
           | necessarily translatable to C. Choosing Rust for engine
           | development has the potential of severely hamstringing the
           | team. It is the same tough uphill battle for all languages
           | that aren't C++. Even more so now that the smoke is slowly
           | rising from the battlefield of licensed engines and only a
           | few contenders remain standing. And all of them have a
           | massive C++ codebase and litttle incentive to toss that out.
           | 
           | If there will be a transition to any other language in that
           | space, it'll take a decade or two.
        
             | virtualritz wrote:
             | There is an effort to automate generating mid-level C
             | bindings for C++ code automagically, to enable easier
             | wrapping in high level Rust APIs, by an unofficial Academy
             | [of Motion Pictures] Software Foundation group. It is
             | called C++-- [1].
             | 
             | At this time we only target the VFX C++ ecosystem but I'd
             | be surprised if people wouldn't use (and extend) this to
             | cover a broader set of C++ libs.
             | 
             | Maybe you can give an example of a C++ API that you deem
             | not "translatable to C"?
             | 
             | [1] https://github.com/vfx-rs/cppmm
        
               | radarsat1 wrote:
               | That's kind of hilarious given the role that C++ to C
               | compiler had in the early development of the language
               | [1]. But sounds useful, thanks for the link.
               | 
               | [1] https://en.wikipedia.org/wiki/Cfront
        
         | the_duke wrote:
         | cxx [1] is a relatively recent effort to enable safe interop
         | with C++.
         | 
         | Mozilla has also published information on how they are
         | rewriting components in Rust and integrating them into the
         | Firefox codebase, though they were using C apis - exposing Rust
         | to C and vice versa is relatively straight-forward.
         | 
         | [1] https://github.com/dtolnay/cxx
        
         | gameswithgo wrote:
         | simple matter of programming
        
         | fulafel wrote:
         | The vast majority of games are indeed developed in other
         | languages than C++. The native languages of the most widely
         | used game platforms are C# for anything done with Unity,
         | Java/Kotlin for Android, and Swift/Objective-C for iOS.
         | 
         | The C ABI is the lingua franca still, you can call it from all
         | of the above. And you can expose a C ABI for your Rust library.
        
         | girvo wrote:
         | The 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.
        
           | Thaxll wrote:
           | "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.
        
             | zerr wrote:
             | Engine development and game development are two different
             | things. For gameplay/scripting, even in 90s there were
             | alternative languages. The way Unreal uses C++ (i.e. as
             | scripting) is not different to how Unity uses C#.
        
               | lima wrote:
               | At some point, every game development project becomes
               | engine development :-)
        
               | pjmlp wrote:
               | Yep, it even has a GC for the C++ based entities.
        
             | pjmlp wrote:
             | While the disconnect is true, specially in what concerns
             | FOSS views of the world and how real studios work,
             | middleware like Unity and WaveEngine are indeed being
             | picked up by major studios.
             | 
             | On the Switch alone, a very big chunk are all based on
             | Unity, more than 50% as per Unity official statement.
             | 
             | Also although the engine is still mostly C++, they have
             | been porting the rendering pipeline into HPC#.
        
           | mqp wrote:
           | Unity has a c# scripting api, layered on the core c++
           | foundation. Unreal, on the hand, is C++ top and bottom.
        
             | slezyr wrote:
             | > 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/...
        
               | lfowles wrote:
               | A runtime scripting language is coming back in some form
               | or another thanks to Epic acquiring the SkookumScript
               | team.
        
       | adamnemecek wrote:
       | Peep rg3d https://github.com/mrDIMAS/rg3d and join the discord
       | 
       | https://discord.gg/xENF5Uh
       | 
       | Only tangentially related but if you are looking for a 2d
       | graphics crate peep femtovg https://github.com/femtovg/femtovg
       | 
       | And join the discord https://discord.gg/V69VdVu
        
         | offtop5 wrote:
         | Good 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 wrote:
           | You should check out wgpu for rendering
           | https://github.com/gfx-rs/wgpu.
        
       | erlend_sh wrote:
       | For getting started with Rust gamedev, I recommend the following
       | resources:
       | 
       | https://sokoban.iolivia.me
       | 
       | https://bfnightly.bracketproductions.com/rustbook/chapter_0....
       | 
       | 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
       | 
       | We're happy to help any newcomers along on our Discord:
       | https://discord.gg/qvJyTYM
        
       ___________________________________________________________________
       (page generated 2021-02-10 23:01 UTC)