I am beginner wanting to make a game, and chose to learn Ruby ,since it seems easier to read than most languages.

Reading up on Ruby, I find that Ruby could be used to make small-scale games, but it's garbage collector was a serious problem. The post I read had been closed, so the most recent post was from 2013. In contrast, Ruby 2.0 came out in 2013, and apparently the garbage collector got better. I was wondering if the garbage collector is still a major problem.

To be a little more specific, the game I want to make is going to be 2D, using pixel art. It's a small PvP game using LAN. I want to make 7 character classes, but I can start with less. This game is quite small, but there are a lot of things I want to add as I get more experience, such as a story.

Does the garbage collector still make game development a problem, in Ruby?

  • I've never heard of ruby being used in game development. – Alexandre Vaillancourt Jan 18 '17 at 18:21
  • 1
    @AlexandreVaillancourt RpgMaker used Ruby up until the MV release, which now uses Javascript. – Krythic Jan 18 '17 at 18:27
  • @Krythic That's good to know! – Alexandre Vaillancourt Jan 18 '17 at 18:28
  • @Krythic yes i knew that rpg maker used ruby before but i'm looking to not money at all if possbile for now but it still a good option. – Zero Jan 18 '17 at 18:36
  • Isn't ruby a server side language? If so, then making a game with it is like making a game with php. – Bálint Jan 19 '17 at 8:54
up vote 3 down vote accepted

Let's first discuss your concerns of a garbage collector. Truthfully, it really shouldn't matter much, that is, assuming you're being smart about how you write your code. If you're working in a managed environment, you will need to obey several constraints while you code; the rendering loop is a good example. In constant loops you should be generating as little garbage as possible, by that I actually mean zero allocations. You need to be initializing as much data as you can beforehand, caching it, and reusing it. In other routines of your game/engine this can be different, because those routines will be executed infrequently. Also, consider using structs in place of certain plain-data classes, like Points, Vector2, Vector3, and Matrices. Structs are value types, thus are not allocated to the heap, that means no garbage collection.

  • The GC portion of your answer is perfect. -1 for the opinion presented without technical justification. Structs are not the be-all-end-all of anything, as proven by many successful games written without them. Will retract if you re-work your structs opinion into an objective technical explanation as to their utility, so OP can make their own determination as to their necessity. Or just remove the structs portion altogether, as the GC portion answers the OP perfectly. – darkside Jan 19 '17 at 0:50
  • @ananas There, I fixed it. – Krythic Jan 19 '17 at 1:53

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.